Use single quotes for readability in error assertions#17455
Use single quotes for readability in error assertions#17455tomponline merged 2 commits intocanonical:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves readability of error message assertions in test files by switching from double-quoted to single-quoted strings. This change eliminates the need to escape internal double quotes within error messages, making the test assertions easier to read and maintain.
Changes:
- Updated error assertion comparisons to use single quotes instead of double quotes
- Modified test README to document the preference for single-quoted strings in error assertions
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/suites/storage_snapshots.sh | Changed error message assertions to use single quotes for improved readability |
| test/suites/snapshots.sh | Changed ERROR_MSG variable assignment to use single quotes |
| test/suites/serverconfig.sh | Changed grep pattern assertions to use single quotes with proper variable interpolation |
| test/suites/clustering_waitready.sh | Changed error message assertions to use single quotes, handling apostrophes with proper quoting |
| test/suites/clustering.sh | Changed error message assertions to use single quotes with proper variable interpolation |
| test/README.md | Added documentation recommending single-quoted strings for error assertions |
simondeziel
left a comment
There was a problem hiding this comment.
Whenever there is a ' in the string or a variable we need to embed, the readability grain goes down the drain :/
It's a question of preference/taste but I'd use the single quoting option only when it avoids escaping.
Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
Signed-off-by: Kadin Sayani <kadin.sayani@canonical.com>
d78d390 to
71da7a2
Compare
As per the new CLI guidelines, I believe we aren't supposed to have contractions in error messages, so those should say "are not". Furthermore, I think "have not" is more grammatically correct: "Cannot restore "node1" because some storage pools have not started yet". "Cannot restore "node1" because some storage pools are stopped" might be even better. |
|
Follow-up to #17432.