From b2f7a80f9ff6dcfc1a4adb654b1be53f097b294f Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 9 Dec 2021 21:04:11 +0100 Subject: [PATCH] tests: add compatibility with 21.11 Adapt to the new test driver and systemd versions. --- test/tests.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/tests.py b/test/tests.py index d7224c4..ef61152 100644 --- a/test/tests.py +++ b/test/tests.py @@ -1,7 +1,6 @@ from collections import OrderedDict import json - -logger = machine.logger +import re def succeed(*cmds): """Returns the concatenated output of all cmds""" @@ -34,7 +33,7 @@ def wait_for_open_port(address, port): status, _ = machine.execute(f"nc -z {address} {port}") return status == 0 - with logger.nested(f"Waiting for TCP port {address}:{port}"): + with machine.nested(f"Waiting for TCP port {address}:{port}"): retry(is_port_open) @@ -58,7 +57,7 @@ def run_tests(): raise RuntimeError(f"The following tests are enabled but not defined: {enabled}") machine.connect() # Visually separate boot output from the test output for test in to_run: - with logger.nested(f"test: {test}"): + with machine.nested(f"test: {test}"): tests[test]() def run_test(test): @@ -139,9 +138,9 @@ def _(): f"Output of 'lightning-cli plugin list':\n{plugin_list}" ) else: - logger.log("Active clightning plugins:") + machine.log("Active clightning plugins:") for p in test_data["clightning-plugins"]: - logger.log(os.path.basename(p)) + machine.log(os.path.basename(p)) @test("lnd") def _(): @@ -314,7 +313,7 @@ def _(): succeed("systemctl stop bitcoind") succeed("systemctl start duplicity") - machine.wait_until_succeeds(log_has_string("duplicity", "duplicity.service: Succeeded.")) + machine.wait_until_succeeds(log_has_string("duplicity", "duplicity.service: Deactivated successfully.")) run_duplicity = "export $(cat /secrets/backup-encryption-env); duplicity" # Files in backup and /var/lib should be identical assert_matches(