27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Run real GUI readiness acceptance in an isolated, networkless container."""
|
|
import os
|
|
import argparse
|
|
from pathlib import Path
|
|
import subprocess
|
|
import uuid
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--recovery', action='store_true')
|
|
args = parser.parse_args()
|
|
root = Path(__file__).resolve().parents[1]
|
|
test_file = 'screen-recovery.test.py' if args.recovery else 'runtime-probe-gui.test.py'
|
|
name = 'lazyboy-plan-runtime-gui-' + uuid.uuid4().hex[:12]
|
|
try:
|
|
subprocess.run([
|
|
'docker', 'run', '--name', name, '--network', 'none', '--user', '1000:1000',
|
|
'--memory', '2g' if args.recovery else '1g', '--cpus', '2', '--pids-limit', '512', '--shm-size', '256m',
|
|
'--mount', f'type=bind,src={root / "crates/supervisor/src/runtime_probe.py"},dst=/fixture/runtime_probe.py,readonly',
|
|
'--mount', f'type=bind,src={root / "tests" / test_file},dst=/fixture/test.py,readonly',
|
|
'--mount', f'type=bind,src={root / "image/computer/lazyboy-screen"},dst=/fixture/lazyboy-screen,readonly',
|
|
'--entrypoint', 'python3', os.environ.get('LAZYBOY_TEST_COMPUTER_IMAGE', 'lazyboy/computer:local'),
|
|
'/fixture/test.py',
|
|
], check=True, timeout=240)
|
|
finally:
|
|
subprocess.run(['docker', 'rm', '-f', name], check=False, stdout=subprocess.DEVNULL)
|