Skip to content

Commit dde7eea

Browse files
committed
Update expected Cucumber compose ps output to match changes
Signed-off-by: Laura Brehm <[email protected]>
1 parent fd353ff commit dde7eea

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

e2e/cucumber-features/simple.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Background:
1212
Scenario: compose up
1313
When I run "compose up -d"
1414
Then the output contains "simple-1 Started"
15-
And service "simple" is "running"
15+
And service "simple" is "Up"

e2e/cucumber-features/start.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Scenario: Start single service
1717
Then the output contains "simple-1 Created"
1818
And the output contains "another-1 Created"
1919
Then I run "compose start another"
20-
And service "another" is "running"
21-
And service "simple" is "created"
20+
And service "another" is "Up"
21+
And service "simple" is "Created"

e2e/cucumber_test.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ func TestCucumber(t *testing.T) {
5757

5858
func setup(s *godog.ScenarioContext) {
5959
t := s.TestingT()
60+
projectName := strings.Split(t.Name(), "/")[1]
6061
cli := e2e.NewCLI(t, e2e.WithEnv(
61-
fmt.Sprintf("COMPOSE_PROJECT_NAME=%s", strings.Split(t.Name(), "/")[1]),
62+
fmt.Sprintf("COMPOSE_PROJECT_NAME=%s", projectName),
6263
))
6364
th := testHelper{
64-
T: t,
65-
CLI: cli,
65+
T: t,
66+
CLI: cli,
67+
ProjectName: projectName,
6668
}
6769

6870
s.Before(func(ctx context.Context, sc *godog.Scenario) (context.Context, error) {
@@ -84,18 +86,20 @@ func setup(s *godog.ScenarioContext) {
8486

8587
type testHelper struct {
8688
T *testing.T
89+
ProjectName string
8790
ComposeFile string
8891
CommandOutput string
8992
CommandExitCode int
9093
CLI *e2e.CLI
9194
}
9295

9396
func (th *testHelper) serviceIsStatus(service, status string) error {
97+
serviceContainerName := fmt.Sprintf("%s-%s-1", strings.ToLower(th.ProjectName), service)
98+
statusRegex := fmt.Sprintf("%s.*%s", serviceContainerName, status)
9499
res := th.CLI.RunDockerComposeCmd(th.T, "ps", "-a")
95-
statusRegex := fmt.Sprintf("%s\\s+%s", service, status)
96100
r, _ := regexp.Compile(statusRegex)
97101
if !r.MatchString(res.Combined()) {
98-
return fmt.Errorf("Missing/incorrect ps output:\n%s", res.Combined())
102+
return fmt.Errorf("Missing/incorrect ps output:\n%s\nregex:\n%s", res.Combined(), statusRegex)
99103
}
100104
return nil
101105
}

0 commit comments

Comments
 (0)