fix: overlay compose fields on image for healthcheck

This commit changes a bug where the compose healthcheck would always
overwrite the healthcheck set by the image - even if no compose
healthcheck exists.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
Cameron Diver 2018-10-16 08:49:58 +01:00
parent 11e97702cf
commit b1434e44ae
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1

View File

@ -190,8 +190,13 @@ function getNanoseconds(timeStr: string): number {
export function composeHealthcheckToServiceHealthcheck( export function composeHealthcheckToServiceHealthcheck(
healthcheck: ComposeHealthcheck | null | undefined, healthcheck: ComposeHealthcheck | null | undefined,
): ServiceHealthcheck { ): ServiceHealthcheck | { } {
if (healthcheck == null || healthcheck.disable) {
if (healthcheck == null) {
return { };
}
if (healthcheck.disable) {
return { test: [ 'NONE' ] }; return { test: [ 'NONE' ] };
} }
@ -230,7 +235,8 @@ export function getHealthcheck(
composeHealthcheck, composeHealthcheck,
); );
return _.defaults(composeServiceHealthcheck, imageServiceHealthcheck); // Overlay any compose healthcheck fields on the image healthchecks
return _.assign({ test: [ 'NONE' ] }, imageServiceHealthcheck, composeServiceHealthcheck);
} }
export function serviceHealthcheckToDockerHealthcheck( export function serviceHealthcheckToDockerHealthcheck(