Fix TestTerminationOrderingSidecarStopAfterMain flake under stress

This commit is contained in:
Karthik Bhat
2025-12-03 19:34:05 +05:30
parent 76b76c2d52
commit 116ada9a35

View File

@@ -55,9 +55,11 @@ func TestTerminationOrderingSidecarStopAfterMain(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
var sidecarWaitDelay int64
var mainWaitDelay int64
var sidecarWaitDelay, mainWaitDelay int64
syncChannel := make(chan struct{})
go func() {
close(syncChannel) // notifies other goroutine that this goroutine scheduled.
sidecarWaitDelay = int64(to.waitForTurn("init", 30))
to.containerTerminated("init")
wg.Done()
@@ -65,6 +67,7 @@ func TestTerminationOrderingSidecarStopAfterMain(t *testing.T) {
wg.Add(1)
go func() {
<-syncChannel // make sure the other goroutine is scheduled.
mainWaitDelay = int64(to.waitForTurn("main", 0))
time.Sleep(1 * time.Second)
to.containerTerminated("main")