Skip to content

De-flake various tests - #8703

Merged
neilalexander merged 15 commits into
mainfrom
maurice/deflakes
Oct 5, 2026
Merged

neilalexander merged 15 commits into
mainfrom
maurice/deflakes

Conversation

@MauriceVanVeen

Copy link
Copy Markdown
Member

No description provided.

@MauriceVanVeen
MauriceVanVeen requested a review from a team as a code owner October 2, 2026 15:23
@synadia-claude-reviewer

synadia-claude-reviewer Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Claude finished @MauriceVanVeen's task in 1m 20s —— View job


Review of PR #8703 — De-flake various tests

  • Fetch PR diff and description
  • Review each changed file for correctness, concurrency, security
  • Check for inline issues
  • Post summary review

Summary: This PR fixes test flakiness plus one small production bug in server/jetstream_cluster.go/server/stream.go.

Production change (matchSourceIndexNames)

  • server/jetstream_cluster.go:6958 now calls the newly extracted matchSourceIndexNames(sa.Config, osa.Config) under js.mu.Lock()/Unlock() before the reflect.DeepEqual short-circuit check in processClusterCreateStream. This mirrors the existing logic already used in jsClusteredStreamRequest (which holds js.mu for its whole body), so the locking is consistent and not nested/double-locked — I checked the surrounding RLock/Lock blocks and they're sequential, not nested.
  • Root cause this addresses: previously the index name (iname) on sourced streams wasn't reconciled before the DeepEqual check here, so an idempotent AddStream could fail to short-circuit after a leader change (since iname isn't part of the wire-encoded config), causing the reported timeout. The fix looks correct and properly scoped.

Test changes

  • TestFileStoreAccessTimeSpinUp (filestore_test.go): switches from a flat NumGoroutine() comparison to counting only ats.Register.func* goroutines via stack dump, correctly accounting for the fact that ats registration is a process-wide singleton shared across parallel tests. Confirmed the goroutine name substring matches the actual closure in server/ats/ats.go.
  • TestJetStreamClusteredStreamCreateIdempotentWithSources (jetstream_cluster_3_test.go): reworked to step leadership through every server (not just directly to the meta leader) and retry step-downs since leadership transfer is best-effort; also asserts iname is populated on all servers before the idempotent-create assertion. Logic reads correctly, using errNotLeader (defined in raft.go) as an expected/retryable error.
  • TestJetStreamClusterStreamAdvisories, TestJetStreamAllowMsgCounter, TestNoRaceJetStreamFileStoreLargeKVAccessTiming, TestNoRaceSeqSetRelativeSpeed: all reasonable retry/threshold relaxations for timing- and propagation-sensitive assertions. The AVL test's 3x→5x threshold loosening slightly weakens the performance regression check but is a defensible tradeoff for CI stability.

No correctness, concurrency, or security issues found. No inline comments posted.

@neilalexander neilalexander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Maurice van Veen <[email protected]>
Signed-off-by: Maurice van Veen <[email protected]>

@neilalexander neilalexander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neilalexander
neilalexander merged commit f52fafc into main Oct 5, 2026
88 of 91 checks passed
@neilalexander
neilalexander deleted the maurice/deflakes branch October 5, 2026 12:33
neilalexander added a commit that referenced this pull request Oct 6, 2026
neilalexander added a commit that referenced this pull request Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants