diff --git a/generic_test.go b/generic_test.go index 63b4100455..0f7a80d7a6 100644 --- a/generic_test.go +++ b/generic_test.go @@ -3,12 +3,11 @@ package testcontainers import ( "context" "errors" - "fmt" "io" "net/http" "os" stdexec "os/exec" - "regexp" + "strings" "sync" "testing" @@ -145,9 +144,6 @@ func TestWithStartupCommand(t *testing.T) { } func TestGenericReusableContainerInSubprocess(t *testing.T) { - containerIDOnce := sync.Once{} - containerID := "" - wg := sync.WaitGroup{} wg.Add(10) for i := 0; i < 10; i++ { @@ -157,17 +153,9 @@ func TestGenericReusableContainerInSubprocess(t *testing.T) { // create containers in subprocesses, as "go test ./..." does. output := createReuseContainerInSubprocess(t) - // check is container reused. - re := regexp.MustCompile(fmt.Sprintf("%s(.*)%s", - "🚧 Waiting for container id ", - regexp.QuoteMeta(fmt.Sprintf(" image: %s", nginxDelayedImage)), - )) - match := re.FindStringSubmatch(output) - - containerIDOnce.Do(func() { - containerID = match[1] - }) - require.Equal(t, containerID, match[1]) + // check is reuse container with WaitingFor work correctly. + contains := strings.Contains(output, "🚧 Waiting for container id") + require.True(t, contains) }() }