Skip to content

Commit

Permalink
wait in second test
Browse files Browse the repository at this point in the history
  • Loading branch information
lantoli committed Oct 17, 2024
1 parent d99949e commit b314d26
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions internal/testutil/acc/shared_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ func SerialSleep(tb testing.TB) {
sharedInfo.muSleep.Lock()
defer sharedInfo.muSleep.Unlock()

if sharedInfo.alreadySlept {
return
sharedInfo.testCount++
// SerialSleep is called in tests before they create the cluster, so wait in the second test after the first cluster is being created before creating the second cluster
if sharedInfo.testCount == 2 {
time.Sleep(5 * time.Second)
}
time.Sleep(5 * time.Second)
sharedInfo.alreadySlept = true
}

var sharedInfo = struct {
projectID string
projectName string
clusterName string
mu sync.Mutex
muSleep sync.Mutex
alreadySlept bool
init bool
projectID string
projectName string
clusterName string
mu sync.Mutex
muSleep sync.Mutex
testCount int
init bool
}{}

0 comments on commit b314d26

Please sign in to comment.