Repository navigation
test: shrink integration outliers (s3 bucket, redis TTL, NAR) - #1244
Conversation
|
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)
📝 WalkthroughSummary by CodeRabbit
WalkthroughTests updated: distributed cache and Redis lock tests use shorter TTLs/wait bounds and a bounded context; concurrent NAR test reduces payload and server delay; S3 bucket-access test now returns a 403 HTTP mock response instead of a RoundTripper error. ChangesTest Timing and Mock Optimization
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly Related PRs
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 optimizes test execution speed by reducing TTLs, sleep durations, and timeouts across distributed cache, Redis locking, and S3 storage tests. Notable changes include decreasing the NAR size for concurrent download scenarios and returning non-retryable 403 errors in S3 mocks to avoid SDK retry delays. Feedback suggests that the 200ms timeout for lock contention checks might be too tight for high-load environments, potentially leading to flaky tests, and recommends using TryLock for more deterministic verification.
411ed9e to
743ec78
Compare
dba7e1e to
2e2fcbe
Compare
743ec78 to
0d81c5c
Compare
2e2fcbe to
2530d08
Compare
0d81c5c to
6aacbc7
Compare
2530d08 to
babdf33
Compare
6aacbc7 to
e6e746b
Compare
babdf33 to
f3d9b91
Compare
e6e746b to
d0524aa
Compare
f3d9b91 to
f54c8bb
Compare
d0524aa to
4a6c1a2
Compare
f54c8bb to
5f830c5
Compare
4a6c1a2 to
a13d438
Compare
5f830c5 to
684c5a5
Compare
Continuation of the integration-test wall-time work. Builds on the fix(ncps): close dbClient on shutdown commit, which already removed ~16s of DROP DATABASE wait. This commit picks off the remaining named integration outliers: pkg/storage/s3 TestNew_BucketAccessError (5.22s -> ~0s): - The RoundTripper mock returned a Go error, triggering minio-go's exponential-backoff retry loop (~5s before giving up). Replace with s3ErrorResponse() so the SDK gives up immediately on the non-retryable 403. The production wrapper at s3.go:95 already wraps any non-nil err with "error testing bucket access", so the Contains() assertion still passes. The now-unused errTestingBucketAccess sentinel is removed. pkg/cache TestDistributedBackends/.../LockFailover (4.51s -> ~1s each, x3 backends): - shortTTL: 2s -> 500ms (sleep matched at 800ms). - ctx2 timeout: 500ms -> 200ms — still well under shortTTL so the "second locker fails while first holds the lock" check is sound. - Total saving across the three backend variants: ~10s of test wall time. pkg/cache TestDistributedBackends/.../LargeNARConcurrentDownload (5.4s -> ~1s each, x3 backends): - NAR payload 2 MiB -> 256 KiB. The test exercises concurrent download coordination, not raw throughput; 256 KiB still trips CDC chunking and keeps the lock dance honest. - Server-side artificial delay 2s -> 300ms. The only requirement is that follower goroutines arrive while the first download is in flight, and goroutine scheduling latency is sub-millisecond on a quiet machine. pkg/lock/redis TestLocker_LockExpiry (2.01s -> ~0.6s): - Lock TTL 1s -> 200ms, post-expiry sleep 2s -> 400ms. Redis lock expiry is millisecond-granular; 400ms is plenty of safety. pkg/lock/redis TestLocker_DegradedModeDisabled (1.72s -> ~0.5s): - The "unreachable Redis port" call previously waited on the go-redis default DialTimeout (5s) per attempt. Wrap ctx in a 500ms WithTimeout so the failure surfaces fast — matches the same fix already applied to TestNewLocker_ReturnType. Skipped intentionally: - TestDistributedBackends/.../PutNarInfoConcurrentSharedNar (50 iterations to catch a concurrency race) — same policy as the chunker race test; reducing iterations weakens the safety net. Cumulative integration-test wall time (full suite, all deps live): ~64.40s -> ~58.99s after this commit. Combined with the previous dbClient fix, integration baseline 80.09s -> 58.99s (~26% lower). Captures the post-batch profile under openspec/changes/less-tests/integration-after-batch5-timings.txt. Verified: \`go test -race\` on every touched package passes; \`golangci-lint run\` is clean.
684c5a5 to
27b0281
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1244 +/- ##
=====================================
Coverage 5.50% 5.50%
=====================================
Files 6 6
Lines 400 400
=====================================
Hits 22 22
Misses 374 374
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dev-scripts/test-migration-e2e.py (PR #1233): - PRRT_kwDONV6tZs6EU7OZ: raise in stop_ncps if port never closes (was silently ignored). - PRRT_kwDONV6tZs6EU7Ob: raise on unparseable idempotency output instead of downgrading to a WARN log. - PRRT_kwDONV6tZs6EVEfJ: wait_ready() takes the process handle and exits early when ncps dies before becoming ready, avoiding the full 120s timeout. dev-scripts/run.py (PR #1232): - PRRT_kwDONV6tZs6EU663: guard dbmate create with shutil.which(), matching the existing pattern for perform_clean(); raises FileNotFoundError with a clear message instead of a confusing FileNotFoundError from subprocess. pkg/cache/cdc_test.go (PR #1241): - PRRT_kwDONV6tZs6EVhVS: increase chunkingDelay 500ms→1s to reduce flakiness under -race on loaded CI. pkg/cache/cache_distributed_test.go (PR #1244): - PRRT_kwDONV6tZs6EVZVc: replace Lock+200ms timeout with TryLock (non-blocking) for lock-contention check; deterministic and immune to slow Redis round-trips. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Continuation of the integration-test wall-time work. Builds on the
fix(ncps): close dbClient on shutdown commit, which already removed
~16s of DROP DATABASE wait. This commit picks off the remaining
named integration outliers:
pkg/storage/s3 TestNew_BucketAccessError (5.22s -> ~0s):
exponential-backoff retry loop (~5s before giving up). Replace
with s3ErrorResponse() so the SDK gives up immediately on the
non-retryable 403. The production wrapper at s3.go:95 already
wraps any non-nil err with "error testing bucket access", so the
Contains() assertion still passes. The now-unused
errTestingBucketAccess sentinel is removed.
pkg/cache TestDistributedBackends/.../LockFailover (4.51s -> ~1s
each, x3 backends):
"second locker fails while first holds the lock" check is sound.
wall time.
pkg/cache TestDistributedBackends/.../LargeNARConcurrentDownload
(5.4s -> ~1s each, x3 backends):
download coordination, not raw throughput; 256 KiB still trips
CDC chunking and keeps the lock dance honest.
that follower goroutines arrive while the first download is in
flight, and goroutine scheduling latency is sub-millisecond on a
quiet machine.
pkg/lock/redis TestLocker_LockExpiry (2.01s -> ~0.6s):
expiry is millisecond-granular; 400ms is plenty of safety.
pkg/lock/redis TestLocker_DegradedModeDisabled (1.72s -> ~0.5s):
go-redis default DialTimeout (5s) per attempt. Wrap ctx in a
500ms WithTimeout so the failure surfaces fast — matches the
same fix already applied to TestNewLocker_ReturnType.
Skipped intentionally:
iterations to catch a concurrency race) — same policy as the
chunker race test; reducing iterations weakens the safety net.
Cumulative integration-test wall time (full suite, all deps live):
~64.40s -> ~58.99s after this commit. Combined with the previous
dbClient fix, integration baseline 80.09s -> 58.99s (~26% lower).
Captures the post-batch profile under
openspec/changes/less-tests/integration-after-batch5-timings.txt.
Verified: `go test -race` on every touched package passes;
`golangci-lint run` is clean.