@@ -42,6 +42,9 @@ func TestDefaultShardingStrategy(t *testing.T) {
42
42
zoneAwarenessEnabled bool
43
43
setupRing func (* ring.Desc )
44
44
expectedBlocks map [string ][]ulid.ULID
45
+ enableTenants []string
46
+ disableTenants []string
47
+ allowedTenants func (* DefaultShardingStrategy )
45
48
}{
46
49
"one ACTIVE instance in the ring with replication factor = 1" : {
47
50
replicationFactor : 1 ,
@@ -64,6 +67,21 @@ func TestDefaultShardingStrategy(t *testing.T) {
64
67
"127.0.0.2" : {block2 , block4 },
65
68
},
66
69
},
70
+ "two ACTIVE instances in the ring with replication factor = 1 and one tenant disabled" : {
71
+ replicationFactor : 1 ,
72
+ setupRing : func (r * ring.Desc ) {
73
+ r .AddIngester ("instance-1" , "127.0.0.1" , "" , []uint32 {block1Hash + 1 , block3Hash + 1 }, ring .ACTIVE , registeredAt )
74
+ r .AddIngester ("instance-2" , "127.0.0.2" , "" , []uint32 {block2Hash + 1 , block4Hash + 1 }, ring .ACTIVE , registeredAt )
75
+ },
76
+ allowedTenants : func (r * DefaultShardingStrategy ) {
77
+ enableTenants: []string {"u-1" }
78
+ r .FilterUsers (context .Background (), enableTenants )
79
+ },
80
+ expectedBlocks : map [string ][]ulid.ULID {
81
+ "127.0.0.1" : {block1 , block3 }, // Tenant 1 blocks expected
82
+ "127.0.0.2" : {}, // Tenant 2 blocks disabled
83
+ },
84
+ },
67
85
"one ACTIVE instance in the ring with replication factor = 2" : {
68
86
replicationFactor : 2 ,
69
87
setupRing : func (r * ring.Desc ) {
0 commit comments