TestComposeCmd tests execution of docker-compose commands.
(t *testing.T)
| 85 | |
| 86 | // TestComposeCmd tests execution of docker-compose commands. |
| 87 | func 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 |
| 122 | func TestComposeWithStreams(t *testing.T) { |
nothing calls this directly
no test coverage detected