Skip to content

Commit

Permalink
Add e2e test for stack deploy
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
  • Loading branch information
dnephin committed Mar 12, 2018
1 parent b4c108a commit 480d86e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
20 changes: 20 additions & 0 deletions e2e/stack/deploy_test.go
Original file line number Diff line number Diff line change
@@ -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"))
}
1 change: 1 addition & 0 deletions e2e/stack/testdata/data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A file with some text
7 changes: 7 additions & 0 deletions e2e/stack/testdata/stack-deploy-with-nanes.golden
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions e2e/stack/testdata/stack-with-named-resources.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 480d86e

Please sign in to comment.