@@ -541,6 +541,22 @@ func testStop(t *testing.T, ksWorkflow, cells string) {
541
541
t .Run ("Stop" , func (t * testing.T ) {
542
542
// Create a new VDiff and immediately stop it.
543
543
uuid , _ := performVDiff2Action (t , ksWorkflow , cells , "create" , "" , false )
544
+
545
+ // Ensure the state to be either completed or started
546
+ isStartedOrCompleted := false
547
+ maxRetries := 5
548
+ for i := 1 ; i <= maxRetries ; i ++ {
549
+ _ , output := performVDiff2Action (t , ksWorkflow , cells , "show" , uuid , false )
550
+ jsonOutput := getVDiffInfo (output )
551
+ isStartedOrCompleted = jsonOutput .State == "started" || jsonOutput .State == "completed"
552
+ if isStartedOrCompleted || i == maxRetries {
553
+ break
554
+ }
555
+ t .Logf ("VDiff state expected to be started or completed, got: %s, retrying (attempt %d of %d)" , jsonOutput .State , i , maxRetries )
556
+ time .Sleep (vdiffRetryInterval )
557
+ }
558
+ require .True (t , isStartedOrCompleted , "VDiff state should either be started or completed" )
559
+
544
560
_ , _ = performVDiff2Action (t , ksWorkflow , cells , "stop" , uuid , false )
545
561
// Confirm the VDiff is in the expected state.
546
562
_ , output := performVDiff2Action (t , ksWorkflow , cells , "show" , uuid , false )
0 commit comments