Skip to content

Commit

Permalink
OSSM-2109 Fix flaky IOR unit test (#648)
Browse files Browse the repository at this point in the history
The sleep in ensureNamespaceExists was hardcoded to 100ms, regardless of r.handleEventTimeout. This timeout during unit tests is only 1ms, so the 100ms sleep caused the for loop to only run once.

Here we change the duration of the sleep to be 1/100 of r.handleEventTimeout. This change preserves the production sleep time of 100ms, but reduces the sleep time in unit tests to 10μs. This makes ensureNamespaceExists() run the for loop multiple times before giving up, fixing the test's flakiness.

Co-authored-by: Marko Lukša <[email protected]>
  • Loading branch information
maistra-bot and luksa authored Oct 11, 2022
1 parent f270336 commit 50f5bec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pilot/pkg/config/kube/ior/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (r *route) ensureNamespaceExists(cfg config.Config) error {
default:
IORLog.Debugf("Namespace %s not found in SMMR, trying again", cfg.Namespace)
}
time.Sleep(100 * time.Millisecond)
time.Sleep(r.handleEventTimeout / 100)
}
}

Expand Down

0 comments on commit 50f5bec

Please sign in to comment.