Repository navigation
test(e2e): isolate S3 bucket per kubernetes scenario - #1417
Conversation
The e2e-nightly kubernetes leg failed every scheduled run since 2026-06-11 on the CDC scenarios (single-s3-postgres-cdc, ha-s3-postgres-cdc, ha-s3-postgres-cdc-lifecycle) with "PostgreSQL database is empty (0 chunks)". Why: the kubernetes harness isolated a database per scenario but shared one Garage bucket (ncps-bucket) across every scenario and never cleaned it. Earlier non-CDC scenarios reuse the same test narinfo hashes and leave whole-file .nar.xz objects in store/nar/. When a CDC scenario then runs with a fresh database against that dirty bucket, ncps (since #1393 treats a stored .nar.xz as a present Compression:none NAR) sees the residual whole file as already present, skips the upstream download and eager chunking, and BackgroundMigrateNarToChunks fails with "error fetching nar from store: not found" -- so zero chunk rows are created and validation fails. Pre-#1393 the path only checked .nar.zst, missed the residual, re-downloaded and eager-chunked. cdc-lifecycle passes because it uses local per-pod storage with no shared residue. How: isolate the S3 bucket per scenario, mirroring the per-scenario database isolation. A shared scenario_bucket_name helper derives ncps-<scenario> (the single source of truth); config.nix renders it into each scenario's Helm values; garage setup creates and grants each per-scenario bucket idempotently; and the S3 storage validation reads the per-scenario bucket. A bucket isolates NAR, narinfo, and chunk stores at once (the chunk store ignores the configured prefix, so a per-scenario prefix would be incomplete). Test-harness only; no ncps, chart, or CDC behavior change. Verified: nix eval shows distinct ncps-<name> buckets per S3 scenario; new harness unit test; task fmt/lint/test green; and a live Kind run of single-s3-postgres (non-CDC) followed by all three CDC scenarios passes 4/4 with non-zero chunk counts. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
This change is part of the following stack: Change managed by git-spice. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThe e2e test harness is updated to replace a single shared Garage S3 bucket ( ChangesPer-scenario S3 bucket isolation in e2e harness
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Code Review
This pull request isolates S3 storage per scenario in the Kubernetes e2e test harness to prevent cross-scenario data contamination, which previously caused CDC scenarios to fail due to residual whole-file NARs. It introduces per-scenario bucket creation, updates Helm value generation and validation, and adds unit tests. The review feedback highlights a potential path mismatch for the config file, a potential AttributeError when parsing permutations, and suggests normalizing bucket names in both Python and Nix to ensure strict S3 compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Addresses gemini-code-assist review feedback on PR #1417: - Fix stale default config path in K8sTestsCLin.__init__: the fallback pointed at the removed nix/k8s-tests/config.nix; correct it to nix/e2e-tests/config.nix (thread PRRT_kwDONV6tZs6LfFt9). - Guard the garage per-scenario bucket loop against a permutation whose storage is explicitly null: (perm.get("storage") or {}).get("type") (thread PRRT_kwDONV6tZs6LfFuB). Declined the two bucket-name normalization suggestions (threads PRRT_kwDONV6tZs6LfFuI, PRRT_kwDONV6tZs6LfFuM) and documented why: scenario names are kebab-case by the catalog contract (already valid S3 bucket names), and plain Nix has no toLower builtin -- the suggested builtins.toLower does not exist -- so normalizing only one side would desync the Python and Nix bucket names. Both sides are kept verbatim ncps-<name> so they stay byte-for-byte identical; clarified the comments on both sides to say so. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Addressed review feedback in 4e80be8:
|
Summary
Fixes the
e2e-nightlykubernetes leg, which has failed every scheduled run since 2026-06-11 on the CDC scenarios (single-s3-postgres-cdc,ha-s3-postgres-cdc,ha-s3-postgres-cdc-lifecycle) withPostgreSQL database is empty (0 chunks).Root cause (confirmed via local Kind e2e + pod logs + bucket-empty proof): the kubernetes harness isolates a database per scenario but shared a single Garage bucket (
ncps-bucket) across every scenario and never cleaned it. Earlier non-CDC scenarios reuse the same test narinfo hashes and leave whole-file.nar.xzobjects instore/nar/. When a CDC scenario then runs with a fresh database against that dirty bucket, ncps (since #1393 treats a stored.nar.xzas a presentCompression:noneNAR) sees the residual whole file as already present, skips the upstream download + eager chunking, andBackgroundMigrateNarToChunksfails witherror fetching nar from store: not found— so zero chunk rows are created and validation fails. Pre-#1393 the path only checked.nar.zst, missed the residual, re-downloaded and eager-chunked (the last green run produced 4 chunks).cdc-lifecyclepasses because it uses local per-pod storage with no shared residue.What changed (test harness only — no ncps / chart / CDC behavior change)
harness_config.scenario_bucket_name()— single source of truth derivingncps-<scenario>.config.nix— each scenario's generated Helm values use its own bucket.k8s_tests.py— garage setup creates + grants a bucket per S3 scenario (idempotent); test-config carries the per-scenario bucket.k8s_tests_tester.py— S3 storage validation reads the per-scenario bucket.A per-scenario bucket (not prefix) isolates the NAR, narinfo, and chunk stores at once — the chunk store ignores the configured S3 prefix, so a per-scenario prefix would leave chunks colliding.
Test plan
nix evalconfirms each S3 scenario renders a distinctncps-<name>bucket; local scenarios get nonetest_s3_bucket_isolation.py);e2e-harness-unitnet green (66 passed)task fmt,task lint,task test(0 failures) greensingle-s3-postgres(non-CDC) then all three CDC scenarios → 4/4 pass, 4 chunks each (cross-scenario isolation proven)e2e-nightlyworkflow_dispatchon this branch goes green (kubernetes leg)