MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_project_volume_mounts_named

Function test_project_volume_mounts_named

src/docker/mod.rs:1489–1534  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1487
1488 #[tokio::test]
1489 async fn test_project_volume_mounts_named() {
1490 use crate::context::{NamedVolume, SharedConfig, TskConfig, VolumeMount};
1491 use std::collections::HashMap;
1492
1493 let mock_client = Arc::new(TrackedDockerClient::default());
1494
1495 // Create TskConfig with a named volume for the test project
1496 let mut project_configs = HashMap::new();
1497 project_configs.insert(
1498 "default".to_string(),
1499 SharedConfig {
1500 volumes: vec![VolumeMount::Named(NamedVolume {
1501 name: "build-cache".to_string(),
1502 container: "/container/cache".to_string(),
1503 readonly: false,
1504 })],
1505 ..Default::default()
1506 },
1507 );
1508 let tsk_config = TskConfig {
1509 project: project_configs,
1510 ..Default::default()
1511 };
1512
1513 let ctx = AppContext::builder().with_tsk_config(tsk_config).build();
1514 let manager = DockerManager::new(&ctx, mock_client.clone(), None);
1515
1516 let task = create_test_task(false);
1517 let agent = crate::agent::ClaudeAgent::with_tsk_env(ctx.tsk_env());
1518 let result = manager.run_task_container("tsk/base", &task, &agent).await;
1519
1520 assert!(result.is_ok());
1521
1522 let create_calls = mock_client.create_container_calls.lock().unwrap();
1523 let task_container_config = &create_calls[1].1;
1524 let host_config = task_container_config.host_config.as_ref().unwrap();
1525 let binds = host_config.binds.as_ref().unwrap();
1526
1527 // Should have base binds + named volume (prefixed with tsk-)
1528 assert_eq!(binds.len(), 5);
1529 assert!(
1530 binds
1531 .iter()
1532 .any(|b| b.contains("tsk-build-cache:/container/cache"))
1533 );
1534 }
1535
1536 #[tokio::test]
1537 async fn test_project_volume_mounts_readonly() {

Callers

nothing calls this directly

Calls 5

with_tsk_configMethod · 0.80
tsk_envMethod · 0.80
run_task_containerMethod · 0.80
create_test_taskFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected