From a53f800d026abc8ecf9e3d3e221880668c6d7bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:34:27 +0200 Subject: [PATCH] system_tests.py: Add debug output --- .github/workflows/build-lxd.yml | 4 ++++ tests/system_tests.py | 27 +++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-lxd.yml b/.github/workflows/build-lxd.yml index 1355914d..e1be4fc3 100644 --- a/.github/workflows/build-lxd.yml +++ b/.github/workflows/build-lxd.yml @@ -385,6 +385,8 @@ jobs: gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz" tar xf "geckodriver-"*"-$arch.tar.gz" sudo mv geckodriver /usr/local/bin/ + sudo chmod +x /usr/local/bin/geckodriver + geckodriver -V - name: Setup Selenium run: | sudo apt-get -y install python3-venv @@ -643,6 +645,8 @@ jobs: gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz" tar xf "geckodriver-"*"-$arch.tar.gz" sudo mv geckodriver /usr/local/bin/ + sudo chmod +x /usr/local/bin/geckodriver + geckodriver -V - name: Setup Selenium run: | sudo apt-get install -y python3-venv diff --git a/tests/system_tests.py b/tests/system_tests.py index ff647b6a..b0c13617 100755 --- a/tests/system_tests.py +++ b/tests/system_tests.py @@ -20,9 +20,13 @@ import sys import getopt import os import signal -from subprocess import run, getstatusoutput, PIPE, CompletedProcess +from subprocess import run as sp_run, getstatusoutput, PIPE, CompletedProcess from typing import Optional +def run(*args, **kwargs): + print("running command: " + " ".join(args[0])) + return sp_run(*args, **kwargs) + processes_must_be_running = [ 'apache2', 'cron', @@ -47,7 +51,7 @@ binaries_no_docker = [ 'btrfs', 'fail2ban-server', 'udiskie', - 'ufw', + 'ufw' 'samba', ] @@ -296,20 +300,23 @@ if __name__ == "__main__": except: dockers_running = '' - lxc_command = sudo_prefix - lxc_command += ['lxc'] if 'USE_INCUS' not in os.environ or os.environ['USE_INCUS'] != 'yes' else ['incus'] + lxc_command = sudo_prefix + ['lxc'] if os.environ.get('USE_INCUS', 'no') != 'yes' else ['incus'] try: lxc_test = run(lxc_command + ['info'], stdout=PIPE, check=True) if lxc_test.returncode != 0: raise Exception(f"failed to execute {lxc_command} info") except: - try: - lxc_test = run(['sudo'] + lxc_command + ['info'], stdout=PIPE, check='True') - lxc_command = ['sudo'] + lxc_command - except: + if os.environ.get('USE_SUDO', 'no') == 'yes': lxc_command = None lxc_running = False + else: + try: + lxc_test = run(['sudo'] + lxc_command + ['info'], stdout=PIPE, check='True') + lxc_command = ['sudo'] + lxc_command + except: + lxc_command = None + lxc_running = False # detect if we are running this in a LXC instance if lxc_command is not None: @@ -359,14 +366,14 @@ if __name__ == "__main__": if not skip_ping: at_char = ssh_cmd.index('@') ip = ssh_cmd[at_char+1:] - ping_cmd = run(['ping', '-c1', '-w10', ip], stdout=PIPE, stderr=PIPE) + ping_cmd = run(sudo_prefix + ['ping', '-c1', '-w10', ip], stdout=PIPE, stderr=PIPE) if ping_cmd.returncode != 0: print(tc.red + "No connectivity to " + tc.yellow + ip + tc.normal) #sys.exit(1) ssh_test = run(pre_cmd + [':'], stdout=PIPE, stderr=PIPE) if ssh_test.returncode != 0: - ssh_copy = run(['ssh-copy-id', ssh_cmd[4:]], stderr=PIPE) + ssh_copy = run(sudo_prefix + ['ssh-copy-id', ssh_cmd[4:]], stderr=PIPE) if ssh_copy.returncode != 0: print(tc.red + "SSH connection failed" + tc.normal) sys.exit(1)