Skip to content
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

Merged

Conversation

johanbrandhorst
Copy link
Collaborator

@johanbrandhorst johanbrandhorst commented Oct 16, 2023

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.

rt.LastItemId = res.GetPublicId()
rt.LastItemUpdatedTime = res.GetUpdateTime().AsTime()
rt = rt.Refresh(updatedTime)
Copy link
Collaborator Author

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

Comment on lines +10 to +12
ListDeletedIds = (*Repository).listDeletedIds
EstimatedCount = (*Repository).estimatedCount
ListTargets = (*Repository).listTargets
Copy link
Collaborator Author

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)
}
Copy link
Collaborator Author

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())
}
}
Copy link
Collaborator Author

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

@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-targets-review-comments branch from a6d9230 to 7325ef8 Compare October 16, 2023 22:11
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.
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-targets-review-comments branch from 7325ef8 to fb6af37 Compare October 16, 2023 22:48
This doesn't actually match any Postgres setting
we configure.
Comment on lines 84 to 85
// Refresh refreshes a token's updated time. It accounts for database
// transaction inaccuracies by subtracting UpdatedTimeBuffer from the
Copy link
Member

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.

Copy link
Collaborator Author

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.

@johanbrandhorst johanbrandhorst merged commit 1debd83 into llb-list-pagination Oct 17, 2023
47 checks passed
@johanbrandhorst johanbrandhorst deleted the jbrandhorst-targets-review-comments branch October 17, 2023 21:03
johanbrandhorst added a commit that referenced this pull request Oct 23, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants