-
Notifications
You must be signed in to change notification settings - Fork 4k
jobs/frontier: add randomized frontier test #153458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
} | ||
|
||
func checkSpanFrontierEquality(t *testing.T, expected span.Frontier, actual span.Frontier) { | ||
for eSp, eTs := range expected.Entries() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop technically only checks that expected
is a subset of actual
. Should we also assert that the number of entries is the same (maybe with .Len()
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. added a len check.
require.NoError(t, err) | ||
} | ||
|
||
jobID := jobspb.JobID(3000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if you want to keep the trend of each test in this file generating different job IDs, consider making this 4000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that really adds any test coverage. each test uses its own test server.
newTs := hlc.Timestamp{WallTime: int64(rng.Intn(4))} | ||
|
||
// Only update if new timestamp is greater (frontiers only move forward) | ||
if initialTimestamps[spanIdx].Less(newTs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You technically don't need to do this check since Forward
will no-op if you're not forwarding to a later time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right! removed that check and it simplifies things slightly.
Epic: none Release note: none
68ee697
to
b4e47cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the close review!
require.NoError(t, err) | ||
} | ||
|
||
jobID := jobspb.JobID(3000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that really adds any test coverage. each test uses its own test server.
newTs := hlc.Timestamp{WallTime: int64(rng.Intn(4))} | ||
|
||
// Only update if new timestamp is greater (frontiers only move forward) | ||
if initialTimestamps[spanIdx].Less(newTs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right! removed that check and it simplifies things slightly.
} | ||
|
||
func checkSpanFrontierEquality(t *testing.T, expected span.Frontier, actual span.Frontier) { | ||
for eSp, eTs := range expected.Entries() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. added a len check.
Epic: none
Release note: none