(workload: &WorkloadDefinition)
| 133 | } |
| 134 | |
| 135 | async 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)] |
no test coverage detected