Repository navigation
Stabilize flaky collector and JetStream integration tests - #3197
CAOShurong wants to merge 3 commits into
Conversation
Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
|
Integration tests are still flaky. Looks like this PR would not solve the issue |
|
@CAOShurong can you try some other fix for the integration tests |
The OCI collector dropped referrer artifacts when a manifest fetch failed with a transient registry error (timeout, rate limit, connection reset), which made Test_ociCollector_RetrieveArtifacts fail intermittently with '13, want 14'. Manifest fetches are now retried with a short backoff; only a missing manifest (404) is still treated as 'no attestation', and any other persistent error is surfaced to the caller. Also fix the error wrapping in fetchReferrerArtifacts, which wrapped the outer (nil) error instead of the fetch error.
The JetStream emitter could fail to recreate a stream while the NATS server was still finalizing the deletion of the previous one ('nats: error creating store for stream'), which made Test_ProcessSubscribe fail intermittently. Stream creation is now retried a few times with a short delay after deletion.
Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
51b69cb to
e635bc8
Compare
|
Thanks for the nudge. I dug into which tests were still failing on top of the git-collector change and found two separate sources of flakiness, both now fixed in a new commit (e635bc8):
Local validation (all passing):
I'll leave it to CI to confirm. |
|
@CAOShurong the integration tests are still flaky. Your fix doesn't solve the test flakiness |
Signed-off-by: CAOShurong <170531907+CAOShurong@users.noreply.github.com>
|
Integration tests are still flaky even after multiple fixes. I will close this PR. Let's try to understand the root cause in the issue section and then come up with a fix. |
Description of the PR
This removes three sources of nondeterminism from the integration tests tracked in #2930.
1. Git collector test
.gitimplementation files.A recent integration run (32978753396, job 98209847685) timed out after collecting 0 files. On the original base, the polling subtest also failed 20/20 local runs because the checkout contained 10 files while the test hard-coded 9. The updated test passed 50 consecutive runs.
2. OCI collector test (13 vs 14 referrers)
Test_ociCollector_RetrieveArtifacts/get_OCI_referrersintermittently fails withg.RetrieveArtifacts() = 13, want 14(including run 33735694815 after the first retry change). A referrer descriptor points to a concrete manifest, but registry replicas can briefly return not found while converging. The previous retry implementation immediately acceptedErrNotFoundas a permanent absence, so that transient response still dropped one of the 14 expected documents.The updated fix:
ErrNotFoundafter all attempts as the existing “no attestation” case.The earlier change also fixes a latent error-wrapping bug in
fetchReferrerArtifacts: the error channel received the outererrvalue rather than the actual fetch errore.3. JetStream emitter stream-recreate race
Test_ProcessSubscribeintermittently fails withunexpected error recreating jetstream: failed to create stream: nats: error creating store for stream(for example, main run 33452015674). Each subtest deletes and recreates theDOCUMENTSstream, and the NATS server can still be finalizing deletion of the old stream's store.RecreateStreamnow retries stream creation five times with a short delay.Validation
go test -run TestGetManifestWithRetry -count=10 ./pkg/handler/collector/oci/go test ./pkg/handler/collector/oci/...go test -tags integration -run 'Test_ociCollector_RetrieveArtifacts/get_OCI_referrers' -count=30 ./pkg/handler/collector/oci/(live registry, 30 consecutive passes)go test -tags integration -run Test_ProcessSubscribe -count=5 ./pkg/handler/processor/process/go test -tags integration -count=3 ./pkg/handler/collector/git/go test ./pkg/emitter/...go vet ./pkg/handler/collector/oci/... ./pkg/emitter/...git diff --checkThe broader collector suite still has pre-existing Windows-only path-separator failures in file-collector tests; those reproduce unchanged on the base and are outside this PR.
Implementation and investigation were assisted by OpenAI Codex. I reviewed the diff and ran the validation above.
PR Checklist
git commit -s.collectsubprotobuf is unchanged