← Back to issue list

lxd unit tests: simplify command checking pattern

View original Github issue

Metadata

Project
snapcraft
Number
#3326
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #3326 (9c9381695) simplified LXD unit-test command checks, added a shared command prefix, removed environment-argument mocks, and cut 309 net lines.

Resolution: closed resolved

Reason: The approved changes were merged as commit 9c9381695. They introduced LXD_RUN_COMMAND_PREFIX, removed mocks used to capture LXD build-provider flags, and replaced repetitive assertions with concise filters.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- Add common prefix args with defaults to be shared by all tests in `LXD_RUN_COMMAND_PREFIX`. - Remove mock to fake the environment args to capture all flags relevant to LXD build provider. - Make command checks much more concise using list comprehension to filter out the prefix args and/or using `LXD_RUN_COMMAND_PREFIX`. Signed-off-by: Chris Patterson <chris.patterson@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #3326 (9c9381695) simplified LXD unit-test command checks, added a shared command prefix, removed environment-argument mocks, and cut 309 net lines.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#3326 (9c9381695): added LXD_RUN_COMMAND_PREFIX, removed environment mocks, and simplified command assertions, reducing 309 lines.
stealth/space-bunny-alpha — closed resolved Merged as #3326 via 9c9381695, simplifying LXD unit-test command checks with LXD_RUN_COMMAND_PREFIX, removing environment mocks and reducing 309 net lines.
qwen/qwen3.6-35b-a3b — — Merged. Simplifies LXD unit test command checking by introducing LXD_RUN_COMMAND_PREFIX for shared defaults, removing environment mocking, and using list comprehensions to filter prefix arguments. Net reduction of 309 lines across 10 files.
qwen3.6-35b-a3b-mtp-q6 — — Merged changes simplifying LXD unit test command checking. Introduces LXD_RUN_COMMAND_PREFIX for shared defaults, removes environment arg mocking, and uses list comprehensions to filter prefix arguments, streamlining test assertions.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#178 tests: refactor lxd launcher tests craft-providers merged Merged PR #178 in commit 43146e2 refactored LXD launcher tests to distinguish regular instances from base instances, enabling the test coverage needed by #177.
71%
#44 integration tests: consolidate lxd/multipass fixtures for reuse craft-providers merged Merged PR #44 in commit ee0f643, consolidating reusable LXD and Multipass integration-test fixtures and including a documentation fix.
71%
#187 tests: improve lxd launcher tests for base instances craft-providers merged Merged in b0df595: expanded LXD base-instance tests, mocked _is_valid(), added lxc.info() integration coverage, and clarified an error message.
71%