Fix compose volume creation and check this in volume e2e test

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2020-12-07 16:41:54 +01:00
parent 6aec88e74c
commit fe363fd146
2 changed files with 27 additions and 17 deletions

View File

@ -1086,7 +1086,9 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo
// TODO could identify volume by label vs name
_, err := s.apiClient.VolumeInspect(ctx, volume.Name)
if err != nil {
if errdefs.IsNotFound(err) {
if !errdefs.IsNotFound(err) {
return err
}
eventName := fmt.Sprintf("Volume %q", volume.Name)
w := progress.ContextWriter(ctx)
w.Event(progress.CreatingEvent(eventName))
@ -1103,7 +1105,5 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo
}
w.Event(progress.CreatedEvent(eventName))
}
return err
}
return nil
}

View File

@ -5,3 +5,13 @@ services:
- ./static:/usr/share/nginx/html
ports:
- 8090:80
nginx2:
build: nginx-build
volumes:
- staticVol:/usr/share/nginx/html
ports:
- 9090:80
volumes:
staticVol: