mirror of https://github.com/docker/compose.git
Merge pull request #9504 from docker/nicksieger/9427
fix: bring up services with deps with --no-deps
This commit is contained in:
commit
335decceda
|
@ -183,7 +183,11 @@ func prepareServicesDependsOn(p *types.Project) error {
|
|||
if service.DependsOn == nil {
|
||||
service.DependsOn = make(types.DependsOnConfig)
|
||||
}
|
||||
deps, err := p.GetServices(dependencies...)
|
||||
|
||||
// Verify dependencies exist in the project, whether disabled or not
|
||||
projAllServices := types.Project{}
|
||||
projAllServices.Services = p.AllServices()
|
||||
deps, err := projAllServices.GetServices(dependencies...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
services:
|
||||
foo:
|
||||
image: nginx:alpine
|
||||
links:
|
||||
- bar
|
||||
|
||||
bar:
|
||||
image: nginx:alpine
|
|
@ -131,6 +131,13 @@ func TestStartStopWithDependencies(t *testing.T) {
|
|||
assert.Assert(t, strings.Contains(res.Combined(), "e2e-start-stop-with-dependencies-foo-1"), res.Combined())
|
||||
})
|
||||
|
||||
t.Run("Up no-deps links", func(t *testing.T) {
|
||||
_ = c.RunDockerComposeCmd("--project-name", projectName, "down")
|
||||
res := c.RunDockerComposeCmd("-f", "./fixtures/links/compose.yaml", "--project-name", projectName, "up", "--no-deps", "-d", "foo")
|
||||
assert.Assert(t, strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-foo-1 Started"), res.Combined())
|
||||
assert.Assert(t, !strings.Contains(res.Combined(), "Container e2e-start-stop-with-dependencies-bar-1 Started"), res.Combined())
|
||||
})
|
||||
|
||||
t.Run("down", func(t *testing.T) {
|
||||
_ = c.RunDockerComposeCmd("--project-name", projectName, "down")
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue