@@ -123,9 +123,9 @@ func TestProjectVolumeBind(t *testing.T) {
123
123
})
124
124
}
125
125
126
- func TestUpRecreateVolumes (t * testing.T ) {
126
+ func TestUpSwitchVolumes (t * testing.T ) {
127
127
c := NewCLI (t )
128
- const projectName = "compose-e2e-recreate -volumes"
128
+ const projectName = "compose-e2e-switch -volumes"
129
129
t .Cleanup (func () {
130
130
c .cleanupWithDown (t , projectName )
131
131
c .RunDockerCmd (t , "volume" , "rm" , "-f" , "test_external_volume" )
@@ -135,12 +135,29 @@ func TestUpRecreateVolumes(t *testing.T) {
135
135
c .RunDockerCmd (t , "volume" , "create" , "test_external_volume" )
136
136
c .RunDockerCmd (t , "volume" , "create" , "test_external_volume_2" )
137
137
138
- c .RunDockerComposeCmd (t , "-f" , "./fixtures/recreate -volumes/compose.yaml" , "--project-name" , projectName , "up" , "-d" )
138
+ c .RunDockerComposeCmd (t , "-f" , "./fixtures/switch -volumes/compose.yaml" , "--project-name" , projectName , "up" , "-d" )
139
139
140
140
res := c .RunDockerCmd (t , "inspect" , fmt .Sprintf ("%s-app-1" , projectName ), "-f" , "{{ (index .Mounts 0).Name }}" )
141
141
res .Assert (t , icmd.Expected {Out : "test_external_volume" })
142
142
143
- c .RunDockerComposeCmd (t , "-f" , "./fixtures/recreate -volumes/compose2.yaml" , "--project-name" , projectName , "up" , "-d" )
143
+ c .RunDockerComposeCmd (t , "-f" , "./fixtures/switch -volumes/compose2.yaml" , "--project-name" , projectName , "up" , "-d" )
144
144
res = c .RunDockerCmd (t , "inspect" , fmt .Sprintf ("%s-app-1" , projectName ), "-f" , "{{ (index .Mounts 0).Name }}" )
145
145
res .Assert (t , icmd.Expected {Out : "test_external_volume_2" })
146
146
}
147
+
148
+ func TestUpRecreateVolumes (t * testing.T ) {
149
+ c := NewCLI (t )
150
+ const projectName = "compose-e2e-recreate-volumes"
151
+ t .Cleanup (func () {
152
+ c .cleanupWithDown (t , projectName )
153
+ })
154
+
155
+ c .RunDockerComposeCmd (t , "-f" , "./fixtures/recreate-volumes/compose.yaml" , "--project-name" , projectName , "up" , "-d" )
156
+
157
+ res := c .RunDockerCmd (t , "volume" , "inspect" , fmt .Sprintf ("%s_my_vol" , projectName ), "-f" , "{{ index .Labels \" foo\" }}" )
158
+ res .Assert (t , icmd.Expected {Out : "bar" })
159
+
160
+ c .RunDockerComposeCmd (t , "-f" , "./fixtures/recreate-volumes/compose2.yaml" , "--project-name" , projectName , "up" , "-d" , "-y" )
161
+ res = c .RunDockerCmd (t , "volume" , "inspect" , fmt .Sprintf ("%s_my_vol" , projectName ), "-f" , "{{ index .Labels \" foo\" }}" )
162
+ res .Assert (t , icmd.Expected {Out : "zot" })
163
+ }
0 commit comments