-
Notifications
You must be signed in to change notification settings - Fork 291
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
Target listing review comments #3848
Target listing review comments #3848
Conversation
rt.LastItemId = res.GetPublicId() | ||
rt.LastItemUpdatedTime = res.GetUpdateTime().AsTime() | ||
rt = rt.Refresh(updatedTime) |
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.
Now that Refresh does more than a trivial amount of work, we call it from here instead of copying the logic
ListDeletedIds = (*Repository).listDeletedIds | ||
EstimatedCount = (*Repository).estimatedCount | ||
ListTargets = (*Repository).listTargets |
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.
👨🏻🍳 💋
addr := target.TestNewTargetAddress(id, opts.WithAddress) | ||
err := rw.Create(ctx, addr) | ||
require.NoError(err) | ||
} |
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.
Had to add this to support the WithAddress
option to targettest.
for _, tar := range got { | ||
assert.Equal(t, "1.2.3.4", tar.GetAddress()) | ||
} | ||
} |
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.
These tests were all moved to the target package mostly unchanged
a6d9230
to
7325ef8
Compare
This also adds back the testing of ListDeletedIds and EstimatedCount using the pattern of exporting internal methods to test files only.
Renames all external test files to use the `_ext_test.go` name pattern, making it clear which tests have access to internals of the package and which do not.
7325ef8
to
fb6af37
Compare
This doesn't actually match any Postgres setting we configure.
// Refresh refreshes a token's updated time. It accounts for database | ||
// transaction inaccuracies by subtracting UpdatedTimeBuffer from the |
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 "inaccuracies" is the right word here. It is the nature of a MVCC. There may have been items that have an older update time than updatedTime
that where not visible at the time updatedTime
was returned.
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.
Reworded this slightly, please take a look.
* refreshtoken: handle database buffer * internal/target: unexport ListTargets This also adds back the testing of ListDeletedIds and EstimatedCount using the pattern of exporting internal methods to test files only. * internal/target: rename external test files Renames all external test files to use the `_ext_test.go` name pattern, making it clear which tests have access to internals of the package and which do not. * internal/refreshtoken: remove Postgres timeout reference This doesn't actually match any Postgres setting we configure. * Reword buffer comment
refreshtoken: handle database buffer
internal/target: unexport ListTargets
This also adds back the testing of ListDeletedIds and EstimatedCount using the pattern of exporting internal methods to test files only.