Add e2e test for stack deploy

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2018-03-12 15:02:18 -04:00
parent b4c108a385
commit fcffd67028
4 changed files with 64 additions and 0 deletions

26
e2e/stack/deploy_test.go Normal file
View File

@ -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)
}

1
e2e/stack/testdata/data vendored Normal file
View File

@ -0,0 +1 @@
A file with some text

View File

@ -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

View File

@ -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