Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit c2195b5

Browse files
authored
Merge pull request #1429 from gtardif/fix_flaky_restart_test
Fix log expectation with random exec order
2 parents 30e2d1d + e2d92ec commit c2195b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

local/e2e/compose/compose_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"net/http"
2222
"os"
23+
"regexp"
2324
"strings"
2425
"testing"
2526
"time"
@@ -139,10 +140,9 @@ func TestAttachRestart(t *testing.T) {
139140
res := c.RunDockerOrExitError("compose", "--ansi=never", "--project-directory", "fixtures/attach-restart", "up")
140141
output := res.Stdout()
141142

142-
assert.Assert(t, strings.Contains(output, `another_1 | world
143-
attach-restart_another_1 exited with code 1
144-
another_1 | world
145-
attach-restart_another_1 exited with code 1
146-
another_1 | world
147-
attach-restart_another_1 exited with code 1`), res.Combined())
143+
exitRegex := regexp.MustCompile("attach-restart_another_1 exited with code 1")
144+
assert.Equal(t, len(exitRegex.FindAllStringIndex(output, -1)), 3, res.Combined())
145+
146+
execRegex := regexp.MustCompile(`another_1 \| world`)
147+
assert.Equal(t, len(execRegex.FindAllStringIndex(output, -1)), 3, res.Combined())
148148
}

0 commit comments

Comments
 (0)