ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Move EXPECTED_MANAGER check into pytest test
Juan Denisd5f6e13d045d
diff --git a/.github/workflows/test-system-utils.yml b/.github/workflows/test-system-utils.ymlindex 956685e1..fe6bb77a 100644--- a/.github/workflows/test-system-utils.yml+++ b/.github/workflows/test-system-utils.yml@@ -84,33 +84,6 @@ jobs:EXPECTED_MANAGER: ${{ matrix.expected_manager }}run: python3 -m pytest tests/test_utils_system_integration.py -v- - name: Verify expected package manager- working-directory: backend- env:- EXPECTED_MANAGER: ${{ matrix.expected_manager }}- run: |- python3 -c "- import importlib, os, sys, types-- # Direct import to avoid Flask deps- mod_path = os.path.join('app', 'utils', 'system.py')- spec = importlib.util.spec_from_file_location('app.utils.system', mod_path)- mod = importlib.util.module_from_spec(spec)- sys.modules['app'] = types.ModuleType('app')- utils = types.ModuleType('app.utils')- sys.modules['app.utils'] = utils- sys.modules['app'].utils = utils- sys.modules['app.utils.system'] = mod- sys.modules['app.utils'].system = mod- spec.loader.exec_module(mod)-- expected = os.environ['EXPECTED_MANAGER']- detected = mod.PackageManager.detect()- print(f'Distro detected: {detected} (expected: {expected})')- assert detected == expected, f'FAIL: expected {expected}, got {detected}'- print('PASS')- "-# ──────────────────────────────────────────────────────────────────# Job 3: Audit — grep for raw subprocess patterns in services# ──────────────────────────────────────────────────────────────────diff --git a/backend/tests/test_utils_system_integration.py b/backend/tests/test_utils_system_integration.pyindex 6b91635f..19df21d6 100644--- a/backend/tests/test_utils_system_integration.py+++ b/backend/tests/test_utils_system_integration.py@@ -90,6 +90,16 @@ class TestPackageManagerDetection:"""On any CI Linux container, a package manager should be available."""assert PackageManager.is_available() is True+ def test_matches_expected_manager_from_ci(self):+ """When CI sets EXPECTED_MANAGER, verify detect() agrees."""+ expected = os.environ.get('EXPECTED_MANAGER')+ if expected is None:+ pytest.skip('EXPECTED_MANAGER not set (not running in CI matrix)')+ detected = PackageManager.detect()+ assert detected == expected, (+ f'CI matrix expects {expected!r} but detect() returned {detected!r}'+ )+class TestIsCommandAvailable:"""Verify is_command_available() finds real binaries."""