Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 98a781f

Browse files
authored
Merge pull request #1827 from ndeloof/ipam
2 parents 8d2019e + 2fdc2e1 commit 98a781f

File tree

26 files changed

+123
-48
lines changed

26 files changed

+123
-48
lines changed

aci/e2e/e2e-aci_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ func TestUpSecretsResources(t *testing.T) {
553553
secret2Value = "another_password\n"
554554
)
555555

556-
composefilePath := filepath.Join("aci_secrets_resources", "compose.yml")
556+
composefilePath := filepath.Join("aci_secrets_resources", "compose.yaml")
557557

558558
c := NewParallelE2eCLI(t, binDir)
559559
_, _, _ = setupTestResourceGroup(t, c)

local/e2e/compose/cancel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestComposeCancel(t *testing.T) {
5656
s.ResetUsage()
5757

5858
c.RunDockerCmd("compose", "ls")
59-
buildProjectPath := "../compose/fixtures/build-infinite/docker-compose.yml"
59+
buildProjectPath := "../compose/fixtures/build-infinite/compose.yaml"
6060

6161
// require a separate groupID from the process running tests, in order to simulate ctrl+C from a terminal.
6262
// sending kill signal

local/e2e/compose/compose_build_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestLocalComposeBuildStaticDockerfilePath(t *testing.T) {
118118
assert.NilError(t, err)
119119
defer os.RemoveAll(dir) //nolint:errcheck
120120

121-
assert.NilError(t, ioutil.WriteFile(filepath.Join(dir, "docker-compose.yml"), []byte(`services:
121+
assert.NilError(t, ioutil.WriteFile(filepath.Join(dir, "compose.yaml"), []byte(`services:
122122
service1:
123123
build:
124124
context: `+dir+`/service1
@@ -139,11 +139,11 @@ func TestLocalComposeBuildStaticDockerfilePath(t *testing.T) {
139139
RUN echo "world"
140140
`), 0644))
141141

142-
res := c.RunDockerCmd("compose", "-f", filepath.Join(dir, "docker-compose.yml"), "build")
142+
res := c.RunDockerCmd("compose", "-f", filepath.Join(dir, "compose.yaml"), "build")
143143

144144
res.Assert(t, icmd.Expected{Out: `RUN echo "hello"`})
145145
res.Assert(t, icmd.Expected{Out: `RUN echo "world"`})
146146

147-
c.RunDockerCmd("compose", "-f", filepath.Join(dir, "docker-compose.yml"), "down", "--rmi", "all")
147+
c.RunDockerCmd("compose", "-f", filepath.Join(dir, "compose.yaml"), "down", "--rmi", "all")
148148
})
149149
}

local/e2e/compose/compose_run_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ func TestLocalComposeRun(t *testing.T) {
3131
c := NewParallelE2eCLI(t, binDir)
3232

3333
t.Run("compose run", func(t *testing.T) {
34-
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back")
34+
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "back")
3535
lines := Lines(res.Stdout())
3636
assert.Equal(t, lines[len(lines)-1], "Hello there!!", res.Stdout())
3737
assert.Assert(t, !strings.Contains(res.Combined(), "orphan"))
38-
res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "back", "echo", "Hello one more time")
38+
res = c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "back", "echo", "Hello one more time")
3939
lines = Lines(res.Stdout())
4040
assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout())
4141
assert.Assert(t, !strings.Contains(res.Combined(), "orphan"))
@@ -70,7 +70,7 @@ func TestLocalComposeRun(t *testing.T) {
7070
})
7171

7272
t.Run("compose run --rm", func(t *testing.T) {
73-
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--rm", "back", "/bin/sh", "-c", "echo Hello again")
73+
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--rm", "back", "/bin/sh", "-c", "echo Hello again")
7474
lines := Lines(res.Stdout())
7575
assert.Equal(t, lines[len(lines)-1], "Hello again", res.Stdout())
7676

@@ -79,29 +79,29 @@ func TestLocalComposeRun(t *testing.T) {
7979
})
8080

8181
t.Run("down", func(t *testing.T) {
82-
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down")
82+
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "down")
8383
res := c.RunDockerCmd("ps", "--all")
8484
assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout())
8585
})
8686

8787
t.Run("compose run --volumes", func(t *testing.T) {
8888
wd, err := os.Getwd()
8989
assert.NilError(t, err)
90-
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--volumes", wd+":/foo", "back", "/bin/sh", "-c", "ls /foo")
90+
res := c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--volumes", wd+":/foo", "back", "/bin/sh", "-c", "ls /foo")
9191
res.Assert(t, icmd.Expected{Out: "compose_run_test.go"})
9292

9393
res = c.RunDockerCmd("ps", "--all")
9494
assert.Assert(t, strings.Contains(res.Stdout(), "run-test_back"), res.Stdout())
9595
})
9696

9797
t.Run("compose run --publish", func(t *testing.T) {
98-
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "run", "--publish", "8081:80", "-d", "back", "/bin/sh", "-c", "sleep 1")
98+
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "run", "--publish", "8081:80", "-d", "back", "/bin/sh", "-c", "sleep 1")
9999
res := c.RunDockerCmd("ps")
100100
assert.Assert(t, strings.Contains(res.Stdout(), "8081->80/tcp"), res.Stdout())
101101
})
102102

103103
t.Run("down", func(t *testing.T) {
104-
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yml", "down")
104+
c.RunDockerCmd("compose", "-f", "./fixtures/run-test/compose.yaml", "down")
105105
res := c.RunDockerCmd("ps", "--all")
106106
assert.Assert(t, !strings.Contains(res.Stdout(), "run-test"), res.Stdout())
107107
})

local/e2e/compose/cp_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ func TestCopy(t *testing.T) {
3333
const projectName = "copy_e2e"
3434

3535
t.Cleanup(func() {
36-
c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "--project-name", projectName, "down")
36+
c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "--project-name", projectName, "down")
3737

3838
os.Remove("./fixtures/cp-test/from-default.txt") //nolint:errcheck
3939
os.Remove("./fixtures/cp-test/from-indexed.txt") //nolint:errcheck
4040
os.RemoveAll("./fixtures/cp-test/cp-folder2") //nolint:errcheck
4141
})
4242

4343
t.Run("start service", func(t *testing.T) {
44-
c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "--project-name", projectName, "up", "--scale", "nginx=5", "-d")
44+
c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "--project-name", projectName, "up", "--scale", "nginx=5", "-d")
4545
})
4646

4747
t.Run("make sure service is running", func(t *testing.T) {
@@ -50,7 +50,7 @@ func TestCopy(t *testing.T) {
5050
})
5151

5252
t.Run("copy to container copies the file to the first container by default", func(t *testing.T) {
53-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/default.txt")
53+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/default.txt")
5454
res.Assert(t, icmd.Expected{ExitCode: 0})
5555

5656
output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/default.txt").Stdout()
@@ -61,7 +61,7 @@ func TestCopy(t *testing.T) {
6161
})
6262

6363
t.Run("copy to container with a given index copies the file to the given container", func(t *testing.T) {
64-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--index=3", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/indexed.txt")
64+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--index=3", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/indexed.txt")
6565
res.Assert(t, icmd.Expected{ExitCode: 0})
6666

6767
output := c.RunDockerCmd("exec", projectName+"_nginx_3", "cat", "/tmp/indexed.txt").Stdout()
@@ -72,7 +72,7 @@ func TestCopy(t *testing.T) {
7272
})
7373

7474
t.Run("copy to container with the all flag copies the file to all containers", func(t *testing.T) {
75-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--all", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/all.txt")
75+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--all", "./fixtures/cp-test/cp-me.txt", "nginx:/tmp/all.txt")
7676
res.Assert(t, icmd.Expected{ExitCode: 0})
7777

7878
output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/all.txt").Stdout()
@@ -86,7 +86,7 @@ func TestCopy(t *testing.T) {
8686
})
8787

8888
t.Run("copy from a container copies the file to the host from the first container by default", func(t *testing.T) {
89-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "nginx:/tmp/default.txt", "./fixtures/cp-test/from-default.txt")
89+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "nginx:/tmp/default.txt", "./fixtures/cp-test/from-default.txt")
9090
res.Assert(t, icmd.Expected{ExitCode: 0})
9191

9292
data, err := os.ReadFile("./fixtures/cp-test/from-default.txt")
@@ -95,7 +95,7 @@ func TestCopy(t *testing.T) {
9595
})
9696

9797
t.Run("copy from a container with a given index copies the file to host", func(t *testing.T) {
98-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "--index=3", "nginx:/tmp/indexed.txt", "./fixtures/cp-test/from-indexed.txt")
98+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "--index=3", "nginx:/tmp/indexed.txt", "./fixtures/cp-test/from-indexed.txt")
9999
res.Assert(t, icmd.Expected{ExitCode: 0})
100100

101101
data, err := os.ReadFile("./fixtures/cp-test/from-indexed.txt")
@@ -104,13 +104,13 @@ func TestCopy(t *testing.T) {
104104
})
105105

106106
t.Run("copy to and from a container also work with folder", func(t *testing.T) {
107-
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "./fixtures/cp-test/cp-folder", "nginx:/tmp")
107+
res := c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "./fixtures/cp-test/cp-folder", "nginx:/tmp")
108108
res.Assert(t, icmd.Expected{ExitCode: 0})
109109

110110
output := c.RunDockerCmd("exec", projectName+"_nginx_1", "cat", "/tmp/cp-folder/cp-me.txt").Stdout()
111111
assert.Assert(t, strings.Contains(output, `hello world from folder`), output)
112112

113-
res = c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/docker-compose.yml", "-p", projectName, "cp", "nginx:/tmp/cp-folder", "./fixtures/cp-test/cp-folder2")
113+
res = c.RunDockerCmd("compose", "-f", "./fixtures/cp-test/compose.yaml", "-p", projectName, "cp", "nginx:/tmp/cp-folder", "./fixtures/cp-test/cp-folder2")
114114
res.Assert(t, icmd.Expected{ExitCode: 0})
115115

116116
data, err := os.ReadFile("./fixtures/cp-test/cp-folder2/cp-me.txt")
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
foo:
3+
image: alpine
4+
entrypoint: ["sleep", "600"]
5+
networks:
6+
default:
7+
ipv4_address: 10.1.0.100 # <-- Fixed IP address
8+
networks:
9+
default:
10+
ipam:
11+
config:
12+
- subnet: 10.1.0.0/16

0 commit comments

Comments
 (0)