@@ -123,9 +123,9 @@ func TestProjectVolumeBind(t *testing.T) {
123123 })
124124}
125125
126- func TestUpRecreateVolumes (t * testing.T ) {
126+ func TestUpSwitchVolumes (t * testing.T ) {
127127 c := NewCLI (t )
128- const projectName = "compose-e2e-recreate -volumes"
128+ const projectName = "compose-e2e-switch -volumes"
129129 t .Cleanup (func () {
130130 c .cleanupWithDown (t , projectName )
131131 c .RunDockerCmd (t , "volume" , "rm" , "-f" , "test_external_volume" )
@@ -135,12 +135,29 @@ func TestUpRecreateVolumes(t *testing.T) {
135135 c .RunDockerCmd (t , "volume" , "create" , "test_external_volume" )
136136 c .RunDockerCmd (t , "volume" , "create" , "test_external_volume_2" )
137137
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" )
139139
140140 res := c .RunDockerCmd (t , "inspect" , fmt .Sprintf ("%s-app-1" , projectName ), "-f" , "{{ (index .Mounts 0).Name }}" )
141141 res .Assert (t , icmd.Expected {Out : "test_external_volume" })
142142
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" )
144144 res = c .RunDockerCmd (t , "inspect" , fmt .Sprintf ("%s-app-1" , projectName ), "-f" , "{{ (index .Mounts 0).Name }}" )
145145 res .Assert (t , icmd.Expected {Out : "test_external_volume_2" })
146146}
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