-
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
Commits on Sep 14, 2023
-
Implement database cache handling
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]>
Configuration menu - View commit details
-
Copy full SHA for ee3248f - Browse repository at this point
Copy the full SHA ee3248fView commit details -
Allow serialize/deserialize database with redacted time.
This is only for tests to allow loading/unloading with known time in advance. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2cc3690 - Browse repository at this point
Copy the full SHA 2cc3690View commit details -
Ensure that we don't use the database while cleaning the underlying f…
…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]>
Configuration menu - View commit details
-
Copy full SHA for bee270f - Browse repository at this point
Copy the full SHA bee270fView commit details -
Ensure that close finishes once the cleanup goroutine is done
We want to avoid a race between Close() and cleaning up the associated database goroutine. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 64141b6 - Browse repository at this point
Copy the full SHA 64141b6View commit details -
Use Remove instead of RemoveAll to clean dirty database.
We only remove one file, let’s remove it directly and ignore unexisting ones. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 47abc7b - Browse repository at this point
Copy the full SHA 47abc7bView commit details -
Derive dirty flag name from constant
This we be reused and exported in the tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4cef0b4 - Browse repository at this point
Copy the full SHA 4cef0b4View commit details -
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8653427 - Browse repository at this point
Copy the full SHA 8653427View commit details -
First set of TestNew() subtests
* Export needed arguments. * First set of subtests, including cleaning. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4a1419d - Browse repository at this point
Copy the full SHA 4a1419dView commit details -
Refresh golden files for TestNew()
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e501b8b - Browse repository at this point
Copy the full SHA e501b8bView commit details -
Make initial database clear up more robust
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]>
Configuration menu - View commit details
-
Copy full SHA for f148853 - Browse repository at this point
Copy the full SHA f148853View commit details -
Adapt and add tests to new clear up behaviour in New()
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a4de4c0 - Browse repository at this point
Copy the full SHA a4de4c0View commit details -
Ensure the cleanup goroutine has started when returning a new cache
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]>
Configuration menu - View commit details
-
Copy full SHA for d65e34a - Browse repository at this point
Copy the full SHA d65e34aView commit details -
Relax now the timeouts in test as we are more consistent for cleanup
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d98f777 - Browse repository at this point
Copy the full SHA d98f777View commit details -
This will be shared across tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for aba093b - Browse repository at this point
Copy the full SHA aba093bView commit details -
Fix wrong bucket name in update
Thanks to the tests! Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d375b9e - Browse repository at this point
Copy the full SHA d375b9eView commit details -
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 87814ec - Browse repository at this point
Copy the full SHA 87814ecView commit details -
Add UpdateFromUserInfo database tests
Illustrate cases where we can recover and those were we can’t. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6e7a73b - Browse repository at this point
Copy the full SHA 6e7a73bView commit details -
Update golden files for TestUpdateFromUserInfo
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2db01ca - Browse repository at this point
Copy the full SHA 2db01caView commit details -
We are using slog Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 06c38b7 - Browse repository at this point
Copy the full SHA 06c38b7View commit details -
Factor out initCache as a helper for tests
This will be reused across tests. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 493a60f - Browse repository at this point
Copy the full SHA 493a60fView commit details -
Delete all unknown buckets in database
Let’s ensure the database only contains expected and known buckets. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ec9f67e - Browse repository at this point
Copy the full SHA ec9f67eView commit details -
Additional TestNew() case handling bucket recreations.
Buckets are automatically added to existing database, add a test case for this. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fe7766e - Browse repository at this point
Copy the full SHA fe7766eView commit details -
Tests for getting users from database
Add tests for getting users by id/name/all. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e60240f - Browse repository at this point
Copy the full SHA e60240fView commit details -
Golden files for get user tests
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8a92e85 - Browse repository at this point
Copy the full SHA 8a92e85View commit details -
Tests for getting groups from database
Tests for getting them by gid/name/all. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d8bf0b2 - Browse repository at this point
Copy the full SHA d8bf0b2View commit details -
Golden file for getting group tests
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ee5f84d - Browse repository at this point
Copy the full SHA ee5f84dView commit details -
Supports go 1.21.0. Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b0e5b8e - Browse repository at this point
Copy the full SHA b0e5b8eView commit details -
Fix linting with new golangci-lint
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b8cbcf0 - Browse repository at this point
Copy the full SHA b8cbcf0View commit details