Skip to content
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

Report correct consumer count in paged list response #4339

Merged
merged 1 commit into from Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/jetstream_cluster.go
Expand Up @@ -6524,7 +6524,7 @@ LOOP:
})
}

resp.Total = len(resp.Consumers)
resp.Total = ocnt
resp.Limit = JSApiListLimit
resp.Offset = offset
resp.Missing = missingNames
Expand Down
10 changes: 10 additions & 0 deletions server/norace_test.go
Expand Up @@ -5387,6 +5387,9 @@ func TestNoRaceJetStreamClusterConsumerListPaging(t *testing.T) {
if resp.Limit < len(resp.Consumers) {
t.Fatalf("Expected total limited to %d but got %d", resp.Limit, len(resp.Consumers))
}
if resp.Total != numConsumers {
t.Fatalf("Invalid total response: expected %d got %d", numConsumers, resp.Total)
}
return resp.Consumers
}

Expand Down Expand Up @@ -5416,6 +5419,9 @@ func TestNoRaceJetStreamClusterConsumerListPaging(t *testing.T) {
if resp.Limit < len(resp.Consumers) {
t.Fatalf("Expected total limited to %d but got %d", resp.Limit, len(resp.Consumers))
}
if resp.Total != numConsumers {
t.Fatalf("Invalid total response: expected %d got %d", numConsumers, resp.Total)
}
return resp.Consumers
}

Expand All @@ -5432,6 +5438,10 @@ func TestNoRaceJetStreamClusterConsumerListPaging(t *testing.T) {
results[name] = true
}
}

if len(results) != numConsumers {
t.Fatalf("Received %d / %d consumers", len(results), numConsumers)
}
}

func TestNoRaceJetStreamFileStoreLargeKVAccessTiming(t *testing.T) {
Expand Down