Skip to content

Commit

Permalink
tests:os:engine-socket: Use writeConfigJsonProp helper function
Browse files Browse the repository at this point in the history
Use the existing helper function to write changes to config.json.

Change-type: patch
  • Loading branch information
klutchell committed Sep 12, 2024
1 parent b81a2d7 commit ab76b45
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions tests/suites/os/tests/engine-socket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ module.exports = {
let ip = await this.worker.ip(this.link)
const docker = new Docker({host: `http://${ip}`, port: 2375})
test.comment(`Setting system in development mode...`)
await this.context
.get()
.worker.executeCommandInHostOS(
`tmp=$(mktemp)&&cat /mnt/boot/config.json | jq '.developmentMode="true"' > $tmp&&mv "$tmp" /mnt/boot/config.json`,
this.link,
);
await this.systemd.writeConfigJsonProp(test, 'developmentMode', true, this.link);
test.comment(`Waiting for engine to restart...`)
await this.utils.waitUntil(async () => {
return (
Expand Down Expand Up @@ -69,12 +64,7 @@ module.exports = {
let ip = await this.worker.ip(this.link)
const docker = new Docker({host: `http://${ip}`, port: 2375})
test.comment(`Setting system in production mode...`)
await this.context
.get()
.worker.executeCommandInHostOS(
`tmp=$(mktemp)&&cat /mnt/boot/config.json | jq '.developmentMode="false"' > $tmp&&mv "$tmp" /mnt/boot/config.json`,
this.link,
);
await this.systemd.writeConfigJsonProp(test, 'developmentMode', false, this.link);
test.comment(`Waiting for engine to restart...`)
await this.utils.waitUntil(async () => {
return (
Expand All @@ -97,12 +87,7 @@ module.exports = {
"Engine socket should not be exposed in production images"
);
test.comment(`Leaving system in development mode...`)
await this.context
.get()
.worker.executeCommandInHostOS(
`tmp=$(mktemp)&&cat /mnt/boot/config.json | jq '.developmentMode="true"' > $tmp&&mv "$tmp" /mnt/boot/config.json`,
this.link,
);
await this.systemd.writeConfigJsonProp(test, 'developmentMode', true, this.link);
},
},
],
Expand Down

0 comments on commit ab76b45

Please sign in to comment.