Skip to content

Commit 0da69c8

Browse files
author
Tyler Reid
committed
Change username to userId
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
1 parent b89016c commit 0da69c8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/distributor/ha_tracker_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ func TestHATracker_MetricsCleanup(t *testing.T) {
661661
func TestCheckReplicaCleanup(t *testing.T) {
662662
replica := "r1"
663663
cluster := "c1"
664-
userName := "user"
665-
ctx := user.InjectOrgID(context.Background(), userName)
664+
userId := "user"
665+
ctx := user.InjectOrgID(context.Background(), userId)
666666

667667
reg := prometheus.NewPedanticRegistry()
668668

@@ -680,32 +680,32 @@ func TestCheckReplicaCleanup(t *testing.T) {
680680

681681
now := time.Now()
682682

683-
err = c.checkReplica(context.Background(), userName, cluster, replica, now)
683+
err = c.checkReplica(context.Background(), userId, cluster, replica, now)
684684
assert.NoError(t, err)
685-
checkReplicaTimestamp(t, time.Second, c, userName, cluster, replica, now)
685+
checkReplicaTimestamp(t, time.Second, c, userId, cluster, replica, now)
686686

687687
// Replica is not marked for deletion yet.
688-
checkReplicaDeletionState(t, time.Second, c, userName, cluster, true, true, false)
688+
checkReplicaDeletionState(t, time.Second, c, userId, cluster, true, true, false)
689689

690690
// This will mark replica for deletion (with time.Now())
691691
c.cleanupOldReplicas(ctx, now.Add(1*time.Second))
692692

693693
// Verify marking for deletion.
694-
checkReplicaDeletionState(t, time.Second, c, userName, cluster, false, true, true)
694+
checkReplicaDeletionState(t, time.Second, c, userId, cluster, false, true, true)
695695

696696
// This will "revive" the replica.
697697
now = time.Now()
698-
err = c.checkReplica(context.Background(), userName, cluster, replica, now)
698+
err = c.checkReplica(context.Background(), userId, cluster, replica, now)
699699
assert.NoError(t, err)
700-
checkReplicaTimestamp(t, time.Second, c, userName, cluster, replica, now) // This also checks that entry is not marked for deletion.
700+
checkReplicaTimestamp(t, time.Second, c, userId, cluster, replica, now) // This also checks that entry is not marked for deletion.
701701

702702
// This will mark replica for deletion again (with new time.Now())
703703
c.cleanupOldReplicas(ctx, now.Add(1*time.Second))
704-
checkReplicaDeletionState(t, time.Second, c, userName, cluster, false, true, true)
704+
checkReplicaDeletionState(t, time.Second, c, userId, cluster, false, true, true)
705705

706706
// Delete entry marked for deletion completely.
707707
c.cleanupOldReplicas(ctx, time.Now().Add(5*time.Second))
708-
checkReplicaDeletionState(t, time.Second, c, userName, cluster, false, false, false)
708+
checkReplicaDeletionState(t, time.Second, c, userId, cluster, false, false, false)
709709

710710
require.NoError(t, testutil.GatherAndCompare(reg, strings.NewReader(`
711711
# HELP cortex_ha_tracker_replicas_cleanup_marked_for_deletion_total Number of elected replicas marked for deletion.

0 commit comments

Comments
 (0)