(engine: &ContainerEngine)
| 118 | } |
| 119 | |
| 120 | fn container_engine_info(engine: &ContainerEngine) -> Value { |
| 121 | let output = engine |
| 122 | .command() |
| 123 | .args(["info", "--format", "json"]) |
| 124 | .output() |
| 125 | .unwrap_or_else(|err| panic!("failed to run {} info: {err}", engine.name())); |
| 126 | |
| 127 | let stdout = String::from_utf8_lossy(&output.stdout); |
| 128 | let stderr = String::from_utf8_lossy(&output.stderr); |
| 129 | let combined = format!("{stdout}{stderr}"); |
| 130 | assert!( |
| 131 | output.status.success(), |
| 132 | "{} info --format json failed with status {:?}:\n{}", |
| 133 | engine.name(), |
| 134 | output.status.code(), |
| 135 | combined |
| 136 | ); |
| 137 | |
| 138 | serde_json::from_slice(&output.stdout).unwrap_or_else(|err| { |
| 139 | panic!( |
| 140 | "failed to parse {} info JSON: {err}\n{combined}", |
| 141 | engine.name() |
| 142 | ) |
| 143 | }) |
| 144 | } |
| 145 | |
| 146 | fn info_string<'a>(info: &'a Value, keys: &[&str]) -> Option<&'a str> { |
| 147 | keys.iter() |
no test coverage detected