You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CI uses the latest (head) server. 2.15 has a change where creating a consumer when a stream does not set the max_consumers limits the number of consumers to 1000. This fixes a test that specifically creates more than 1024 consumer to test the paging ability of the js management getConsumers call.
PR Review: Fix test to respect server 2.15 change to max_consumers behavior
Tasks
Gather context and read changed files
Understand the behavioral change being addressed
Review the fix for correctness and completeness
Summary
This is a targeted, minimal test fix. The change is correct.
Root cause: NATS server 2.15 introduced a stricter enforcement of max_consumers. Previously, TestingStreamContainer created a stream via createMemoryStream() with no explicit maxConsumers, which defaults to -1 (unlimited in older servers). Under server 2.15, the effective default appears to be lower than 1100, causing the test to fail when trying to add 600 + 500 = 1100 consumers.
Fix: Explicitly create the stream with maxConsumers(10000), giving the test ample headroom above the 1100 consumers it creates.
No Issues Found
The fix is clean:
Uses stream() and subject() helpers consistently with the rest of the test base
Preserves StorageType.Memory (consistent with the old createMemoryStream() path)
All tsc.stream references are correctly replaced with the local stream variable
The assertions (assertEquals(600, ...) and assertEquals(1100, ...)) are unchanged — the test logic itself is unaffected
The choice of 10000 provides generous headroom over the 1100 consumers the test actually creates, and is not so large as to be unreasonable.
No correctness, security, or performance concerns.
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
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.
The CI uses the latest (head) server. 2.15 has a change where creating a consumer when a stream does not set the max_consumers limits the number of consumers to 1000. This fixes a test that specifically creates more than 1024 consumer to test the paging ability of the js management getConsumers call.