This commit is contained in:
Mateusz Gruszczyński committed 2026-10-04 09:29:10 +02:00
1 parent 2e4aa4df4d
commit 87e571c170
106 files changed
+17952 -6185

No files matched your search

+24 -5
View File
@@ -114,13 +114,13 @@ def upgrade_smoke(tmp: Path) -> None:
assert backup.is_dir()
assert (backup / "src/obsolete.rs").is_file()
assert not (target / "src/obsolete.rs").exists()
assert 'version = "0.24.10"' in (target / "Cargo.toml").read_text(encoding="utf-8")
assert 'version = "0.25.0"' in (target / "Cargo.toml").read_text(encoding="utf-8")
assert (target / "data/keep.txt").read_text(encoding="utf-8") == "preserve\n"
assert (target / ".env").read_text(encoding="utf-8") == "RUST_PROXY_DEMO=0\n"
assert (target / "langs/site.json").is_file()
assert (target / "docker-agent/main.go").is_file()
manifest = json.loads((backup / "upgrade.json").read_text(encoding="utf-8"))
assert manifest["to_version"] == "0.24.10"
assert manifest["to_version"] == "0.25.0"
assert manifest["removed_obsolete_runtime_state"] is True
assert not legacy.exists()
assert not (backup / "legacy-data").exists()
@@ -160,6 +160,8 @@ def deployment_gate_smoke(tmp: Path) -> None:
assert "ExecStart=/opt/rustproxy/current/rust-proxy --data-dir /var/lib/rustproxy --admin-listen 0.0.0.0:9090 serve --proxy-listen 0.0.0.0:80 --tls-listen 0.0.0.0:443 --allow-remote-admin" in remote_unit
assert "ReadWritePaths=/var/lib/rustproxy /var/log/rustproxy" in remote_unit
assert "TimeoutStopSec=120" in remote_unit
for marker in ["PrivateDevices=true", "ProtectKernelLogs=true", "RestrictNamespaces=true", "RestrictRealtime=true", "SystemCallArchitectures=native"]:
assert marker in remote_unit, marker
deploy_source = (ROOT / "scripts/deploy.py").read_text(encoding="utf-8")
assert "def stop_for_managed_update" in deploy_source and ".managed-update" in deploy_source
assert "systemctl', 'stop', SERVICE" in deploy_source
@@ -240,10 +242,19 @@ def ui_contract_smoke() -> None:
host404 = (ROOT / "src/admin/web/host404.js").read_text(encoding="utf-8")
integrations = (ROOT / "src/admin/web/integrations.js").read_text(encoding="utf-8")
acme_ui = (ROOT / "src/admin/web/acme.js").read_text(encoding="utf-8")
traffic = (ROOT / "src/admin/web/traffic-panel.js").read_text(encoding="utf-8")
cache = (ROOT / "src/admin/web/cache-panel.js").read_text(encoding="utf-8")
transform_panel = (ROOT / "src/admin/web/transform-panel.js").read_text(encoding="utf-8")
css = (ROOT / "src/admin/web/style.css").read_text(encoding="utf-8")
required_html = [
'id="panel-traffic"',
'id="traffic-scope"',
'id="traffic-chart-countries"',
'id="traffic-chart-client-ips"',
'id="traffic-client-ips"',
'id="log-capture-user-agent"',
'id="log-capture-country"',
'id="cache-auto-trim-enabled"',
'id="settings-tab-logging"',
'id="settings-page-logging"',
'id="logging-form"',
@@ -304,6 +315,8 @@ def ui_contract_smoke() -> None:
]
for marker in required_html:
assert marker in html, marker
assert '/api/traffic' in traffic and 'rustProxyTrafficPanel' in traffic
assert 'traffic: "/traffic"' in app and 'window.rustProxyTrafficPanel?.refresh()' in app
for marker in ['id="settings-tab-manual-config"', 'id="settings-page-manual-config"', 'id="config-editor"', 'id="save-json"', 'id="export-config"']:
assert marker in html, marker
assert 'data-panel="configuration"' not in html and 'id="panel-configuration"' not in html
@@ -508,7 +521,7 @@ def source_contract_smoke() -> None:
assert marker in admin, marker
anonymous_block = admin.split("fn anonymous_allowed", 1)[1].split("const CERTIFICATE_API_KEY_HEADER", 1)[0]
assert '"/api/status"' not in anonymous_block
assert '"RuntimeInformation"' in openapi_0241 and '"version": "0.24.10"' in openapi_0241
assert '"RuntimeInformation"' in openapi_0241 and '"version": "0.25.0"' in openapi_0241
assert 'id="panel-logging"' not in html
for marker in ['id="settings-tab-logging"', 'id="settings-page-logging"', 'id="logging-form"', 'id="error-log-form"']:
assert marker in html, marker
@@ -952,7 +965,7 @@ def source_contract_smoke() -> None:
assert "removed_obsolete_runtime_state" in upgrade_source and "legacy-data" not in upgrade_source and "certs_dir.is_symlink()" in upgrade_source
assert '.managed-update' in main and "flush_hot_to_cold_for_update" in main
openapi = (ROOT / "src/admin/openapi.json").read_text(encoding="utf-8")
for marker in ['"version": "0.24.10"', '"memory_preset"', '"cold_preset"', '"memory_budget_bytes"', '"max_inflight"', '"preset"', '"session_days"', '"session_lifetime_seconds"', '"accept_local_listener_risk"', '"backend_header"', '"backend_timing_header"', '"cold_on_age"', '"match_type"', '"regex_insensitive"', '"NotFoundHost"', '"not_found_hosts"', '"PrometheusSettings"', '"allow_trusted_network_without_token"', '"include_docker_vhosts"', '"include_streams"', '"include_logging"']:
for marker in ['"version": "0.25.0"', '"memory_preset"', '"cold_preset"', '"memory_budget_bytes"', '"max_inflight"', '"preset"', '"session_days"', '"session_lifetime_seconds"', '"accept_local_listener_risk"', '"backend_header"', '"backend_timing_header"', '"cold_on_age"', '"match_type"', '"regex_insensitive"', '"NotFoundHost"', '"not_found_hosts"', '"PrometheusSettings"', '"allow_trusted_network_without_token"', '"include_docker_vhosts"', '"include_streams"', '"include_logging"']:
assert marker in openapi, marker
assert '"software_update"' in openapi and '"update_available"' in openapi
for marker in ['"/api/certificates/deploy"', '"CertificateDeploy"', '"CertificateDeployResult"', '"/api/certificates/reload"']:
@@ -1072,6 +1085,10 @@ def reproducible_archive_smoke(tmp: Path) -> None:
assert "RustProxy/src/admin/web/error_401.html" in names
assert "RustProxy/src/admin/web/error_404.html" in names
assert "RustProxy/docs/CUSTOM_LOCATIONS.md" in names
assert "RustProxy/docs/WEB_SERVER.md" in names
assert "RustProxy/docs/PHP_FPM.md" in names
assert "RustProxy/src/web_server.rs" in names
assert "RustProxy/src/admin/web/web-server.js" in names
assert "RustProxy/nagios/check_rustproxy.py" in names
assert "RustProxy/nagios/check_rustproxy_api" in names
assert "RustProxy/src/admin/web/host404.js" in names
@@ -1084,6 +1101,8 @@ def reproducible_archive_smoke(tmp: Path) -> None:
assert "RustProxy/src/update_check.rs" in names
assert "RustProxy/docker-agent/docker-agent" not in names
assert all("/data/" not in name and "/target/" not in name for name in names)
assert all(not name.endswith("/.env") for name in names), "local .env leaked into release archive"
assert "RustProxy/.env.example" in names
timestamps = {item.date_time for item in archive.infolist()}
assert len(timestamps) == 1
@@ -1100,7 +1119,7 @@ def main() -> None:
source_contract_smoke()
container_contract_smoke()
debian_grafana_contract_smoke()
print("PASS: 0.24.10 SQLite/upgrade, local-response 404 hosts, Prometheus/Grafana diagnostics, Debian packaging, cache/dashboard/logging/Nagios, retained admin/H3/stream/TLS contracts and reproducible source archives.")
print("PASS: 0.25.0 SQLite/upgrade, local-response 404 hosts, Prometheus/Grafana diagnostics, Debian packaging, cache/dashboard/logging/Nagios, retained admin/H3/stream/TLS contracts and reproducible source archives.")
if __name__ == "__main__":