Skip to content

Commit a190aab

Browse files
craig[bot]pav-kv
andcommitted
148917: kvcoord: add logging in TestWaiterOnRejectedCommit r=tbg a=pav-kv This should help debugging/deflaking this test should it fail again. The conjecture is that we end up with more than one command ID, and only one gets the injected error, while another one succeeds. Informs #148910 148932: kvcoord: deflake TestGetFirstRangeDescriptor r=tbg a=pav-kv Make sure the gossip network is established before running the gossip simulation loop. Fixes #148900 Co-authored-by: Pavel Kalinnikov <[email protected]>
3 parents 561e406 + 71720c3 + ef95d68 commit a190aab

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

pkg/kv/kvclient/kvcoord/dist_sender_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,11 @@ func TestGetFirstRangeDescriptor(t *testing.T) {
20722072
node.Gossip.EnableSimulationCycler(false)
20732073
}
20742074
n.Start()
2075+
// Make sure the first two nodes are connected via gossip.
2076+
n.SimulateNetwork(func(_ int, _ *simulation.Network) bool { return false })
2077+
<-n.Nodes[0].Gossip.Connected
2078+
<-n.Nodes[1].Gossip.Connected
2079+
20752080
ds := NewDistSender(DistSenderConfig{
20762081
AmbientCtx: log.MakeTestingAmbientContext(stopper.Tracer()),
20772082
NodeDescs: n.Nodes[0].Gossip,

pkg/kv/kvclient/kvcoord/integration_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func TestWaiterOnRejectedCommit(t *testing.T) {
8585
if !ba.Txn.ID.Equal(v.(uuid.UUID)) {
8686
return nil
8787
}
88+
t.Logf("EndTxn command ID: %v", args.CmdID)
8889
commitCmdID.Store(args.CmdID)
8990
return nil
9091
},
@@ -99,10 +100,12 @@ func TestWaiterOnRejectedCommit(t *testing.T) {
99100
if args.CmdID == cmdID {
100101
if illegalLeaseIndex {
101102
illegalLeaseIndex = false
102-
// NB: 1 is proposalIllegalLeaseIndex.
103+
t.Logf("injecting illegal lease index for %v", cmdID)
104+
// NB: 1 is ProposalRejectionIllegalLeaseIndex.
103105
return 1, kvpb.NewErrorf("test injected err (illegal lease index)")
104106
}
105-
// NB: 0 is proposalNoReevaluation.
107+
t.Logf("injecting permanent rejection for %v", cmdID)
108+
// NB: 0 is ProposalRejectionPermanent.
106109
return 0, kvpb.NewErrorf("test injected err")
107110
}
108111
return 0, nil
@@ -162,6 +165,7 @@ func TestWaiterOnRejectedCommit(t *testing.T) {
162165
t.Fatal(err)
163166
}
164167
}
168+
t.Logf("txn ID: %v", txn.ID())
165169
txnID.Store(txn.ID())
166170

167171
readerDone := make(chan error, 2)

0 commit comments

Comments
 (0)