-
Notifications
You must be signed in to change notification settings - Fork 3.9k
chore: separate out tests for GetPartitionConsumers #17288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: separate out tests for GetPartitionConsumers #17288
Conversation
This commit separates out the tests for GetPartitionConsumers from GetStreamUsage, and adds separate tests to assert the expected behavior of GetPartitionConsumers and the expected behavior of the cache.
| } | ||
|
|
||
| func (g *RingStreamUsageGatherer) getPartitionConsumers(ctx context.Context, rs ring.ReplicationSet) (map[int32]string, error) { | ||
| func (g *RingStreamUsageGatherer) getPartitionConsumers(ctx context.Context, instances []ring.InstanceDesc) (map[int32]string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will using this for zone-awareness.
| } | ||
| } | ||
|
|
||
| func TestRingStreamUsageGatherer_GetPartitionConsumers_CacheHitsAndMisses(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splitting out this test will make it easier to test zone awareness.
| const numPartitions = 2 // Using 2 partitions for simplicity in tests | ||
| const cacheTTL = 1 * time.Second | ||
|
|
||
| func TestRingStreamUsageGatherer_GetPartitionConsumers(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to test GetPartitionConsumers, as that is where the cache is used.
c5fd1d8 to
b58fbcb
Compare
What this PR does / why we need it:
This commit separates out the tests for GetPartitionConsumers from GetStreamUsage, and adds separate tests to assert the expected behavior of GetPartitionConsumers and the expected behavior of the cache.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Checklist
CONTRIBUTING.mdguide (required)featPRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.mddeprecated-config.yamlanddeleted-config.yamlfiles respectively in thetools/deprecated-config-checkerdirectory. Example PR