Skip to content

Commit a960b84

Browse files
committed
server: set vmodule logs for TestDecommissionSelf
This commit adds more logs in `TestDecommissionSelf` to help debug its test flakes.
1 parent cf01ffa commit a960b84

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

pkg/server/storage_api/decommission_test.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ func TestDecommissionSelf(t *testing.T) {
655655
skip.UnderDeadlockWithIssue(t, 112918)
656656

657657
// Set up test cluster.
658+
testutils.SetVModule(t, "queue=5,replicate_queue=5,replica_command=5,replicate=5,replica=5,allocator=3,decommission=5")
658659
ctx := context.Background()
659660
tc := serverutils.StartCluster(t, 7, base.TestClusterArgs{
660661
ServerArgs: base.TestServerArgs{
@@ -681,10 +682,12 @@ func TestDecommissionSelf(t *testing.T) {
681682
NodeIDs: decomNodeIDs,
682683
TargetMembership: livenesspb.MembershipStatus_DECOMMISSIONING,
683684
})
685+
log.Dev.Infof(ctx, "setting nodes %v to decommissioning, got %d status responses", decomNodeIDs, len(resp.Status))
684686
require.NoError(t, err)
685687
require.Len(t, resp.Status, len(decomNodeIDs))
686688
for i, nodeID := range decomNodeIDs {
687689
status := resp.Status[i]
690+
log.Dev.Infof(ctx, "node %d has status: %v", nodeID, status)
688691
require.Equal(t, nodeID, status.NodeID)
689692
// Liveness entries may not have been updated yet.
690693
require.Contains(t, []livenesspb.MembershipStatus{
@@ -699,6 +702,7 @@ func TestDecommissionSelf(t *testing.T) {
699702
NodeIDs: decomNodeIDs,
700703
TargetMembership: livenesspb.MembershipStatus_DECOMMISSIONED,
701704
})
705+
log.Dev.Infof(ctx, "setting nodes %v to decommissioned, got %d status responses", decomNodeIDs, len(resp.Status))
702706
require.NoError(t, err)
703707
require.Empty(t, resp.Status)
704708

@@ -713,9 +717,20 @@ func TestDecommissionSelf(t *testing.T) {
713717
}
714718
}
715719
require.Eventually(t, func() bool {
716-
liveness, ok := srv.NodeLiveness().(*liveness.NodeLiveness).GetLiveness(srv.NodeID())
717-
return ok && liveness.Membership == expect
718-
}, 5*time.Second, 100*time.Millisecond, "timed out waiting for node %v status %v", i, expect)
720+
nodeLiveness := srv.NodeLiveness().(*liveness.NodeLiveness)
721+
if nodeLiveness == nil {
722+
log.Dev.Infof(ctx, "node %d liveness is nil", srv.NodeID())
723+
return false
724+
}
725+
liveness, ok := nodeLiveness.GetLiveness(srv.NodeID())
726+
livenessFromCache := nodeLiveness.GetNodeVitalityFromCache(srv.NodeID())
727+
if !ok || liveness.Membership != expect {
728+
log.Dev.Infof(ctx, "node %d: found=%v, current=%v, expected=%v, livenessFromCache=%v", srv.NodeID(), ok, liveness.Membership, expect, livenessFromCache)
729+
return false
730+
}
731+
log.Dev.Infof(ctx, "node %d found expected status %v, livenessFromCache: %v", srv.NodeID(), expect, livenessFromCache)
732+
return true
733+
}, 5*time.Second, 100*time.Millisecond, "timed out waiting for node %v status %v", srv.NodeID(), expect)
719734
}
720735
}
721736

0 commit comments

Comments
 (0)