()
| 1439 | |
| 1440 | #[tokio::test] |
| 1441 | async fn test_project_volume_mounts_bind() { |
| 1442 | use crate::context::{BindMount, SharedConfig, TskConfig, VolumeMount}; |
| 1443 | use std::collections::HashMap; |
| 1444 | |
| 1445 | let mock_client = Arc::new(TrackedDockerClient::default()); |
| 1446 | |
| 1447 | // Create TskConfig with a bind mount for the test project |
| 1448 | let mut project_configs = HashMap::new(); |
| 1449 | project_configs.insert( |
| 1450 | "default".to_string(), |
| 1451 | SharedConfig { |
| 1452 | volumes: vec![VolumeMount::Bind(BindMount { |
| 1453 | host: "/host/cache".to_string(), |
| 1454 | container: "/container/cache".to_string(), |
| 1455 | readonly: false, |
| 1456 | })], |
| 1457 | ..Default::default() |
| 1458 | }, |
| 1459 | ); |
| 1460 | let tsk_config = TskConfig { |
| 1461 | project: project_configs, |
| 1462 | ..Default::default() |
| 1463 | }; |
| 1464 | |
| 1465 | let ctx = AppContext::builder().with_tsk_config(tsk_config).build(); |
| 1466 | let manager = DockerManager::new(&ctx, mock_client.clone(), None); |
| 1467 | |
| 1468 | let task = create_test_task(false); |
| 1469 | let agent = crate::agent::ClaudeAgent::with_tsk_env(ctx.tsk_env()); |
| 1470 | let result = manager.run_task_container("tsk/base", &task, &agent).await; |
| 1471 | |
| 1472 | assert!(result.is_ok()); |
| 1473 | |
| 1474 | let create_calls = mock_client.create_container_calls.lock().unwrap(); |
| 1475 | let task_container_config = &create_calls[1].1; |
| 1476 | let host_config = task_container_config.host_config.as_ref().unwrap(); |
| 1477 | let binds = host_config.binds.as_ref().unwrap(); |
| 1478 | |
| 1479 | // Should have base binds + project bind mount |
| 1480 | assert_eq!(binds.len(), 5); |
| 1481 | assert!( |
| 1482 | binds |
| 1483 | .iter() |
| 1484 | .any(|b| b.contains("/host/cache:/container/cache")) |
| 1485 | ); |
| 1486 | } |
| 1487 | |
| 1488 | #[tokio::test] |
| 1489 | async fn test_project_volume_mounts_named() { |
nothing calls this directly
no test coverage detected