From c2e1fdeb7ad28223438d79aa411e85814affedf1 Mon Sep 17 00:00:00 2001 From: Swati Sehgal Date: Tue, 21 Oct 2025 13:33:14 +0100 Subject: [PATCH] node: e2e: Ensure device plugin pod is Running/Ready before registration In the device plugin node reboot e2e test, the registration trigger (control file deletion) was being executed immediately after pod creation. This could create a race condition: the device plugin container might not be fully running, causing the test to flake when devices were not reported as available on the node. This change explicitly waits for the sample device plugin pod to reach the Running/Ready state before deleting the registration control file. This ensures that the device plugin is ready to register its devices with the kubelet, eliminating a possible source of test flakiness. Signed-off-by: Swati Sehgal --- test/e2e_node/device_plugin_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/e2e_node/device_plugin_test.go b/test/e2e_node/device_plugin_test.go index 9ec4e4a378d..c8452f3a951 100644 --- a/test/e2e_node/device_plugin_test.go +++ b/test/e2e_node/device_plugin_test.go @@ -52,6 +52,7 @@ import ( e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles" + testutils "k8s.io/kubernetes/test/utils" ) var ( @@ -867,6 +868,13 @@ func testDevicePluginNodeReboot(f *framework.Framework, pluginSockDir string) { devicePluginPod = e2epod.NewPodClient(f).CreateSync(ctx, dp) + framework.Logf("Waiting for device plugin pod to be Running") + err = e2epod.WaitForPodCondition(ctx, f.ClientSet, devicePluginPod.Namespace, devicePluginPod.Name, "Ready", 2*time.Minute, testutils.PodRunningReady) + if err != nil { + framework.Logf("Sample Device Pod %v took too long to enter running/ready: %v", dp.Name, err) + } + framework.ExpectNoError(err, "WaitForPodCondition() failed err: %v", err) + go func() { // Since autoregistration is disabled for the device plugin (as REGISTER_CONTROL_FILE // environment variable is specified), device plugin registration needs to be triggerred