MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / assert_vm_overlay_root

Function assert_vm_overlay_root

e2e/rust/tests/smoke.rs:103–139  ·  view source on GitHub ↗
(sandbox_name: &str)

Source from the content-addressed store, hash-verified

101}
102
103async fn assert_vm_overlay_root(sandbox_name: &str) {
104 let script = concat!(
105 "set -eu; ",
106 "test \"$(stat -f -c %T /)\" = \"overlayfs\"; ",
107 "printf \"overlay-write\\n\" > /sandbox/overlay-check; ",
108 "test \"$(cat /sandbox/overlay-check)\" = \"overlay-write\"; ",
109 "if [ -e /opt/openshell/tls/tls.key ]; then ",
110 "test \"$(stat -c %a /opt/openshell/tls/tls.key)\" = \"600\"; ",
111 "fi; ",
112 "echo vm-overlay-ok",
113 );
114
115 let mut exec_cmd = openshell_cmd();
116 exec_cmd
117 .args(["sandbox", "exec", "--name", sandbox_name, "--no-tty", "--"])
118 .arg("sh")
119 .arg("-lc")
120 .arg(script)
121 .stdout(Stdio::piped())
122 .stderr(Stdio::piped());
123
124 let output = exec_cmd
125 .output()
126 .await
127 .expect("failed to run VM overlay assertion");
128 let combined = strip_ansi(&format!(
129 "{}{}",
130 String::from_utf8_lossy(&output.stdout),
131 String::from_utf8_lossy(&output.stderr),
132 ));
133
134 assert!(
135 output.status.success() && combined.contains("vm-overlay-ok"),
136 "VM overlay assertion failed (status {:?}):\n{combined}",
137 output.status.code(),
138 );
139}

Callers 1

gateway_smokeFunction · 0.85

Calls 2

openshell_cmdFunction · 0.85
strip_ansiFunction · 0.85

Tested by

no test coverage detected