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

Function test_relative_path_conversion

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

Source from the content-addressed store, hash-verified

1401
1402 #[tokio::test]
1403 async fn test_relative_path_conversion() {
1404 let mock_client = Arc::new(TrackedDockerClient::default());
1405 let ctx = AppContext::builder().build();
1406 let manager = DockerManager::new(&ctx, mock_client.clone(), None);
1407
1408 // Create a temporary directory to use as base
1409 let temp_dir = tempfile::TempDir::new().unwrap();
1410 let absolute_path = temp_dir.path().join("test-repo");
1411
1412 let mut task = create_test_task(false);
1413 task.copied_repo_path = Some(absolute_path.clone());
1414 let agent = crate::agent::ClaudeAgent::with_tsk_env(ctx.tsk_env());
1415 let result = manager.run_task_container("tsk/base", &task, &agent).await;
1416
1417 assert!(result.is_ok());
1418
1419 let create_calls = mock_client.create_container_calls.lock().unwrap();
1420 assert_eq!(create_calls.len(), 2); // One for proxy, one for task container
1421 let (_, config) = &create_calls[1]; // Get the task container config, not proxy
1422
1423 let host_config = config.host_config.as_ref().unwrap();
1424 let binds = host_config.binds.as_ref().unwrap();
1425 let repo_bind = &binds[0];
1426
1427 // Should contain an absolute path (starts with /)
1428 assert!(repo_bind.starts_with('/'));
1429 assert!(repo_bind.contains("test-repo"));
1430 assert!(repo_bind.ends_with(":/workspace/default"));
1431
1432 // Should also have the claude directory, instructions, and output mounts
1433 assert_eq!(binds.len(), 4); // workspace, claude dir, instructions, and output
1434 // In test mode, .claude directory is in temp directory
1435 assert!(binds[1].contains(":/home/agent/.claude"));
1436 assert!(binds[2].contains(":/instructions:ro"));
1437 assert!(binds[3].contains(":/output"));
1438 }
1439
1440 #[tokio::test]
1441 async fn test_project_volume_mounts_bind() {

Callers

nothing calls this directly

Calls 5

pathMethod · 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