MCPcopy
hub / github.com/docker/compose / TestUpSwitchVolumes

Function TestUpSwitchVolumes

pkg/e2e/volumes_test.go:123–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestUpSwitchVolumes(t *testing.T) {
124 c := NewCLI(t)
125 const projectName = "compose-e2e-switch-volumes"
126 t.Cleanup(func() {
127 c.cleanupWithDown(t, projectName)
128 c.RunDockerCmd(t, "volume", "rm", "-f", "test_external_volume")
129 c.RunDockerCmd(t, "volume", "rm", "-f", "test_external_volume_2")
130 })
131
132 c.RunDockerCmd(t, "volume", "create", "test_external_volume")
133 c.RunDockerCmd(t, "volume", "create", "test_external_volume_2")
134
135 c.RunDockerComposeCmd(t, "-f", "./fixtures/switch-volumes/compose.yaml", "--project-name", projectName, "up", "-d")
136
137 res := c.RunDockerCmd(t, "inspect", fmt.Sprintf("%s-app-1", projectName), "-f", "{{ (index .Mounts 0).Name }}")
138 res.Assert(t, icmd.Expected{Out: "test_external_volume"})
139
140 c.RunDockerComposeCmd(t, "-f", "./fixtures/switch-volumes/compose2.yaml", "--project-name", projectName, "up", "-d")
141 res = c.RunDockerCmd(t, "inspect", fmt.Sprintf("%s-app-1", projectName), "-f", "{{ (index .Mounts 0).Name }}")
142 res.Assert(t, icmd.Expected{Out: "test_external_volume_2"})
143}
144
145func TestUpRecreateVolumes(t *testing.T) {
146 c := NewCLI(t)

Callers

nothing calls this directly

Calls 4

cleanupWithDownMethod · 0.95
RunDockerCmdMethod · 0.95
RunDockerComposeCmdMethod · 0.95
NewCLIFunction · 0.85

Tested by

no test coverage detected