-
Notifications
You must be signed in to change notification settings - Fork 5.7k
restore setEnvWithDotEnv #11974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restore setEnvWithDotEnv #11974
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,7 @@ func TestLocalComposeRun(t *testing.T) { | |
| "Hello one more time") | ||
| lines = Lines(res.Stdout()) | ||
| assert.Equal(t, lines[len(lines)-1], "Hello one more time", res.Stdout()) | ||
| assert.Assert(t, !strings.Contains(res.Combined(), "orphan")) | ||
| assert.Assert(t, strings.Contains(res.Combined(), "orphan")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: was this a bug before your chnages? :o
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. more or less. We only considered "orphans" for service container not declared in current compose model. This PR also consider stopped |
||
| }) | ||
|
|
||
| t.Run("check run container exited", func(t *testing.T) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| COMPOSE_REMOVE_ORPHANS=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| services: | ||
| orphan: | ||
| profiles: [run] | ||
| image: alpine | ||
| command: echo hello | ||
| test: | ||
| image: nginx:alpine |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| Copyright 2020 Docker Compose CLI authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package e2e | ||
|
|
||
| import ( | ||
| "strings" | ||
| "testing" | ||
|
|
||
| "gotest.tools/v3/assert" | ||
| ) | ||
|
|
||
| func TestRemoveOrphans(t *testing.T) { | ||
| c := NewCLI(t) | ||
|
|
||
| const projectName = "compose-e2e-orphans" | ||
|
|
||
| c.RunDockerComposeCmd(t, "-f", "./fixtures/orphans/compose.yaml", "-p", projectName, "run", "orphan") | ||
| res := c.RunDockerComposeCmd(t, "-p", projectName, "ps", "--all") | ||
| assert.Check(t, strings.Contains(res.Combined(), "compose-e2e-orphans-orphan-run-")) | ||
|
|
||
| c.RunDockerComposeCmd(t, "-f", "./fixtures/orphans/compose.yaml", "-p", projectName, "up", "-d") | ||
|
|
||
| res = c.RunDockerComposeCmd(t, "-p", projectName, "ps", "--all") | ||
| assert.Check(t, !strings.Contains(res.Combined(), "compose-e2e-orphans-orphan-run-")) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: what is the oneOffLabel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used to distinguish containers created by
docker compose runvs actual services created byup