fix: use new healthcheck config if not overridden (#1801)

This commit is contained in:
nils måsén 2023-10-21 20:57:33 +02:00 committed by GitHub
parent 72e437f173
commit 40b8c77100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 93 additions and 1 deletions

View file

@ -21,7 +21,8 @@ func MockContainer(updates ...MockContainerUpdate) *Container {
},
}
image := types.ImageInspect{
ID: "image_id",
ID: "image_id",
Config: &dockerContainer.Config{},
}
for _, update := range updates {
@ -64,3 +65,15 @@ func WithContainerState(state types.ContainerState) MockContainerUpdate {
cnt.State = &state
}
}
func WithHealthcheck(healthConfig dockerContainer.HealthConfig) MockContainerUpdate {
return func(cnt *types.ContainerJSON, img *types.ImageInspect) {
cnt.Config.Healthcheck = &healthConfig
}
}
func WithImageHealthcheck(healthConfig dockerContainer.HealthConfig) MockContainerUpdate {
return func(cnt *types.ContainerJSON, img *types.ImageInspect) {
img.Config.Healthcheck = &healthConfig
}
}