From 1aaf764fa59e1518bbb9635e561153d39d00baf2 Mon Sep 17 00:00:00 2001 From: Ryan Cooke Date: Fri, 22 Nov 2024 11:37:46 +0000 Subject: [PATCH] tests: hup: rollback-altboot: replace while loop over SSH to speed up tests The altboot test often hangs for a long time during the altboot test, after the DUT has booted into the old OS after the altboot failure - the check to see if the rollback systemd services have stopped hangs. This is an attempt to fix that, as I think there's some strange interaction going on with the while loop over ssh Change-type: patch Signed-off-by: Ryan Cooke --- tests/suites/hup/tests/rollbacks.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/suites/hup/tests/rollbacks.js b/tests/suites/hup/tests/rollbacks.js index e9e6d3eda6..49b885fad2 100644 --- a/tests/suites/hup/tests/rollbacks.js +++ b/tests/suites/hup/tests/rollbacks.js @@ -258,14 +258,26 @@ module.exports = { await this.worker.rebootDut(this.link); - // system.waitForServiceState times out here for some reason, so just use shell - await this.worker.executeCommandInHostOS( - ['while [ "$(systemctl is-active rollback-altboot)" != "inactive" ]', - '|| [ "$(systemctl is-active rollback-health)" != "inactive" ]; do sleep 1; done' - ], - this.link, - ); - + await this.utils.waitUntil(async () => { + console.log(`Waiting for rollback-altboot service to be inactive...`) + let state = await this.worker.executeCommandInHostOS( + `systemctl is-active rollback-altboot || true`, + this.link + ) + console.log(state) + return (state === "inactive"); + }) + + await this.utils.waitUntil(async () => { + console.log(`Waiting for rollback-health service to be inactive...`) + let state = await this.worker.executeCommandInHostOS( + `systemctl is-active rollback-health || true`, + this.link + ) + console.log(state) + return (state === "inactive"); + }) + await test.resolves( this.utils.waitUntil(async () => { return this.worker.executeCommandInHostOS(