fix(tests): correct inverted assertions for read-only snapshot property editing - #18501
Draft
mvanhorn wants to merge 1 commit into
Draft
fix(tests): correct inverted assertions for read-only snapshot property editing#18501mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
…ty editing The pipeline `! cmd 2>&1 | grep -xF "$MSG" || false` in snapshots.sh and storage_snapshots.sh negates grep's exit code, causing tests to pass when the error message is absent (the broken case) and fail when it is present (the correct case). Replace with a pattern that captures output into a variable, asserts the command exits non-zero, then asserts the expected error message is present in the output. Fixes canonical#18398 Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
Member
|
@mvanhorn thanks for showing interest on working on this! I see that you've provided test fixes but AFAIK, the main issue lies in the Go code. |
simondeziel
marked this pull request as draft
June 19, 2026 15:51
Member
|
I've put it to draft until the Go code change lands. |
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.
Checklist
Summary
test/suites/snapshots.shandtest/suites/storage_snapshots.shboth contain inverted test assertions that cause the tests to pass when editing read-only snapshot properties silently succeeds (the broken behavior) and fail when the API correctly rejects such edits.! cmd 2>&1 | grep -xF "$MSG" || falsenegates grep's exit code, so the test passes when the error message is absent — exactly the opposite of the intended assertion.Why this matters
The inverted assertions mean the regression introduced in #17070 (addressing #14423) was never caught by the test suite. A member maintainer (@simondeziel) diagnosed the flaw and provided the corrected pattern in the issue thread. This PR applies that pattern to both affected test files.
Testing
These are shell test files with no production code changes. Bash syntax has been verified (
bash -n). The corrected assertions will:lxc config edit foo/snap0with a modified read-only field silently returns exit 0 (regression guard active)storage_snapshots.shparallel case for storage volume snapshotsexpires_at-editable test immediately following the loop unaffectedFixes #18398