Skip to content

Commit

Permalink
Change per subject amounts based on feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Feb 1, 2022
1 parent 222fa5e commit 4057363
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions server/jetstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14665,10 +14665,10 @@ func TestJetStreamStreamInfoNumSubjects(t *testing.T) {
require_NoError(t, err)
defer js.DeleteStream("TEST")

msg := []byte("ok")
// Now place 60 msgs. 20x each of foo, bar and baz.
for i := 0; i < 20; i++ {
for _, subj := range []string{"foo", "bar", "baz"} {
counts, msg := []int{22, 33, 44}, []byte("ok")
// Now place msgs, foo-22, bar-33 and baz-44.
for i, subj := range []string{"foo", "bar", "baz"} {
for n := 0; n < counts[i]; n++ {
_, err = js.Publish(subj, msg)
require_NoError(t, err)
}
Expand Down Expand Up @@ -14723,25 +14723,25 @@ func TestJetStreamStreamInfoSubjectsDetails(t *testing.T) {
require_NoError(t, err)
defer js.DeleteStream("TEST")

msg := []byte("ok")
// Now place 60 msgs. 20x each of foo, bar and baz.
for i := 0; i < 20; i++ {
for _, subj := range []string{"foo", "bar", "baz"} {
counts, msg := []int{22, 33, 44}, []byte("ok")
// Now place msgs, foo-22, bar-33 and baz-44.
for i, subj := range []string{"foo", "bar", "baz"} {
for n := 0; n < counts[i]; n++ {
_, err = js.Publish(subj, msg)
require_NoError(t, err)
}
}

// Test all subjects first.
expected := map[string]uint64{"foo": 20, "bar": 20, "baz": 20}
expected := map[string]uint64{"foo": 22, "bar": 33, "baz": 44}
if si := getInfo(nats.AllKeys); !reflect.DeepEqual(si.State.Subjects, expected) {
t.Fatalf("Expected subjects of %+v, but got %+v", expected, si.State.Subjects)
}
if si := getInfo("*"); !reflect.DeepEqual(si.State.Subjects, expected) {
t.Fatalf("Expected subjects of %+v, but got %+v", expected, si.State.Subjects)
}
// Filtered to 1.
expected = map[string]uint64{"foo": 20}
expected = map[string]uint64{"foo": 22}
if si := getInfo("foo"); !reflect.DeepEqual(si.State.Subjects, expected) {
t.Fatalf("Expected subjects of %+v, but got %+v", expected, si.State.Subjects)
}
Expand Down

0 comments on commit 4057363

Please sign in to comment.