mirror of https://github.com/docker/compose.git
do not stop the dependencies wait process when reaching a dependency with service_started condition
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
This commit is contained in:
parent
09e0fa94b8
commit
4be38f84df
|
@ -278,7 +278,7 @@ func (s *composeService) waitDependencies(ctx context.Context, project *types.Pr
|
|||
for dep, config := range dependencies {
|
||||
if config.Condition == types.ServiceConditionStarted {
|
||||
// already managed by InDependencyOrder
|
||||
return nil
|
||||
continue
|
||||
}
|
||||
if service, err := project.GetService(dep); err != nil {
|
||||
return err
|
||||
|
|
|
@ -202,4 +202,14 @@ func TestWaitDependencies(t *testing.T) {
|
|||
}
|
||||
assert.NilError(t, tested.waitDependencies(context.Background(), &project, dependencies))
|
||||
})
|
||||
t.Run("should skip dependencies with condition service_started", func(t *testing.T) {
|
||||
dbService := types.ServiceConfig{Name: "db", Scale: 1}
|
||||
redisService := types.ServiceConfig{Name: "redis", Scale: 1}
|
||||
project := types.Project{Name: strings.ToLower(testProject), Services: []types.ServiceConfig{dbService, redisService}}
|
||||
dependencies := types.DependsOnConfig{
|
||||
"db": {Condition: types.ServiceConditionStarted},
|
||||
"redis": {Condition: types.ServiceConditionStarted},
|
||||
}
|
||||
assert.NilError(t, tested.waitDependencies(context.Background(), &project, dependencies))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue