MCPcopy Index your code
hub / github.com/ddev/ddev / TestComposeCmd

Function TestComposeCmd

pkg/dockerutil/docker_compose_test.go:87–119  ·  view source on GitHub ↗

TestComposeCmd tests execution of docker-compose commands.

(t *testing.T)

Source from the content-addressed store, hash-verified

85
86// TestComposeCmd tests execution of docker-compose commands.
87func TestComposeCmd(t *testing.T) {
88 assert := asrt.New(t)
89
90 composeFiles := []string{filepath.Join("testdata", "docker-compose.yml")}
91
92 stdout, stderr, err := dockerutil.ComposeCmd(&dockerutil.ComposeCmdOpts{
93 ComposeFiles: composeFiles,
94 Action: []string{"config", "--services"},
95 })
96 assert.NoError(err)
97 assert.Contains(stdout, "web")
98 assert.Contains(stdout, "db")
99 assert.Contains(stderr, "Defaulting to a blank string")
100
101 composeFiles = append(composeFiles, filepath.Join("testdata", "docker-compose.override.yml"))
102
103 stdout, stderr, err = dockerutil.ComposeCmd(&dockerutil.ComposeCmdOpts{
104 ComposeFiles: composeFiles,
105 Action: []string{"config", "--services"},
106 })
107 assert.NoError(err)
108 assert.Contains(stdout, "web")
109 assert.Contains(stdout, "db")
110 assert.Contains(stdout, "foo")
111 assert.Contains(stderr, "Defaulting to a blank string")
112
113 composeFiles = []string{"invalid.yml"}
114 _, _, err = dockerutil.ComposeCmd(&dockerutil.ComposeCmdOpts{
115 ComposeFiles: composeFiles,
116 Action: []string{"config", "--services"},
117 })
118 assert.Error(err)
119}
120
121// TestComposeWithStreams tests execution of docker-compose commands with streams
122func TestComposeWithStreams(t *testing.T) {

Callers

nothing calls this directly

Calls 2

ComposeCmdFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected