Skip to content

Commit 90d2224

Browse files
authored
wait in second test (#2707)
1 parent d99949e commit 90d2224

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/testutil/acc/shared_resource.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ func SerialSleep(tb testing.TB) {
9595
sharedInfo.muSleep.Lock()
9696
defer sharedInfo.muSleep.Unlock()
9797

98-
if sharedInfo.alreadySlept {
99-
return
98+
sharedInfo.testCount++
99+
// 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
100+
if sharedInfo.testCount == 2 {
101+
time.Sleep(5 * time.Second)
100102
}
101-
time.Sleep(5 * time.Second)
102-
sharedInfo.alreadySlept = true
103103
}
104104

105105
var sharedInfo = struct {
106-
projectID string
107-
projectName string
108-
clusterName string
109-
mu sync.Mutex
110-
muSleep sync.Mutex
111-
alreadySlept bool
112-
init bool
106+
projectID string
107+
projectName string
108+
clusterName string
109+
mu sync.Mutex
110+
muSleep sync.Mutex
111+
testCount int
112+
init bool
113113
}{}

0 commit comments

Comments
 (0)