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
test(registry): assert bundled catalog entries match what the panel ships
Juan Deniseb6967459e94
diff --git a/backend/tests/test_registry_bundled_index.py b/backend/tests/test_registry_bundled_index.pyindex 4dab5df2..b5c04436 100644--- a/backend/tests/test_registry_bundled_index.py+++ b/backend/tests/test_registry_bundled_index.py@@ -21,6 +21,7 @@ from pathlib import Pathimport pytestBUNDLED = Path(__file__).resolve().parent.parent / 'app' / 'data' / 'registry_index.json'+BUILTIN_DIR = Path(__file__).resolve().parent.parent.parent / 'builtin-extensions'PUBLISHED = 'https://raw.githubusercontent.com/jhd3197/serverkit-extensions/main/index.json'SHA256_HEX = 64@@ -78,6 +79,37 @@ def test_source_url_agrees_with_the_declared_version(bundled):)+def test_bundled_entries_match_what_the_panel_actually_ships(bundled):+ """A `bundled: true` entry promises an extension that ships inside the panel.++ Those entries carry no source/sha256 -- there is nothing to download and+ nothing to checksum -- so every other check in this file skips them, and+ `test_matches_published_index` only proves the catalog agrees with the+ registry, not that either agrees with the code. A bundled entry can+ therefore name a version the panel does not ship, or an extension it does+ not ship at all, and nothing notices.++ This is the offline half of that: it needs no network and fails on the PR+ that introduces the mismatch. Only checked in this direction -- a builtin+ that is deliberately absent from the catalog is a product decision, not rot.+ """+ for e in bundled['extensions']:+ if not e.get('bundled'):+ continue+ slug = e['slug']+ manifest = BUILTIN_DIR / slug / 'plugin.json'+ assert manifest.is_file(), (+ f'{slug}: listed as bundled, but {manifest.parent.name}/plugin.json '+ f'does not exist -- the catalog offers an extension the panel does not ship'+ )+ with open(manifest, 'r', encoding='utf-8') as f:+ shipped = json.load(f)+ assert str(shipped.get('version')) == str(e.get('version')), (+ f'{slug}: catalog says {e.get("version")}, '+ f'builtin-extensions/{slug}/plugin.json ships {shipped.get("version")}'+ )++@pytest.mark.skipif(os.environ.get('SERVERKIT_SKIP_NETWORK_TESTS') == '1',reason='network tests disabled',