Skip to content

Commit

Permalink
kvserver: de-flake TestReplicaProbeRequest
Browse files Browse the repository at this point in the history
Chanced upon this failure mode in unrelated PR #96781.

Epic: none
Release note: None
  • Loading branch information
tbg committed Feb 8, 2023
1 parent cc99062 commit daf2dad
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions pkg/kv/kvserver/replica_probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,24 @@ func TestReplicaProbeRequest(t *testing.T) {
// stack, with both routing policies.
for _, srv := range tc.Servers {
db := srv.DB()
{
for _, policy := range []roachpb.RoutingPolicy{
roachpb.RoutingPolicy_LEASEHOLDER,
roachpb.RoutingPolicy_NEAREST,
} {
var b kv.Batch
b.AddRawRequest(probeReq)
b.Header.RoutingPolicy = roachpb.RoutingPolicy_LEASEHOLDER
require.NoError(t, db.Run(ctx, &b))
}
{
var b kv.Batch
b.AddRawRequest(probeReq)
b.Header.RoutingPolicy = roachpb.RoutingPolicy_NEAREST
require.NoError(t, db.Run(ctx, &b))
b.Header.RoutingPolicy = policy
err := db.Run(ctx, &b)
if errors.HasType(err, (*roachpb.AmbiguousResultError)(nil)) {
// Rare but it can happen that we're proposing on a replica
// that is just about to get a snapshot. In that case we'll
// get:
//
// result is ambiguous: unable to determine whether command was applied via snapshot
t.Logf("ignoring: %s", err)
err = nil
}
require.NoError(t, err)
}
}
// Check expected number of probes seen on each Replica in the apply loop.
Expand Down

0 comments on commit daf2dad

Please sign in to comment.