mirror of https://github.com/docker/cli.git
Add e2e test for stack deploy
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
b4c108a385
commit
fcffd67028
|
@ -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)
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
A file with some text
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue