mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Merge pull request #128582 from pohly/dra-resourceslice-unit-test-fix
DRA resource slice controller: fix unit test flake
This commit is contained in:
commit
89c1925e23
@ -145,7 +145,7 @@ func TestControllerSyncPool(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"remove-pool": {
|
"remove-pool": {
|
||||||
nodeUID: nodeUID,
|
nodeUID: nodeUID,
|
||||||
syncDelay: ptr.To(time.Duration(0)),
|
syncDelay: ptr.To(time.Duration(0)), // Ensure that the initial object causes an immediate sync of the pool.
|
||||||
initialObjects: []runtime.Object{
|
initialObjects: []runtime.Object{
|
||||||
MakeResourceSlice().Name(resourceSlice1).UID(resourceSlice1).
|
MakeResourceSlice().Name(resourceSlice1).UID(resourceSlice1).
|
||||||
NodeOwnerReferences(ownerName, string(nodeUID)).NodeName(ownerName).
|
NodeOwnerReferences(ownerName, string(nodeUID)).NodeName(ownerName).
|
||||||
@ -683,6 +683,11 @@ func TestControllerSyncPool(t *testing.T) {
|
|||||||
// from informer event handler).
|
// from informer event handler).
|
||||||
actualState := queue.State()
|
actualState := queue.State()
|
||||||
actualState.Later = nil
|
actualState.Later = nil
|
||||||
|
// If we let the event handler schedule syncs immediately, then that also races
|
||||||
|
// and then Ready cannot be compared either.
|
||||||
|
if test.syncDelay != nil && *test.syncDelay == 0 {
|
||||||
|
actualState.Ready = nil
|
||||||
|
}
|
||||||
var expectState workqueue.MockState[string]
|
var expectState workqueue.MockState[string]
|
||||||
assert.Equal(t, expectState, actualState)
|
assert.Equal(t, expectState, actualState)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user