Commit 1f79bca
committed
ci/maintenance-unit-tests: stop+rm long-up named test-service containers
Tests that exercise module_postgres / module_redis / module_immich
(and friends) spawn long-running service containers — postgres,
postgres-immich, mysql, redis — and only call `remove` if the test
reaches that stage. An interrupted test (or one that only does
install) leaves them wedged on the runner; the diagnostic step on
this branch's first run showed postgres-immich and mysql with
'Up 7 days', and a `postgres` container in 'Created' state for 8h
because its 5432 publish was held by the older one.
Add a second cleanup block to both diagnostic steps, ahead of the
orphaned-Created sweep, that stop+rm's exactly these four names if
they have been *running for more than 2 hours*. The threshold is
the safety knob: native job timeout-minutes is 90, emulated 210
(3.5h), so 2h sits comfortably below "test still in flight" and
well above "leftover from a prior run". Anything younger is left
alone — the next slot's start will pick it up if needed.
Implementation:
* Names are exact-match anchored ('^name$') so a future sibling
like 'mysql-readonly' or 'postgres-staging' isn't caught.
* Stopped / Created containers are deliberately skipped here —
the orphaned-Created sweep below uses the bare-hash filter
and handles them safely.
* Uptime via 'docker inspect ... .State.StartedAt' → 'date -d'
→ epoch math. GNU date is standard on Linux runners.
* 'docker stop --time 30' gives postgres / mysql a chance to
flush the WAL before SIGKILL; '|| true' on each docker call
so a transient hiccup doesn't fail the test slot.
* Output is one line per name ('absent', 'recent <2h (skip)',
'stopped (skip — orphan sweep handles below)', or
'stop+rm: <name> (up Xh)') so the GHA log shows exactly which
containers were touched and why.
Runs *before* the orphaned-Created sweep so a freshly-stopped
service isn't briefly seen as orphan in the same pass.
Same block in both gradle-native and gradle-emulated diagnostic
steps so the cleanup fires on both runner hosts (the arm64 host
is only seen by native; the amd64 host is seen by both).1 parent 9ce9fa7 commit 1f79bca
1 file changed
Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
245 | 296 | | |
246 | 297 | | |
247 | 298 | | |
| |||
412 | 463 | | |
413 | 464 | | |
414 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
415 | 517 | | |
416 | 518 | | |
417 | 519 | | |
| |||
0 commit comments