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

Function assert_expected_fail

e2e/rust/tests/gpu/workloads.rs:135–164  ·  view source on GitHub ↗
(workload: &WorkloadDefinition)

Source from the content-addressed store, hash-verified

133}
134
135async fn assert_expected_fail(workload: &WorkloadDefinition) {
136 let mut args = vec![
137 "--gpu".to_string(),
138 "--from".to_string(),
139 workload.image.clone(),
140 "--".to_string(),
141 ];
142 args.extend(workload.command.clone());
143 let arg_refs = args.iter().map(String::as_str).collect::<Vec<_>>();
144
145 match create_workload_sandbox(&arg_refs).await {
146 Ok(mut guard) => {
147 let clean_output = strip_ansi(&guard.create_output);
148 guard.cleanup().await;
149 panic!(
150 "GPU workload '{}' unexpectedly succeeded. Output:\n{clean_output}",
151 workload.name
152 );
153 }
154 Err(err) => {
155 let clean_output = strip_ansi(&err);
156 assert!(
157 clean_output.contains(GPU_WORKLOAD_FAILURE_MARKER),
158 "expected failure marker {GPU_WORKLOAD_FAILURE_MARKER} for workload '{}' image {} in failure output:\n{clean_output}",
159 workload.name,
160 workload.image,
161 );
162 }
163 }
164}
165
166#[tokio::test]
167#[serial(gpu)]

Calls 3

create_workload_sandboxFunction · 0.85
strip_ansiFunction · 0.85
cleanupMethod · 0.80

Tested by

no test coverage detected