Commit 6625e51
authored
test(engine): fix flaky shared alpine:latest image race (#495)
Closes #485
## Problem
`cli_down_rmi_all_succeeds_and_removes_containers`
(tests/engine_integration/cli3.rs) ran `down --rmi all` against a
compose file referencing the **shared** `alpine:latest` image. Cargo
runs integration tests in parallel, so when this test deleted
`alpine:latest`, concurrent tests doing `up --pull never`
(`cli_up_pull_never_starts_present_image`) or `up --no-start`
(`cli_up_no_start_creates_without_starting`) intermittently failed with
`no such image: alpine:latest` — a different pair failing each run.
## Changes
- **Isolate the rmi-all image.** The test now tags a throwaway,
project-unique local image (`localhost/podup-rmitest-<proj>:latest`)
from `alpine:latest` and references *that* in its compose file, so
`--rmi all` only removes the throwaway tag. Added assertions that the
throwaway image is gone after `down` and (implicitly) that the shared
base image is left intact, plus best-effort cleanup.
- **Remove timing-fragile sleep.** Replaced the fixed `sleep(800ms)` in
`cli_logs_tail_limits_output` with a poll-until-condition loop (matching
the poll-helper pattern in `tests/engine_integration/watch.rs`) that
waits until `logs --tail 2` shows exactly two lines, up to a 30s
deadline.
## Verification (local, Podman 5.4.2)
- Reproduced the setup and confirmed the fix: ran the rmi test together
with `cli_up_pull_never_starts_present_image`,
`cli_up_no_start_creates_without_starting` and
`cli_logs_tail_limits_output` in parallel — all pass, and
`alpine:latest` survives.
- Ran the full `cli3` module twice with `--test-threads=8`: 15/15 pass
both times, no `no such image` flake, `alpine:latest` still present, no
leftover throwaway tags.
- `cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D
warnings`, `cargo build --all-features` all clean.
`cli3.rs` is now 486 lines (under the 500-line limit).
Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>1 parent d25d2bf commit 6625e51
1 file changed
Lines changed: 54 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | 28 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
35 | 50 | | |
36 | 51 | | |
37 | 52 | | |
| |||
173 | 188 | | |
174 | 189 | | |
175 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
176 | 207 | | |
177 | 208 | | |
178 | 209 | | |
179 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
180 | 213 | | |
181 | 214 | | |
182 | 215 | | |
| |||
189 | 222 | | |
190 | 223 | | |
191 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
192 | 239 | | |
193 | 240 | | |
194 | 241 | | |
| |||
0 commit comments