1 //! The gate against a bundle that runs as a sibling container.2 3 use std::path::PathBuf;4 use std::time::Duration;5 6 use inf3r_container::ContainerSpec;7 use inf3r_verify::{State, Verify};8 9 fn image() -> String {10 std::env::var("INF3R_TEST_IMAGE").unwrap_or_else(|_| "inf3r/mock/x64-cpu:local".to_string())11 }12 13 #[test]14 fn a_container_binding_passes_the_wire_and_cache_checks() {15 let image = image();16 if !inf3r_container::image_present(&image) {17 eprintln!("skip: {image} is not in the local Docker store");18 return;19 }20 // The socket path has to fit SUN_LEN. The CI target directory can be21 // long, so this private test root is /tmp, not `std::env::temp_dir()`.22 let run_dir = PathBuf::from(format!("/tmp/ifg-verify-{}", std::process::id()));23 let _ = std::fs::remove_dir_all(&run_dir);24 let mut spec = ContainerSpec::new(image, "mock/x64-cpu");25 spec.command = vec!["/opt/inf3r/bin/inf3r-mock-x64-cpu".to_string()];26 let report = Verify::container(spec, &run_dir)27 .budget(Duration::from_secs(90))28 .run()29 .expect("the runner returns a report");30 31 assert!(32 report.checks.iter().all(|check| check.state != State::Fail),33 "{report}"34 );35 for name in [36 "describe",37 "chat",38 "cache_roundtrip",39 "cache_corrupt_fallback",40 ] {41 let check = report42 .checks43 .iter()44 .find(|check| check.name == name)45 .unwrap_or_else(|| panic!("no {name} check: {report}"));46 assert_eq!(check.state, State::Pass, "{report}");47 }48 // The trace lives inside the one private socket directory that the engine49 // already has. The scripted crash mode still belongs to the host recipe.50 let abort = report51 .checks52 .iter()53 .find(|check| check.name == "cache_abort_on_crash")54 .unwrap_or_else(|| panic!("no cache_abort_on_crash check: {report}"));55 assert_eq!(abort.state, State::Skip, "{report}");56 let _ = std::fs::remove_dir_all(&run_dir);57 }