-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add database and tests #32
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
denisonbarbosa
approved these changes
Sep 14, 2023
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.
Wow, this is a big one. Nice work! Some comments, but definitely nothing blocking.
The cache package is responsible for handling a database of users/groups cached for nss. This allows preventing calling the broker for each nss requests. Handle update/get different modules, while keeping the database small and performant. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
This is only for tests to allow loading/unloading with known time in advance. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
…iles We were basically allowing cleaning up dirty while db transaction were in progress. Prevent from this possibility by having all database transactions are read ones, and changing the files/reopening the database is write. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
We want to avoid a race between Close() and cleaning up the associated database goroutine. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
We only remove one file, let’s remove it directly and ignore unexisting ones. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
This we be reused and exported in the tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
* Export needed arguments. * First set of subtests, including cleaning. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Ensure that we treat invalid database content right away, clearing as necessary. Factor out cleaning code in the goroutine, ensuring that we are giving it some retry period. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
We had the case where the new cache was returned, then an update is called BEFORE the cleanup goroutine was started, resulting in any invalid entries triggering the cleanup process but dropping the request. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
This will be shared across tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Thanks to the tests! Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Illustrate cases where we can recover and those were we can’t. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
We are using slog Co-authored-by: Jean-Baptiste Lallement <[email protected]>
This will be reused across tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Let’s ensure the database only contains expected and known buckets. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Buckets are automatically added to existing database, add a test case for this. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Add tests for getting users by id/name/all. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Tests for getting them by gid/name/all. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Supports go 1.21.0. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Forced pushed as you approved (the clean -> clear change has been an interesting long rebase fight :))! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cover creation/additions/getting users and groups from the database.
This will be hooked into PAM and NSS for respectively adding and getting informations to return them in the expected form there.
UDENG-1367