Skip to content

Commit

Permalink
Merge pull request #138744 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.2-132966

release-24.2: kv: wait for leaseholder to apply lease upgrade in TestStoreCapacityAfterSplit
  • Loading branch information
arulajmani authored Jan 9, 2025
2 parents a8135cb + 8fbec7d commit 1c831e4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pkg/kv/kvserver/client_split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3267,7 +3267,23 @@ func TestStoreCapacityAfterSplit(t *testing.T) {
key := tc.ScratchRange(t)
desc := tc.AddVotersOrFatal(t, key, tc.Target(1))
tc.TransferRangeLeaseOrFatal(t, desc, tc.Target(1))
tc.WaitForLeaseUpgrade(ctx, t, desc)

// Wait for the lease transfer to be applied on the new leaseholder and then
// to be upgraded from an expiration-based lease.
testutils.SucceedsSoon(t, func() error {
repl, err := s.GetReplica(desc.RangeID)
if err != nil {
return err
}
l, _ := repl.GetLease()
if !l.OwnedBy(s.StoreID()) {
return errors.Errorf("lease transfer not applied on leaseholder")
}
if l.Type() == roachpb.LeaseExpiration {
return errors.Errorf("lease still an expiration based lease")
}
return nil
})

cap, err := s.Capacity(ctx, false /* useCached */)
if err != nil {
Expand Down

0 comments on commit 1c831e4

Please sign in to comment.