Test command should not modify output location
Metadata
Current evaluation
Fixed in #758 (commit f411bf42): test no longer redirects pack output to spread/, leaving the artifact in the project root for craft-test.
Resolution: closed resolved
Reason: PR #758 was merged as commit f411bf42, removing the output-location override so test preparation can find the packed artifact.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
When running the `test` command, `pack` is executed redirecting its output to the `spread` subdirectory. Craft-test expects the output artifact to be in the project root instead.
### To Reproduce
Run `snapcraft init` and `snapcraft init --profile=test` followed by `snapcraft test`.
### part yaml
```shell
```
### Relevant log output
```shell
$ snapcraft test --verbose
Starting snapcraft, version 8.9.0.post7
Logging execution to '/home/claudio/.local/state/snapcraft/log/snapcraft-20250502-152135.646912.log'
The test command is experimental and subject to change without warning.
Launching managed ubuntu 24.04 instance...
Creating new instance from remote
Creating new base instance from remote
Creating new instance from base instance
Starting instance
Starting snapcraft, version 8.9.0.post7
Logging execution to '/tmp/snapcraft.log'
Initialising lifecycle
Installing build-packages
Installing build-snaps
Pulling my-part
Building my-part
Staging my-part
Priming my-part
Packing...
Reading snap metadata...
Running linters...
Running linter: classic
Running linter: library
Creating snap package...
Packed abcxyz_0.1_amd64.snap
Testing project
Running spread tests
:: 2025-05-02 15:25:51 Found /tmp/x/.craft-spread-1e0g3quv/spread.yaml.
:: 2025-05-02 15:25:51 Project content is packed for delivery (3.56KB).
:: 2025-05-02 15:25:51 If killed, discard servers with: spread -reuse-pid=1319994 -discard
:: 2025-05-02 15:25:51 Allocating craft:ubuntu-24.04...
:: 2025-05-02 15:27:32 Waiting for craft:ubuntu-24.04 to make SSH available at 10.172.144.196...
:: 2025-05-02 15:27:37 Allocated craft:ubuntu-24.04.
:: 2025-05-02 15:27:37 Connecting to craft:ubuntu-24.04...
:: 2025-05-02 15:27:38 Connected to craft:ubuntu-24.04 at 10.172.144.196.
:: 2025-05-02 15:27:38 Sending project content to craft:ubuntu-24.04...
:: 2025-05-02 15:27:40 Preparing craft:ubuntu-24.04 (craft:ubuntu-24.04)...
:: 2025-05-02 15:28:10 Preparing craft:ubuntu-24.04:spread/general/ (craft:ubuntu-24.04)...
:: 2025-05-02 15:28:10 Error preparing craft:ubuntu-24.04:spread/general/ (craft:ubuntu-24.04) :
:: -----
:: + snap install /root/proj/abcxyz_0.1_amd64.snap --dangerous --jailmode
:: error: cannot open "/root/proj/abcxyz_0.1_amd64.snap": open /root/proj/abcxyz_0.1_amd64.snap: no such file or directory
:: -----
:: .
:: 2025-05-02 15:28:10 Restoring craft:ubuntu-24.04:spread/general/ (craft:ubuntu-24.04)...
:: 2025-05-02 15:28:10 Restoring craft:ubuntu-24.04 (craft:ubuntu-24.04)...
:: 2025-05-02 15:28:12 Discarding craft:ubuntu-24.04...
:: 2025-05-02 15:28:13 Successful tasks: 0
:: 2025-05-02 15:28:13 Aborted tasks: 1
:: 2025-05-02 15:28:13 Failed suite prepare: 1
:: - craft:ubuntu-24.04:spread/general/
:: error: unsuccessful run
spread run failed
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in #758 (commit f411bf42): test no longer redirects pack output to spread/, leaving the artifact in the project root for craft-test. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in #758 (commit f411bf42): test no longer redirects pack output to spread/, keeping the artifact in the project root for craft-test. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by removing output redirection lines in craft-application/commands/lifecycle.py. The test command previously incorrectly saved pack artifacts to a spread subdirectory instead of the project root, causing craft-test failures. | |
| qwen/qwen3.6-35b-a3b | — | — | The test command incorrectly redirected output to a spread subdirectory instead of the project root. The bug was fixed by removing the redirect logic in lifecycle.py. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed snapcraft test redirecting pack output to a spread subdirectory. Resolved by removing the problematic redirection logic in craft-application, ensuring artifacts stay in the project root as expected. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by removing lines in craft-application/commands/lifecycle.py that redirected pack output to the spread subdirectory. The test command now correctly places the output artifact in the project root. | |
| qwen/qwen3.6-35b-a3b | — | — | The snapcraft test command incorrectly redirected output to a spread subdirectory instead of the project root. A maintainer resolved the bug by removing specific lines in craft_application/commands/lifecycle.py. The issue was closed. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-application#758
(confidence 100%)
Merged fix for the incorrect test-command output location.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #758 fix(testing): don't change the output artifact location | craft-application | merged | Merged in canonical/craft-application#758 via commit f411bf42, fixing #752 by keeping test-command artifacts in the standard output location instead of a spread subdirectory. | |
| #391 Remove test location workaround | fetch-service | closed | Removed the temporary test artifact-location workaround after craft-application fixed test output handling; merged in fetch-service#392 as bdfc9b8. |