mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
system_tests.py: Add debug output
This commit is contained in:
parent
e7f9f6e32a
commit
a53f800d02
4
.github/workflows/build-lxd.yml
vendored
4
.github/workflows/build-lxd.yml
vendored
@ -385,6 +385,8 @@ jobs:
|
|||||||
gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz"
|
gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz"
|
||||||
tar xf "geckodriver-"*"-$arch.tar.gz"
|
tar xf "geckodriver-"*"-$arch.tar.gz"
|
||||||
sudo mv geckodriver /usr/local/bin/
|
sudo mv geckodriver /usr/local/bin/
|
||||||
|
sudo chmod +x /usr/local/bin/geckodriver
|
||||||
|
geckodriver -V
|
||||||
- name: Setup Selenium
|
- name: Setup Selenium
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y install python3-venv
|
sudo apt-get -y install python3-venv
|
||||||
@ -643,6 +645,8 @@ jobs:
|
|||||||
gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz"
|
gh release download -R mozilla/geckodriver -p 'geckodriver-*-'"$arch.tar.gz"
|
||||||
tar xf "geckodriver-"*"-$arch.tar.gz"
|
tar xf "geckodriver-"*"-$arch.tar.gz"
|
||||||
sudo mv geckodriver /usr/local/bin/
|
sudo mv geckodriver /usr/local/bin/
|
||||||
|
sudo chmod +x /usr/local/bin/geckodriver
|
||||||
|
geckodriver -V
|
||||||
- name: Setup Selenium
|
- name: Setup Selenium
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y python3-venv
|
sudo apt-get install -y python3-venv
|
||||||
|
|||||||
@ -20,9 +20,13 @@ import sys
|
|||||||
import getopt
|
import getopt
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
from subprocess import run, getstatusoutput, PIPE, CompletedProcess
|
from subprocess import run as sp_run, getstatusoutput, PIPE, CompletedProcess
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
def run(*args, **kwargs):
|
||||||
|
print("running command: " + " ".join(args[0]))
|
||||||
|
return sp_run(*args, **kwargs)
|
||||||
|
|
||||||
processes_must_be_running = [
|
processes_must_be_running = [
|
||||||
'apache2',
|
'apache2',
|
||||||
'cron',
|
'cron',
|
||||||
@ -47,7 +51,7 @@ binaries_no_docker = [
|
|||||||
'btrfs',
|
'btrfs',
|
||||||
'fail2ban-server',
|
'fail2ban-server',
|
||||||
'udiskie',
|
'udiskie',
|
||||||
'ufw',
|
'ufw'
|
||||||
'samba',
|
'samba',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -296,20 +300,23 @@ if __name__ == "__main__":
|
|||||||
except:
|
except:
|
||||||
dockers_running = ''
|
dockers_running = ''
|
||||||
|
|
||||||
lxc_command = sudo_prefix
|
lxc_command = sudo_prefix + ['lxc'] if os.environ.get('USE_INCUS', 'no') != 'yes' else ['incus']
|
||||||
lxc_command += ['lxc'] if 'USE_INCUS' not in os.environ or os.environ['USE_INCUS'] != 'yes' else ['incus']
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lxc_test = run(lxc_command + ['info'], stdout=PIPE, check=True)
|
lxc_test = run(lxc_command + ['info'], stdout=PIPE, check=True)
|
||||||
if lxc_test.returncode != 0:
|
if lxc_test.returncode != 0:
|
||||||
raise Exception(f"failed to execute {lxc_command} info")
|
raise Exception(f"failed to execute {lxc_command} info")
|
||||||
except:
|
except:
|
||||||
try:
|
if os.environ.get('USE_SUDO', 'no') == 'yes':
|
||||||
lxc_test = run(['sudo'] + lxc_command + ['info'], stdout=PIPE, check='True')
|
|
||||||
lxc_command = ['sudo'] + lxc_command
|
|
||||||
except:
|
|
||||||
lxc_command = None
|
lxc_command = None
|
||||||
lxc_running = False
|
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
|
# detect if we are running this in a LXC instance
|
||||||
if lxc_command is not None:
|
if lxc_command is not None:
|
||||||
@ -359,14 +366,14 @@ if __name__ == "__main__":
|
|||||||
if not skip_ping:
|
if not skip_ping:
|
||||||
at_char = ssh_cmd.index('@')
|
at_char = ssh_cmd.index('@')
|
||||||
ip = ssh_cmd[at_char+1:]
|
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:
|
if ping_cmd.returncode != 0:
|
||||||
print(tc.red + "No connectivity to " + tc.yellow + ip + tc.normal)
|
print(tc.red + "No connectivity to " + tc.yellow + ip + tc.normal)
|
||||||
#sys.exit(1)
|
#sys.exit(1)
|
||||||
|
|
||||||
ssh_test = run(pre_cmd + [':'], stdout=PIPE, stderr=PIPE)
|
ssh_test = run(pre_cmd + [':'], stdout=PIPE, stderr=PIPE)
|
||||||
if ssh_test.returncode != 0:
|
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:
|
if ssh_copy.returncode != 0:
|
||||||
print(tc.red + "SSH connection failed" + tc.normal)
|
print(tc.red + "SSH connection failed" + tc.normal)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user