mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fixes the flaky TestDevicePluginReRegistration.
In the current test, there is a race that the new device plugin endpoint may not be added to the device plugin manager endpoints at the time when we call manager.Devices(). Added the checking and waiting for endpoint updates before calling manager.Devices() in the test. Tested: go test -race -count 500 k8s.io/kubernetes/pkg/kubelet/deviceplugin -run TestDevicePluginReRegistration -timeout 5h
This commit is contained in:
parent
8657a74e13
commit
5953a182cf
@ -70,6 +70,13 @@ func TestDevicePluginReRegistration(t *testing.T) {
|
||||
p1.Register(socketName, testResourceName)
|
||||
// Wait for the first callback to be issued.
|
||||
<-callbackChan
|
||||
// Wait till the endpoint is added to the manager.
|
||||
for i := 0; i < 20; i++ {
|
||||
if len(m.Devices()) > 0 {
|
||||
break
|
||||
}
|
||||
time.Sleep(1)
|
||||
}
|
||||
devices := m.Devices()
|
||||
require.Equal(t, 2, len(devices[testResourceName]), "Devices are not updated.")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user