40 lines
2.2 KiB
Python
Executable File
40 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""0.34.0 source-wiring checks only; do not mistake these for Rust tests."""
|
|
from pathlib import Path
|
|
import tomllib
|
|
|
|
root = Path(__file__).resolve().parents[2]
|
|
read = lambda path: (root / path).read_text()
|
|
assert tomllib.loads(read("Cargo.toml"))["package"]["version"] == "0.34.0"
|
|
assert 'version = "0.34.0"' in read("Cargo.lock")
|
|
app = read("src/runtime/updates.rs")
|
|
assert "CacheInvalidation::Scopes(scopes)" in app
|
|
assert "this.cache.purge_scope(&scope)" in app
|
|
assert "this.cache.set_control_revision(envelope.revision)" in app
|
|
assert app.index("this.cache.set_control_revision(envelope.revision)") < app.index("match invalidation")
|
|
source = read("src/runtime/types.rs")
|
|
assert "view.load_balancing = Default::default();" in source
|
|
assert "member.max_concurrent_requests = 0;" in source
|
|
assert "fn vhost_cache_revision" in source
|
|
assert "&web_services" in source
|
|
assert "service.sendfile = crate::web_server::SendfileMode::Off;" in source
|
|
assert "&config.php_fpm_profiles" in source
|
|
for filename in ("src/proxy/forward/route_cache.rs", "src/proxy/forward/web_source.rs"):
|
|
assert "ticket_scoped_for_config(" in read(filename)
|
|
assert "snapshot.envelope.revision" in read(filename)
|
|
assert "expected_control_revision" in read("src/cache/tickets.rs")
|
|
assert "file.scope_revision != expected_scope_revision" in read("src/cache/cold/startup.rs")
|
|
assert "scope_revision: draft.scope_revision" in read("src/cache/cold/worker.rs")
|
|
body = read("src/proxy/body.rs")
|
|
assert "response_backend: Option<Arc<crate::balance::Lease>>" in body
|
|
assert "lease.bytes(count, false);" in body
|
|
assert "exchange.backend_bytes(count, true)" in body
|
|
assert "cold_scope_fingerprint_preserves_unmodified_vhost" in read("src/cache/tests/cold_tier_tests.rs")
|
|
assert "stale_snapshot_cannot_issue_cache_ticket" in read("src/cache/tests/scope_tests.rs")
|
|
for file in (root / 'src').rglob('*.rs'):
|
|
if '/tests/' in file.as_posix() or file.name == 'tests.rs':
|
|
continue
|
|
if len(file.read_text().splitlines()) > 500:
|
|
raise AssertionError(f"production Rust source exceeds 500 lines: {file}")
|
|
print('PASS source wiring for scoped invalidation, cold fingerprints, stale-snapshot barrier, response accounting and <=500-line modules (STATIC ONLY)')
|