diff --git a/e2e/stack/deploy_test.go b/e2e/stack/deploy_test.go new file mode 100644 index 0000000000..086af3ea16 --- /dev/null +++ b/e2e/stack/deploy_test.go @@ -0,0 +1,26 @@ +package stack + +import ( + "sort" + "strings" + "testing" + + "github.com/gotestyourself/gotestyourself/assert" + "github.com/gotestyourself/gotestyourself/golden" + "github.com/gotestyourself/gotestyourself/icmd" +) + +func TestDeployWithNamedResources(t *testing.T) { + stackname := "test-stack-deploy-with-names" + composefile := golden.Path("stack-with-named-resources.yml") + + result := icmd.RunCommand( + "docker", "stack", "deploy", "-c", composefile, stackname) + + result.Assert(t, icmd.Success) + stdout := strings.Split(result.Stdout(), "\n") + expected := strings.Split(string(golden.Get(t, "stack-deploy-with-nanes.golden")), "\n") + sort.Strings(stdout) + sort.Strings(expected) + assert.DeepEqual(t, stdout, expected) +} diff --git a/e2e/stack/testdata/data b/e2e/stack/testdata/data new file mode 100644 index 0000000000..8a56f6d8bc --- /dev/null +++ b/e2e/stack/testdata/data @@ -0,0 +1 @@ +A file with some text diff --git a/e2e/stack/testdata/stack-deploy-with-nanes.golden b/e2e/stack/testdata/stack-deploy-with-nanes.golden new file mode 100644 index 0000000000..f97dd682cf --- /dev/null +++ b/e2e/stack/testdata/stack-deploy-with-nanes.golden @@ -0,0 +1,7 @@ +Creating network test-stack-deploy-with-names_network2 +Creating network named-network +Creating secret named-secret +Creating secret test-stack-deploy-with-names_secret2 +Creating config test-stack-deploy-with-names_config2 +Creating config named-config +Creating service test-stack-deploy-with-names_web diff --git a/e2e/stack/testdata/stack-with-named-resources.yml b/e2e/stack/testdata/stack-with-named-resources.yml new file mode 100644 index 0000000000..f7a04b21b7 --- /dev/null +++ b/e2e/stack/testdata/stack-with-named-resources.yml @@ -0,0 +1,30 @@ +version: '3.5' +services: + web: + image: registry:5000/alpine:3.6 + command: top + networks: [network1, network2] + volumes: [volume1, volume2] + secrets: [secret1, secret2] + configs: [config1, config2] + +networks: + network1: + name: named-network + network2: +volumes: + volume1: + name: named-volume + volume2: +secrets: + secret1: + name: named-secret + file: ./data + secret2: + file: ./data +configs: + config1: + name: named-config + file: ./data + config2: + file: ./data