Skip to content

Commit 1e179ec

Browse files
committed
added test cases
Signed-off-by: Shashank <[email protected]>
1 parent 2edc9b9 commit 1e179ec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/storegateway/sharding_strategy_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ func TestDefaultShardingStrategy(t *testing.T) {
4141
zoneAwarenessEnabled bool
4242
setupRing func(*ring.Desc)
4343
expectedBlocks map[string][]ulid.ULID
44+
enableTenants []string
45+
disableTenants []string
4446
}{
4547
"one ACTIVE instance in the ring with replication factor = 1": {
4648
replicationFactor: 1,
@@ -63,6 +65,19 @@ func TestDefaultShardingStrategy(t *testing.T) {
6365
"127.0.0.2": {block2, block4},
6466
},
6567
},
68+
"two ACTIVE instances in the ring with replication factor = 1 and one tenant disabled": {
69+
replicationFactor: 1,
70+
setupRing: func(r *ring.Desc) {
71+
r.AddIngester("instance-1", "127.0.0.1", "", []uint32{block1Hash + 1, block3Hash + 1}, ring.ACTIVE, registeredAt)
72+
r.AddIngester("instance-2", "127.0.0.2", "", []uint32{block2Hash + 1, block4Hash + 1}, ring.ACTIVE, registeredAt)
73+
},
74+
enableTenants: []string{"instance-1"},
75+
disableTenants: []string{"instance-2"},
76+
expectedBlocks: map[string][]ulid.ULID{
77+
"127.0.0.1": {block1, block3}, // Tenant 1 blocks expected
78+
"127.0.0.2": {}, // Tenant 2 blocks disabled
79+
},
80+
},
6681
"one ACTIVE instance in the ring with replication factor = 2": {
6782
replicationFactor: 2,
6883
setupRing: func(r *ring.Desc) {

0 commit comments

Comments
 (0)