Skip to content

Commit

Permalink
roachpb: test GCHint.ForwardLatestRangeDeleteTimestamp
Browse files Browse the repository at this point in the history
Epic: none
Release note: none
  • Loading branch information
pav-kv committed Sep 14, 2023
1 parent 5859a70 commit 3734a1a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/roachpb/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,25 @@ func TestGCHint(t *testing.T) {
assert.Equal(t, tc.want, hint)
})
}

for _, tc := range []struct {
was GCHint
add hlc.Timestamp
want GCHint
}{
{was: GCHint{}, add: empty, want: GCHint{}},
{was: hint(ts2, empty, empty), add: empty, want: hint(ts2, empty, empty)},
{was: hint(ts2, empty, empty), add: ts1, want: hint(ts2, empty, empty)},
{was: hint(ts2, empty, empty), add: ts2, want: hint(ts2, empty, empty)},
{was: hint(ts2, empty, empty), add: ts3, want: hint(ts3, empty, empty)},
} {
t.Run("ForwardLatestRangeDeleteTimestamp", func(t *testing.T) {
hint := tc.was
checkInvariants(t, hint)
updated := hint.ForwardLatestRangeDeleteTimestamp(tc.add)
checkInvariants(t, hint)
assert.Equal(t, !hint.Equal(tc.was), updated, "returned incorrect 'updated' bit")
assert.Equal(t, tc.want, hint)
})
}
}

0 comments on commit 3734a1a

Please sign in to comment.