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

Function test_project_volume_mounts_readonly

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

Source from the content-addressed store, hash-verified

1535
1536 #[tokio::test]
1537 async fn test_project_volume_mounts_readonly() {
1538 use crate::context::{BindMount, SharedConfig, TskConfig, VolumeMount};
1539 use std::collections::HashMap;
1540
1541 let mock_client = Arc::new(TrackedDockerClient::default());
1542
1543 // Create TskConfig with a readonly bind mount
1544 let mut project_configs = HashMap::new();
1545 project_configs.insert(
1546 "default".to_string(),
1547 SharedConfig {
1548 volumes: vec![VolumeMount::Bind(BindMount {
1549 host: "/etc/ssl/certs".to_string(),
1550 container: "/etc/ssl/certs".to_string(),
1551 readonly: true,
1552 })],
1553 ..Default::default()
1554 },
1555 );
1556 let tsk_config = TskConfig {
1557 project: project_configs,
1558 ..Default::default()
1559 };
1560
1561 let ctx = AppContext::builder().with_tsk_config(tsk_config).build();
1562 let manager = DockerManager::new(&ctx, mock_client.clone(), None);
1563
1564 let task = create_test_task(false);
1565 let agent = crate::agent::ClaudeAgent::with_tsk_env(ctx.tsk_env());
1566 let result = manager.run_task_container("tsk/base", &task, &agent).await;
1567
1568 assert!(result.is_ok());
1569
1570 let create_calls = mock_client.create_container_calls.lock().unwrap();
1571 let task_container_config = &create_calls[1].1;
1572 let host_config = task_container_config.host_config.as_ref().unwrap();
1573 let binds = host_config.binds.as_ref().unwrap();
1574
1575 // Should have base binds + readonly bind mount
1576 assert_eq!(binds.len(), 5);
1577 assert!(
1578 binds
1579 .iter()
1580 .any(|b| b.contains("/etc/ssl/certs:/etc/ssl/certs:ro"))
1581 );
1582 }
1583
1584 #[tokio::test]
1585 async fn test_no_project_volumes_when_project_not_configured() {

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