Skip to content

Commit 92be1e7

Browse files
authored
Merge pull request docker#9252 from glours/test-run-with-dependencies
add run with dependencies e2e test
2 parents 158b5ff + a97576e commit 92be1e7

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

pkg/e2e/start_stop_test.go

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,42 @@ func TestStartStop(t *testing.T) {
9696
})
9797
}
9898

99-
func TestStopWithDependencies(t *testing.T) {
99+
func TestStartStopWithDependencies(t *testing.T) {
100100
c := NewParallelE2eCLI(t, binDir)
101-
const projectName = "e2e-stop-with-dependencies"
101+
const projectName = "e2e-start-stop-with-dependencies"
102102

103103
defer c.RunDockerComposeCmd("--project-name", projectName, "rm", "-fsv")
104104

105105
t.Run("Up", func(t *testing.T) {
106106
res := c.RunDockerComposeCmd("-f", "./fixtures/dependencies/compose.yaml", "--project-name", projectName, "up", "-d")
107-
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-stop-with-dependencies-foo-1 Started"), res.Combined())
108-
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-stop-with-dependencies-bar-1 Started"), res.Combined())
107+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-foo-1 Started"), res.Combined())
108+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-bar-1 Started"), res.Combined())
109109
})
110110

111111
t.Run("stop foo", func(t *testing.T) {
112112
res := c.RunDockerComposeCmd("--project-name", projectName, "stop", "foo")
113113

114-
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-stop-with-dependencies-foo-1 Stopped"), res.Combined())
114+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-foo-1 Stopped"), res.Combined())
115115

116116
res = c.RunDockerComposeCmd("--project-name", projectName, "ps", "--status", "running")
117-
assert.Assert(t, strings.Contains(res.Combined(), "e2e-stop-with-dependencies-bar-1"), res.Combined())
118-
assert.Assert(t, !strings.Contains(res.Combined(), "e2e-stop-with-dependencies-foo-1"), res.Combined())
117+
assert.Assert(t, strings.Contains(res.Combined(), "e2e-start-stop-with-dependencies-bar-1"), res.Combined())
118+
assert.Assert(t, !strings.Contains(res.Combined(), "e2e-start-stop-with-dependencies-foo-1"), res.Combined())
119119
})
120120

121+
t.Run("start foo", func(t *testing.T) {
122+
res := c.RunDockerComposeCmd("--project-name", projectName, "stop")
123+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-bar-1 Stopped"), res.Combined())
124+
125+
res = c.RunDockerComposeCmd("--project-name", projectName, "start", "foo")
126+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-bar-1 Started"), res.Combined())
127+
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-foo-1 Started"), res.Combined())
128+
129+
res = c.RunDockerComposeCmd("--project-name", projectName, "ps", "--status", "running")
130+
assert.Assert(t, strings.Contains(res.Combined(), "e2e-start-stop-with-dependencies-bar-1"), res.Combined())
131+
assert.Assert(t, strings.Contains(res.Combined(), "e2e-start-stop-with-dependencies-foo-1"), res.Combined())
132+
})
133+
134+
t.Run("down", func(t *testing.T) {
135+
_ = c.RunDockerComposeCmd("--project-name", projectName, "down")
136+
})
121137
}

0 commit comments

Comments
 (0)