@@ -54,8 +54,9 @@ import (
5454)
5555
5656const (
57- WaitTimeout = 10 * time .Minute
58- WaitInterval = 5 * time .Second
57+ EventuallyWaitTimeout = 10 * time .Minute
58+ NeverWaitTimeout = 30 * time .Second
59+ WaitInterval = 5 * time .Second
5960
6061 // NVSentinelNamespace is the default namespace where NVSentinel components are deployed
6162 NVSentinelNamespace = "nvsentinel"
@@ -83,7 +84,7 @@ func WaitForNodesCordonState(ctx context.Context, t *testing.T, c klient.Client,
8384
8485 t .Logf ("Nodes with cordon state %v: %d/%d" , shouldCordon , actualCount , targetCount )
8586 return actualCount == targetCount
86- }, WaitTimeout , WaitInterval , "nodes should have cordon state %v" , shouldCordon )
87+ }, EventuallyWaitTimeout , WaitInterval , "nodes should have cordon state %v" , shouldCordon )
8788}
8889
8990// CreateNamespace creates a new Kubernetes namespace with the specified `name`.
@@ -123,7 +124,7 @@ func DeleteNamespace(ctx context.Context, t *testing.T, c klient.Client, name st
123124 var ns v1.Namespace
124125 err := c .Resources ().Get (ctx , name , "" , & ns )
125126 return err != nil && apierrors .IsNotFound (err )
126- }, WaitTimeout , WaitInterval , "namespace %s should be deleted" , name )
127+ }, EventuallyWaitTimeout , WaitInterval , "namespace %s should be deleted" , name )
127128
128129 return nil
129130}
@@ -270,7 +271,7 @@ func WaitForNodesWithLabel(ctx context.Context, t *testing.T, c klient.Client, n
270271
271272 t .Logf ("Nodes with label %s=%s: %d/%d" , labelKey , expectedValue , actualCount , targetCount )
272273 return actualCount == targetCount
273- }, WaitTimeout , WaitInterval , "all nodes should have label %s=%s" , labelKey , expectedValue )
274+ }, EventuallyWaitTimeout , WaitInterval , "all nodes should have label %s=%s" , labelKey , expectedValue )
274275}
275276
276277func WaitForNodeEvent (ctx context.Context , t * testing.T , c klient.Client , nodeName string , expectedEvent v1.Event ) {
@@ -290,7 +291,7 @@ func WaitForNodeEvent(ctx context.Context, t *testing.T, c klient.Client, nodeNa
290291 }
291292 t .Logf ("Did not find any events for node %s matching event %v" , nodeName , expectedEvent )
292293 return false
293- }, WaitTimeout , WaitInterval , "node %s should have event %v" , nodeName , expectedEvent )
294+ }, EventuallyWaitTimeout , WaitInterval , "node %s should have event %v" , nodeName , expectedEvent )
294295}
295296
296297// SelectTestNodeFromUnusedPool selects an available test node from the cluster.
@@ -421,7 +422,7 @@ func WaitForRebootNodeCR(ctx context.Context, t *testing.T, c klient.Client, nod
421422 }
422423 t .Logf ("No RebootNode CR found for node %s" , nodeName )
423424 return false
424- }, WaitTimeout , WaitInterval , "RebootNode CR should complete for node %s" , nodeName )
425+ }, EventuallyWaitTimeout , WaitInterval , "RebootNode CR should complete for node %s" , nodeName )
425426
426427 t .Logf ("RebootNode CR created for node %s" , nodeName )
427428 return resultCR
@@ -591,7 +592,7 @@ func waitForPodRunning(ctx context.Context, t *testing.T, c klient.Client, podNa
591592 return false
592593 }
593594 return isRunning
594- }, WaitTimeout , WaitInterval , "pod %s should be running" , podName )
595+ }, EventuallyWaitTimeout , WaitInterval , "pod %s should be running" , podName )
595596
596597}
597598
@@ -846,7 +847,7 @@ func WaitForDeploymentRollout(ctx context.Context, t *testing.T, c klient.Client
846847
847848 t .Logf ("Rollout complete: all %d replicas are updated, ready, and available" , expectedReplicas )
848849 return true
849- }, WaitTimeout , WaitInterval , "deployment %s/%s rollout should complete" , namespace , name )
850+ }, EventuallyWaitTimeout , WaitInterval , "deployment %s/%s rollout should complete" , namespace , name )
850851
851852 t .Logf ("Deployment %s/%s rollout completed successfully" , namespace , name )
852853}
@@ -1080,7 +1081,7 @@ func WaitForNodeLabel(ctx context.Context, t *testing.T, client klient.Client, n
10801081 return false
10811082 }
10821083 return value == expectedValue
1083- }, WaitTimeout , WaitInterval )
1084+ }, EventuallyWaitTimeout , WaitInterval )
10841085 t .Logf ("Node %s has label %s=%s" , nodeName , labelKey , expectedValue )
10851086}
10861087
@@ -1098,7 +1099,7 @@ func AssertPodsNeverDeleted(ctx context.Context, t *testing.T, client klient.Cli
10981099 }
10991100 }
11001101 return false
1101- }, 15 * time . Second , 5 * time . Second , "pods should not be deleted" )
1102+ }, NeverWaitTimeout , WaitInterval , "pods should not be deleted" )
11021103 t .Logf ("All %d pods remain running in namespace %s" , len (podNames ), namespace )
11031104}
11041105
@@ -1116,7 +1117,7 @@ func WaitForPodsDeleted(ctx context.Context, t *testing.T, client klient.Client,
11161117 }
11171118 }
11181119 return true
1119- }, WaitTimeout , WaitInterval )
1120+ }, EventuallyWaitTimeout , WaitInterval )
11201121 t .Logf ("All pods deleted from namespace %s" , namespace )
11211122}
11221123
@@ -1132,7 +1133,7 @@ func WaitForPodsRunning(ctx context.Context, t *testing.T, client klient.Client,
11321133 return false
11331134 }
11341135 return pod .Status .Phase == v1 .PodRunning
1135- }, WaitTimeout , WaitInterval )
1136+ }, EventuallyWaitTimeout , WaitInterval )
11361137 }
11371138 t .Logf ("All %d pods running" , len (podNames ))
11381139}
0 commit comments