add-bank/add-user: add check for existing DB structure when trying to add a bank or association#810
Merged
mergify[bot] merged 4 commits intoflux-framework:masterfrom Jan 28, 2026
Merged
Conversation
Problem: There are tests in the test suite that assume a database hierarchy that is invalid (i.e. sub-banks that exist at the same level as associations and vice versa). Adjust the unit tests in t1002_user_cmds.py (namely, the structure of sub-banks) and t1017-update-db.t to comply with restrictions on how a database hierarchy can be structured in flux-accounting.
Problem: flux-accounting requires a bank hierarchy structure in which sub-banks cannot be added to a parent bank that already has associations in it (and vice versa; associations cannot be added to a bank that already has sub-banks in it), but there is no check for this hierarchy structure when calling add-bank or add-user. Add a check in add_bank() and add_user() that the bank or association being added is valid and complies with the hierarchy structure for flux-accounting; if not, raise an error.
Problem: There are no tests that check an error is raised when trying to add a bank or association in a way that violates the flux-accounting bank hierarchy structure. Add some tests.
Problem: There is no mention of how flux-accounting assumes a certain structure regarding its assumed arrangement of banks, sub-banks, associations, and their relation with each other. Add a warning to the "Database Administration" section that mentions how banks cannot be added to a parent which already has associations, and vice versa.
Member
Author
|
Thanks @jameshcorbett! Setting MWP |
Contributor
Merge Queue Status✅ The pull request has been merged at 6c7cfff This pull request spent 7 seconds in the queue, with no time running CI. Required conditions to merge
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #810 +/- ##
=======================================
Coverage 82.93% 82.93%
=======================================
Files 27 27
Lines 2479 2479
=======================================
Hits 2056 2056
Misses 423 423 🚀 New features to boost your workflow:
|
This file contains hidden or 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
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.
Problem
As noted in #809, flux-accounting requires a bank hierarchy structure in which sub-banks cannot be added to a parent bank that already has associations in it (and vice versa; associations cannot be added to a bank that
already has sub-banks in it), but there is no check for this hierarchy structure when calling
add-bankoradd-user.This PR adds a check in
add_bank()andadd_user()that the bank or association being added is valid and complies with the hierarchy structure for flux-accounting; if not, it raises an error. Existing tests that did not follow this structure have also been adjusted to comply and are adjusted in the first commit. Documentation has also been updated to leave a warning to readers about the assumptions of the structure of banks and associations in flux-accounting.Fixes #809