-
Notifications
You must be signed in to change notification settings - Fork 933
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
test: Improve usage of lxd sql
in tests
#14674
Merged
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
This grep will never have been asserting anything since the instance name is not present in the `auth_groups_permissions` table. Instead we now assert that there are no permissions with the `can_exec` entitlement via `count`. Signed-off-by: Mark Laing <[email protected]>
Using csv here should mean this test is not subject to any formatting differences before and after backup. Signed-off-by: Mark Laing <[email protected]>
Using a count query here because grepping for things that we don't expect to be there can be error prone. Signed-off-by: Mark Laing <[email protected]>
With `--format csv` it's easier to perform the exact match. Signed-off-by: Mark Laing <[email protected]>
With `--format csv` it's easier to perform the exact match. Signed-off-by: Mark Laing <[email protected]>
Using `count` with `--format csv` to show that the node count is decremented when the node is forcefully removed. Signed-off-by: Mark Laing <[email protected]>
Now checking for exact matches. `cut -c-1-12` is used on returned fingerprints to match against what is shown in the CLI. Signed-off-by: Mark Laing <[email protected]>
Using `count` and `--format csv` we can assert the user is present in the database without `wc -l`. Signed-off-by: Mark Laing <[email protected]>
This simplifies the assertion that the username is present in `GET /1.0` output and additionally asserts that the `auth` field is `trusted`. Signed-off-by: Mark Laing <[email protected]>
Signed-off-by: Mark Laing <[email protected]>
… test. Signed-off-by: Mark Laing <[email protected]>
simondeziel
approved these changes
Dec 17, 2024
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.
Lovely, thanks!
tomponline
approved these changes
Dec 17, 2024
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.
Support for the
--format
flag was added in #14670. This PR uses the format flag where possible in our test suite to avoid e.g. grepping for table formatted output.In some cases I've changed queries to use a
SELECT count(*) FROM ...
instead of aSELECT * FROM ...
where the output was piped into a word count or grepped with the -c flag.