From 18318766cc308beb9a84e6493986b46f84281db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignas=20Vy=C5=A1niauskas?= Date: Thu, 24 Oct 2024 14:32:52 +0300 Subject: [PATCH] Work around long update check interval in controller with a restart Previously, the base/proxy-and-update e2e test passed, because the controller considered `latest < {booted,inactive}` an error state and triggered an update check "quickly" (in 30 seconds). This was changed with commit d8053bd0a7da78e8e20dd43440fbcf8d87e71ae9 which changed the interpration of this state to `UpToDate` i.e. a non-error state, therefore entering a long sleep of 1 hour. As a work-around, we restart the controller to trigger an update check. This is ugly and potentially hides bugs, should be eliminated once the runtime configuration option is added. --- .../tests/base/proxy-and-update.nix | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/testing/end-to-end/tests/base/proxy-and-update.nix b/testing/end-to-end/tests/base/proxy-and-update.nix index 4080bc6d..55803b4e 100644 --- a/testing/end-to-end/tests/base/proxy-and-update.nix +++ b/testing/end-to-end/tests/base/proxy-and-update.nix @@ -173,13 +173,17 @@ pkgs.testers.runNixOSTest { wait_for_logs(playos, expected_kiosk_logs) with TestCase("Controller is able to query the version"): - expected_controller_log = f"latest.*{current_version}" - wait_for_logs(playos, - expected_controller_log, - unit="playos-controller.service", - # this should not be longer than 30, could there be some - # DNS cache somehwere? - timeout=61) + expected_states = [ + "GettingVersionInfo", + "UpToDate", + f"latest.*{current_version}" + ] + + for state in expected_states: + wait_for_logs(playos, + state, + unit="playos-controller.service", + timeout=61) with TestCase("Controller installs the new upstream version") as t: next_version = "${nextVersion}" @@ -191,6 +195,10 @@ pkgs.testers.runNixOSTest { update_server.add_bundle(next_version, filepath="/tmp/next-bundle.raucb") update_server.set_latest_version(next_version) + # reboot controller to trigger version check + # TODO: override config to reduce check interval instead + playos.systemctl("restart playos-controller.service") + expected_states = [ "Downloading", f"Installing.*{update_server.bundle_filename(next_version)}",