mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
kubelet: TestSyncKnownPods should not race
SyncKnownPods began triggering UpdatePod() for pods that have been orphaned by desired config to ensure pods run to termination. This test reads a mutex protected value while pod workers are running in the background and as a consequence triggers a data race. Wait for the workers to stabilize before reading the value. Other tests validate that the correct sync events are triggered (see kubelet_pods_test.go#TestKubelet_HandlePodCleanups for full verification of this behavior). It is slightly concerning that I was unable to recreate the race locally even under stress testing, but I cannot identify why.
This commit is contained in:
parent
de9ce03f19
commit
71a36529d1
@ -1637,7 +1637,8 @@ func TestSyncKnownPods(t *testing.T) {
|
||||
// verify workers that are not terminated stay open even if config no longer
|
||||
// sees them
|
||||
podWorkers.SyncKnownPods(nil)
|
||||
if len(podWorkers.podUpdates) != 2 {
|
||||
drainAllWorkers(podWorkers)
|
||||
if len(podWorkers.podUpdates) != 0 {
|
||||
t.Errorf("Incorrect number of open channels %v", len(podWorkers.podUpdates))
|
||||
}
|
||||
if len(podWorkers.podSyncStatuses) != 2 {
|
||||
|
Loading…
Reference in New Issue
Block a user