Skip to content

Commit

Permalink
fix(liveness): Update liveness probe to better emulate kubernetes loc…
Browse files Browse the repository at this point in the history
…ally.
  • Loading branch information
ryan-cahill committed Jul 12, 2022
1 parent 50d6044 commit 33a4184
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/docker-compose/index.ts
Expand Up @@ -131,7 +131,7 @@ export class DockerComposeUtils {
if (!liveness_probe.command) {
liveness_probe.command = ['CMD-SHELL', `curl -f http://localhost:${liveness_probe.port}${liveness_probe.path} || exit 1`]; // deprecated
} else {
liveness_probe.command = ['CMD-SHELL', liveness_probe.command.join(' ')];
liveness_probe.command = ['CMD', ...liveness_probe.command];
}
service.healthcheck = {
test: liveness_probe.command,
Expand Down
10 changes: 4 additions & 6 deletions test/commands/dev.test.ts
Expand Up @@ -36,7 +36,7 @@ describe('local dev environment', function () {
port: 3000
environment: {}
liveness_probe:
command: curl --fail localhost:3000 || exit 1
command: curl --fail localhost:3000
interfaces:
hello:
Expand All @@ -61,7 +61,7 @@ describe('local dev environment', function () {
port: 3000
environment: {}
liveness_probe:
command: curl --fail localhost:3000 || exit 1
command: curl --fail localhost:3000
interfaces:
hello:
Expand Down Expand Up @@ -465,8 +465,7 @@ describe('local dev environment', function () {
"image": "heroku/nodejs-hello-world",
"healthcheck": {
"test": [
"CMD-SHELL",
"curl --fail localhost:3000 || exit 1"
"CMD", "curl", "--fail", "localhost:3000"
],
"interval": "30s",
"timeout": "5s",
Expand Down Expand Up @@ -931,8 +930,7 @@ describe('local dev environment', function () {
expect(runCompose.calledOnce).to.be.true;
expect(compose.services['hello-world--api'].healthcheck).to.deep.equal({
"test": [
"CMD-SHELL",
"curl --fail localhost:3000 || exit 1"
"CMD", "curl", "--fail", "localhost:3000"
],
"interval": "30s",
"timeout": "5s",
Expand Down

0 comments on commit 33a4184

Please sign in to comment.