You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "weichen lai (Jira)" <ji...@apache.org> on 2026/10/24 02:22:00 UTC

[jira] [Created] (YUNIKORN-3525) Preemption predicate mock clears errors from other nodes, so tests can pass for the wrong reason

weichen lai created YUNIKORN-3525:
-------------------------------------

             Summary: Preemption predicate mock clears errors from other nodes, so tests can pass for the wrong reason
                 Key: YUNIKORN-3525
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3525
             Project: Apache YuniKorn
          Issue Type: Bug
          Components: test - unit
            Reporter: weichen lai


{{PreemptionPredicatePlugin.PreemptionPredicates}} ({{pkg/mock/preemption_predicate_plugin.go}}) replaces {{errHolder}} on every successful match ({{m.errHolder = &errHolder{}}}). This also drops errors that earlier mismatches on other nodes recorded. {{checkPreemptionPredicates}} runs the checks in parallel, so {{GetPredicateError()}} only reports errors recorded after the last successful match, and which match is last depends on goroutine timing.

Repro: in {{TestTryPreemption_OnNode_ScoresReorderedVictims}} (PR #1195), change node1's expected keys to {{[regular-1, regular-2, originator]}}.
* plain {{go test}}: always passes
* {{-race -tags deadlock}}: fails about 1 in 3 runs

The mock rejects node1, node2 wins as the only candidate, and if node2 answers after node1, node2's match clears node1's error.

So if the {{PreemptAllocationKeys}} passed to {{PreemptionPredicates}} drift from the victim list (e.g. built from the sorted allocations instead), the mock flags it but the error gets cleared. In CI this shows up as a flaky failure, not a consistent one.

Also, the key mismatch error message prints expected and actual swapped.

Suggested fix: keep the first error instead of resetting on a successful match, and swap the args in the key mismatch message.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org