diff --git a/e2e/stack/deploy_test.go b/e2e/stack/deploy_test.go new file mode 100644 index 000000000000..303ba17d6df8 --- /dev/null +++ b/e2e/stack/deploy_test.go @@ -0,0 +1,20 @@ +package stack + +import ( + "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) + assert.Assert(t, golden.String(result.Stdout(), "stack-deploy-with-nanes.golden")) +} diff --git a/e2e/stack/testdata/data b/e2e/stack/testdata/data new file mode 100644 index 000000000000..8a56f6d8bcbb --- /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 000000000000..f97dd682cf66 --- /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 000000000000..f7a04b21b7bf --- /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