Commit c3abeb3
committed
fix(validator): separate an aborted run from a deployment that never completed
Two residual issues in waitForDeclaredTrainer, both the same class this PR
exists to fix — reporting one condition under another's verdict.
pollCtx.Done() fires for two reasons that mean opposite things: the 2m poll
deadline, and cancellation of the parent context. Only the first means the
delivered Trainer never became complete. The second means the run was aborted —
catalog timeout, canceled phase, killed Job — and reporting that as a customer
deployment defect is the misclassification the Unavailable-to-NotFound swap
fixed, reintroduced one level down. The deadline branch now checks ctx.Err()
first and returns Timeout for a canceled run.
The loop also probed with pollCtx. getTrainerObject checks ctx.Err() at the top
of every read and returns Timeout, so a deadline landing while a probe was in
flight surfaced as a bare timeout rather than the NotFound-plus-diagnosis this
function was built to produce. The probe runs on the parent context now, and the
select owns the deadline exclusively, so the same cluster state cannot produce
two different verdicts depending on where in the loop the clock ran out.
That window was small but widening: the probe makes roughly six sequential Gets,
each with its own DiagnosticTimeout, so on a loaded apiserver it can run for
seconds.
Adds a test for the cancellation path, and notes on the table that the
not-declared-and-absent row is covered by e2e rather than being an oversight —
it downloads and kustomize-builds the upstream archive.
Refs #2297
Signed-off-by: Yuan Chen <yuanchen97@gmail.com>1 parent b09764c commit c3abeb3
2 files changed
Lines changed: 48 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
567 | 572 | | |
568 | 573 | | |
569 | 574 | | |
| |||
575 | 580 | | |
576 | 581 | | |
577 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
578 | 593 | | |
579 | 594 | | |
580 | 595 | | |
| |||
0 commit comments