@@ -33,15 +33,15 @@ func TestCopy(t *testing.T) {
33
33
const projectName = "copy_e2e"
34
34
35
35
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" )
37
37
38
38
os .Remove ("./fixtures/cp-test/from-default.txt" ) //nolint:errcheck
39
39
os .Remove ("./fixtures/cp-test/from-indexed.txt" ) //nolint:errcheck
40
40
os .RemoveAll ("./fixtures/cp-test/cp-folder2" ) //nolint:errcheck
41
41
})
42
42
43
43
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" )
45
45
})
46
46
47
47
t .Run ("make sure service is running" , func (t * testing.T ) {
@@ -50,7 +50,7 @@ func TestCopy(t *testing.T) {
50
50
})
51
51
52
52
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" )
54
54
res .Assert (t , icmd.Expected {ExitCode : 0 })
55
55
56
56
output := c .RunDockerCmd ("exec" , projectName + "_nginx_1" , "cat" , "/tmp/default.txt" ).Stdout ()
@@ -61,7 +61,7 @@ func TestCopy(t *testing.T) {
61
61
})
62
62
63
63
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" )
65
65
res .Assert (t , icmd.Expected {ExitCode : 0 })
66
66
67
67
output := c .RunDockerCmd ("exec" , projectName + "_nginx_3" , "cat" , "/tmp/indexed.txt" ).Stdout ()
@@ -72,7 +72,7 @@ func TestCopy(t *testing.T) {
72
72
})
73
73
74
74
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" )
76
76
res .Assert (t , icmd.Expected {ExitCode : 0 })
77
77
78
78
output := c .RunDockerCmd ("exec" , projectName + "_nginx_1" , "cat" , "/tmp/all.txt" ).Stdout ()
@@ -86,7 +86,7 @@ func TestCopy(t *testing.T) {
86
86
})
87
87
88
88
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" )
90
90
res .Assert (t , icmd.Expected {ExitCode : 0 })
91
91
92
92
data , err := os .ReadFile ("./fixtures/cp-test/from-default.txt" )
@@ -95,7 +95,7 @@ func TestCopy(t *testing.T) {
95
95
})
96
96
97
97
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" )
99
99
res .Assert (t , icmd.Expected {ExitCode : 0 })
100
100
101
101
data , err := os .ReadFile ("./fixtures/cp-test/from-indexed.txt" )
@@ -104,13 +104,13 @@ func TestCopy(t *testing.T) {
104
104
})
105
105
106
106
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" )
108
108
res .Assert (t , icmd.Expected {ExitCode : 0 })
109
109
110
110
output := c .RunDockerCmd ("exec" , projectName + "_nginx_1" , "cat" , "/tmp/cp-folder/cp-me.txt" ).Stdout ()
111
111
assert .Assert (t , strings .Contains (output , `hello world from folder` ), output )
112
112
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" )
114
114
res .Assert (t , icmd.Expected {ExitCode : 0 })
115
115
116
116
data , err := os .ReadFile ("./fixtures/cp-test/cp-folder2/cp-me.txt" )
0 commit comments