2018-03-12 15:02:18 -04:00
|
|
|
package stack
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sort"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2020-02-22 12:12:14 -05:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
"gotest.tools/v3/golden"
|
|
|
|
"gotest.tools/v3/icmd"
|
2018-03-12 15:02:18 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDeployWithNamedResources(t *testing.T) {
|
2022-02-22 07:46:35 -05:00
|
|
|
stackname := "test-stack-deploy-with-names"
|
2018-03-12 15:02:18 -04:00
|
|
|
composefile := golden.Path("stack-with-named-resources.yml")
|
|
|
|
|
2018-06-20 08:48:50 -04:00
|
|
|
result := icmd.RunCommand("docker", "stack", "deploy",
|
2022-02-22 07:46:35 -05:00
|
|
|
"-c", composefile, stackname)
|
|
|
|
defer icmd.RunCommand("docker", "stack", "rm", stackname)
|
2018-03-12 15:02:18 -04:00
|
|
|
|
|
|
|
result.Assert(t, icmd.Success)
|
|
|
|
stdout := strings.Split(result.Stdout(), "\n")
|
2022-02-22 07:46:35 -05:00
|
|
|
expected := strings.Split(string(golden.Get(t, "stack-deploy-with-names.golden")), "\n")
|
2018-03-12 15:02:18 -04:00
|
|
|
sort.Strings(stdout)
|
|
|
|
sort.Strings(expected)
|
|
|
|
assert.DeepEqual(t, stdout, expected)
|
|
|
|
}
|