Repository navigation
Conversation
bpalermo
added a commit
that referenced
this pull request
Sep 16, 2026
… tests, no sleeps in sync_test; stop proxy/*.md edits triggering Envoy releases (#772) (#788) * test: delete the two duplicate :server_integration_test targets (#772, C1) `//agent/internal/cni/server:server_integration_test` and `//agent/internal/xds/server:server_integration_test` added no assertions. Each declared a strict *subset* of the srcs of the sibling `:server_test` in the same package, and `:server_test` already lists `server_integration_test.go` itself — so every `TestIntegration_*` executed twice on a full `bazel test //...`. Re-proved on this tree with `comm -23 <(bazel query 'labels(srcs, <pkg>:server_integration_test)') <(bazel query 'labels(srcs, <pkg>:server_test)')`, empty for both packages: cni/server :server_integration_test = {pod_test.go, server_integration_test.go} :server_test = those + ghostsweep_lock_test.go, ghostsweep_test.go, identity_test.go, lifecycle_race_test.go, liveness_test.go, metrics_test.go, resubscribe_test.go, termination_test.go xds/server :server_integration_test = {server_integration_test.go, server_test.go} :server_test = those + identity_hold_test.go, initial_snapshot_test.go, odcds_test.go, refresh_identity_test.go, refresh_test.go No Go test file and no test function is removed: after the deletion `--test_filter=TestIntegration_` still runs 9 cases in cni/server and 4 in xds/server, from the surviving `:server_test` targets. The `integration` tag was the expensive part. `scripts/ci-impacted-targets.sh:41` selects the CI `integration` leg purely by `attr(tags, "integration", tests(//...))`, so any change touching either package scheduled a whole extra GitHub runner (checkout + setup-bazel + artifact download) to re-run tests the `test` leg had just run. Nothing in `.github/workflows/` or `bazel/` selects these targets by name, and the `integration` job is already conditional on `has_integration == 'true'`, so no workflow change is needed — the job simply stops being scheduled for agent-only changes. After the deletion the tag selects only the two genuine testcontainers targets: $ bazel query 'attr(tags, integration, tests(//...))' //registrar/internal/replicator:replicator_test //registry/internal/etcd:etcd_test (which also retires the false `no-remote-exec` justification comment on the deleted targets — neither imported testcontainers, and `.bazelrc:71` already pins every test action to the runner.) Verification: `bazel query` output above; both `:server_test` targets pass with `--test_filter=TestIntegration_`; `bazel run //:gazelle` produces no churn. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * test(etcd): make -test.short actually Docker-free (#772, C1) `registry/internal/etcd/etcd_test.go` guards all 17 container-backed tests with `testing.Short()`, but `TestMain` started, waited on, and terminated the etcd container before `m.Run()` regardless — so `--test_arg=-test.short` skipped every test and still required a working Docker daemon and still paid the pull/start/readiness cost. Parse the test flags and check `testing.Short()` before touching testcontainers, exactly as `registrar/internal/replicator/replicator_test.go:29` already does. `flag.Parse()` is required: `testing.Short()` reads a flag value that is not populated until the test flags are parsed, and in `TestMain` that has not happened yet. The short path still runs the suite rather than exiting, because `TestEtcdRegistry_CloseWithoutStart` deliberately has no short guard — it closes a registry that was never started and needs no endpoint. #776's `TestEtcdRegistry_CloseRacesWatchLoop` does carry the guard and is unaffected. No production code and no test case changed. Verification: # short: Docker untouched $ docker ps -aq | wc -l -> 2 (before) $ bazel test //registry/internal/etcd:etcd_test --nocache_test_results \ --test_arg=-test.short --test_arg=-test.v PASSED in 0.1s (was ~4.6s) $ docker ps -aq | wc -l -> 2 (after, no etcd container ever created) 17 SKIP + 1 PASS (TestEtcdRegistry_CloseWithoutStart) # full: unchanged, 18/18 pass incl. #776's test $ bazel test //registry/internal/etcd:etcd_test --nocache_test_results --test_arg=-test.v PASSED in 4.4s, --- PASS: TestEtcdRegistry_CloseRacesWatchLoop Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * test(proxy): delete the misnamed TestSortRoutesBySpecificity_HeaderCountRanksHigher (#772, C1) This is the one sanctioned test deletion in C1 (the tests report's move #10). `agent/internal/xds/proxy/edge_test.go:859` was named for `sortRoutesBySpecificity`, but it never called it — it cannot: that function is unexported and lives in a different package (`agent/internal/xds/cache/edge.go:90`). What the body actually did was build two routes with `BuildEdgeRoute` and assert that one ended up with two `HeaderMatcher` entries and the other with one, then comment "the route with 2 headers must sort before the route with 1" without asserting any ordering. So it tested header copying under a name that promised specificity ordering — the worst failure mode for a test, because the name is what a reader trusts when deciding whether a behaviour is covered. Both halves are already covered, properly, elsewhere: - header copying: `TestBuildEdgeRoute_HeaderMatch` (`agent/internal/xds/proxy/edge_test.go:730`) asserts the exact and regex `HeaderMatcher` shapes this one only counted. - specificity ordering: `agent/internal/xds/cache/edge_test.go` calls the real `sortRoutesBySpecificity` directly at :1030, :1051, :1157, :1171, :1185 and :1213 and asserts the resulting order. Deleting it rather than renaming it, because a rename would leave a third BuildEdgeRoute header-count assertion with nothing to say that `TestBuildEdgeRoute_HeaderMatch` does not already say more precisely. Verification: `bazel test //agent/internal/xds/proxy:proxy_test //agent/internal/xds/cache:cache_test` both pass. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * test(registrar): synchronise sync_test on conditions, not on time.Sleep (#772, C1) `registrar/internal/server/sync_test.go` was the one package in the tree that consistently slept instead of waiting: 10 `time.Sleep` calls (30–200 ms) used as synchronisation, ~930 ms of hard-coded wall time and the target's only flake surface. A sleep that is long enough today is a flake on a loaded CI runner and dead time on every other run. Each one is replaced by the narrowest observable condition: - Waiting for the initial sync now uses `Syncer.Synced()`, the channel the production code already closes after the first successful cycle (`sync.go:184`) — exact, not approximate. `requireSynced` wraps it with a 5 s deadline. Used by InitialSync, VersionAdvancesOnSync, EmptyRegistryPopulatesEmptySnapshot, MultipleEndpointsAcrossServices, NoEventsAfterInitialSync, RegistryErrorOnSubsequentSyncDoesNotCrash and StopsOnContextCancellation. - BroadcastsChangesOnSubsequentSync waits for the event to reach the watcher (`len(eventCh) > 0`) rather than for two poll intervals to elapse. - RegistryErrorDoesNotCrash has no observable effect to wait on — a failing cycle closes neither `Synced()` nor the snapshot — so `mockRegistry` gains an atomic `listCalls` counter and the test waits for the call itself. - RegistryErrorOnSubsequentSyncDoesNotCrash's cycle counter `httpCalls` became an `atomic.Int64` so the test goroutine can read it; the test waits for two failing periodic cycles instead of 200 ms. - NoEventsAfterInitialSync waits for `2*len(syncedProtocols)` further list calls, i.e. two real cycles, derived from the production protocol list instead of hard-coded. The two remaining `time.After` calls are assertion deadlines (Start must return within 500 ms of cancellation), not synchronisation, and stay. The poll intervals of the two change-detecting tests drop 60 ms → 20 ms now that nothing depends on a sleep lining up with them. No production code changed and no test case was removed or renamed. Verification: $ bazel test //registrar/internal/server:server_test --runs_per_test=10 --config=race PASSED in 2.8s, Stats over 10 runs: max = 2.8s, min = 2.8s, dev = 0.0s $ grep -c time.Sleep registrar/internal/server/sync_test.go -> 0 TestSyncer subset, uncached: 1.2s -> 0.4s Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr * ci: stop a proxy docs edit from rebuilding Envoy (#772, C1) PR #773 changed one line of `proxy/README.md`. `proxy-release.yml`'s push trigger filters on `paths: ["proxy/**"]`, so the merge compiled Envoy on both RBE pools, pushed a new multi-arch image and opened chart-pin PR #786 — for a comment. `proxy.yml` had the same hole at PR time: its `changes` job's dorny/paths-filter pattern is also `proxy/**`, so a README-only PR ran the heavy compile on both arches before anyone could review it. Exclude Markdown under proxy/ from both. proxy-release.yml (GitHub-native `paths`): GitHub rejects `paths` and `paths-ignore` on the same event, so the exclusion has to be a negated pattern inside `paths`. GitHub evaluates the list in order and a later negative wins, so `"!proxy/**/*.md"` must follow `"proxy/**"`; the trailing workflow-self entry is unaffected because the negation does not match it. `proxy/**/*.md` covers `proxy/README.md` as well as nested files — in GitHub's filter patterns `**/` matches zero directories (their own cheat sheet lists `docs/README.md` under `docs/**/*.md`). proxy.yml (dorny/paths-filter@v4): the same `!` spelling would NOT work under the action's default quantifier. It ORs the compiled patterns, and picomatch compiles a leading `!` into "matches everything the positive pattern does not", so `'!proxy/**/*.md'` would match `.github/**`, `agent/**`, … and the filter would be permanently true. v4 ships `predicate-quantifier: 'some-with-excludes'` for exactly this: a file matches when at least one positive pattern matches it and no negated pattern does. Set it, then add the same `'!proxy/**/*.md'`. Verified against the action's own matching logic (filter.ts `isInclude` / `isExclude`, the latter being `excludes.some(m => !m(path))`) with picomatch: proxy/README.md -> false proxy/BUILD.bazel -> true proxy/docs/a.md -> false proxy/MODULE.bazel -> true agent/main.go -> false .github/workflows/proxy.yml -> true Exclusion is per changed file, so a PR touching both `proxy/README.md` and a real proxy source file still builds. The `proxy` gate job is `if: always()` (proxy.yml:120), so a docs-only proxy PR still reports the required check — same path a control-plane-only PR already takes. Verification: both files parse under `python3 -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))'`; dorny behaviour simulated as above. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
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.
No description provided.