Skip to content

Commit 3a74547

Browse files
committed
Fix stats test
1 parent 3dd50ee commit 3a74547

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

client/client_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ func TestClient_Stats(t *testing.T) {
623623
if err != nil {
624624
t.Fatalf("Expected nil. Got: %v", err)
625625
}
626+
627+
var totalByKeyCount int
626628
var total int
627629
for partID, part := range s.Partitions {
628630
total += part.TotalKeyCount
@@ -633,13 +635,17 @@ func TestClient_Stats(t *testing.T) {
633635
t.Fatalf("Expected PreviosOwners list is empty. "+
634636
"Got: %v for PartID: %d", part.PreviousOwners, partID)
635637
}
636-
if part.KeyCount != 1 {
637-
t.Fatalf("Expected DMap count: 1. Got: %d", part.KeyCount)
638+
if part.KeyCount <= 0 {
639+
t.Fatalf("Expected KeyCount is bigger than 0. Got: %d", part.KeyCount)
638640
}
641+
totalByKeyCount += part.KeyCount
639642
if part.Owner.String() != addr {
640643
t.Fatalf("Expected partition owner: %s. Got: %s", addr, part.Owner)
641644
}
642645
}
646+
if totalByKeyCount != 100 {
647+
t.Fatalf("Expected total key count in stats is 100. Got: %d", total)
648+
}
643649
if total != 100 {
644650
t.Fatalf("Expected total key count in stats is 100. Got: %d", total)
645651
}

0 commit comments

Comments
 (0)