Repository navigation
test(gates): run each network gate's orchestrator offline, end to end - #302
Merged
Merged
Conversation
CI Results
All checks passed. |
CI Results
One or more checks failed — see the job logs. |
fakeregistry answered registry.py's own tests at the urlopen level. A gate run whole needs more than that: a chart helm can render, an HTTPS repository that indexes it, and every request routed to the fake serving its host. - chart_archive() builds a chart archive laid out as helm package writes one, with fixed modes and times, so the same files give the same digest. - ChartRepository serves an index.yaml carrying each archive's digest, and the archives. Its `answer` stands in for a repository that is down. - Hosts routes each request to a fake by URL prefix and records it. A URL no fake serves fails the test rather than reading as a registry's answer. - serve() points registry.py at those fakes for the length of one test, with the chart cache under the test's own directory and the index cache emptied. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
Six gates read a registry or grafana.com, so controls.py exempts them, and their stages were tested only apart. check-image-vulnerabilities main, check-falco-rule-floor main, check-log-volume-budget main, validate-dashboards main, check-platform-crs check and render-addons main each ran no further than its def line in the default run. Each one's test module now has a TheGateRunWhole class that runs it whole, with no network: - the chart gates read a fixture tree, fetch through registry.py's own client and cache from fakeregistry, and render with the real helm; - the falco gate also reads its rule sets through that client, from OCI fakes standing in for ghcr.io; - validate-dashboards reads the shipped tree, with grafana.com answered at urlopen and each retry's wait recorded rather than slept; - check-image-vulnerabilities scans through a trivy stand-in on PATH that answers each image from scripted reports. Each class holds the clean run, a finding the run names, and each way a stage fails, with the status that failure earns: a pin the registry rules out is 1; a registry that stays down, or a render that fails, is 2. run.py raises the six floors to what the suite now reaches, and that of check-image-pins.py, whose inventory the image gate's run covers. The new floors are platform-crs (96, 91), dashboards (98, 97), render-addons (98, 95), log-volume (100, 97), falco (97, 91), image-vulnerabilities (98, 97) and image-pins (93, 88). reverify-tests.sh reverts one composition step in each orchestrator and requires the end-to-end test that holds it to fail. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
check-image-vulnerabilities refused to run whenever the render produced fewer distinct images than it had units, as a walk that "got smaller rather than the catalog". Every chart a unit renders is already held to contributing an image, per chart, by check-image-pins.chart_coverage, the floor the file's own comment names. What the total added was a refusal of catalogs with nothing wrong: two charts whose one image is the same, a chart pinned by more than one unit, or imageless charts outnumbering the images the rest render beyond one each. The end-to-end run met the first: two charts sharing their image exited 2. The total is gone. test_charts_sharing_their_one_image_scan_it_once holds that run, and reverify-tests.sh restores the total and requires that test to fail. test_corpus_floors held the total's text as part of the derived floor, and now holds the per-chart derivation alone. The gate's floor rises to (99, 98). Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
Four test modules imported registry by name, and the import sort put that ahead of the gateloader import, which is what puts scripts/ on sys.path. The suite passed because an earlier module had already imported gateloader. reverify-tests.sh runs one module at a time, and there each of the four failed to import, so every probe it planted against them read as a miss. Each module now takes registry from load(), as test_gatelib and test_registry do, and gets the instance the gates hold. Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
stxkxs
force-pushed
the
claude/gates-orchestrators-offline
branch
from
November 29, 2026 04:34
2342a2d to
980d0be
Compare
CI Results
All checks passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Six gates read a registry or grafana.com, so
controls.pyexempts them, and their stages were tested only apart. In the default run, each of these orchestrators ran no further than itsdefline:check-image-vulnerabilitiesmain;check-falco-rule-floormain;check-log-volume-budgetmain;validate-dashboardsmain;check-platform-crscheck;render-addonsmain.Each one's test module now has a
TheGateRunWholeclass that runs it whole, with no network. Running them found one defect, which is fixed here.What changed
scripts/tests/fakeregistry.pynow serves a gate run whole:chart_archive()builds a chart archive laid out ashelm packagewrites one, with fixed modes and times, so the same files give the same digest.ChartRepositoryserves anindex.yamlcarrying each archive's digest, and the archives.Hostsroutes each request to a fake by URL prefix. A URL no fake serves fails the test rather than reading as a registry's answer.serve()pointsregistry.py's own client at those fakes for one test, with the chart cache under the test's own directory.The six runs. Each test module takes
registryfrom gateloader'sload(), so the instance it patches is the one its gate holds, whether it runs in the suite or alone.registry.py's client and cache, and render with the real helm. The gate-tests job installs helm. Without it these classes skip, and the per-file floors below then fail the run.validate-dashboardsreads the shipped tree. grafana.com is answered at urlopen, and each retry's wait is recorded rather than slept.check-image-vulnerabilitiesscans through a trivy stand-in onPATHthat answers each image from scripted reports.Each class holds three things:
What the runs found.
check-image-vulnerabilitiesrefused to run whenever the render produced fewer distinct images than it had units.check-image-pins.chart_coveragealready holds every chart to contributing an image, per chart; that is the floor the gate's own comment names. The total only refused catalogs with nothing wrong:The end-to-end run met the first case and exited 2. The total is removed.
test_corpus_floorsheld its text as part of the derived floor, and now holds the per-chart derivation alone.Floors.
run.pyraises each gate's (lines, branches) floor to what the suite now reaches:check-platform-crs.pyvalidate-dashboards.pyrender-addons.pycheck-log-volume-budget.pycheck-falco-rule-floor.pycheck-image-vulnerabilities.pycheck-image-pins.pycheck-image-pins.pyrises because the image gate's run covers its inventory.scripts/tests/reverify-tests.shgains seven probes. Six each revert one composition step in an orchestrator, and the seventh restores the image total. Each names the end-to-end test that must fail. They sit in their gates' own sections.Checks run on this branch
All local, at this head (
980d0be, on3deae31), under Python 3.15.2 with the lock installed--require-hashes:COVERAGE_REQUIRED=1 coverage run --rcfile=.coveragerc scripts/tests/run.py: 1592 tests across 44 modules pass, 64 of them new, with all 25 per-file floors held.scripts/tests/reverify-tests.sh:pass=300 fail=0, main's 293 and the 7 this adds.24a3017, gavepass=260 fail=33. Four of the new modules importedregistrybefore gateloader had putscripts/onsys.path. In the suite an earlier module had already imported gateloader. The harness runs one module at a time, and there those four could not import.scripts/tests/controls.py: all 25 controls complete a proof.scripts/tests/empty-corpus.py: all 36 probed gates refuse an empty corpus.scripts/check-named-things.py: all 276 path and target references resolve.scripts/, and shellcheck: pass.The rebase onto #299's squash met one conflict, in
run.py's floors table, where #299'scatalog.pyfloor sits beside this PR's control-exempt block. Both are kept.