Skip to content

Commit

Permalink
tests: don't use tmp directory for prepare files (#14756)
Browse files Browse the repository at this point in the history
* tests: don't use tmp directory for snapd files since some spread tasks need to access the snapd.snap and other tests may reboot

* tests: change directory to /var/tmp

* tests: updated work dir for nested tests
  • Loading branch information
maykathm authored Nov 29, 2024
1 parent aaf448d commit 31a8a1e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ environment:
# Use the snapd package from the repository when possible
SNAPD_DEB_FROM_REPO: '$(HOST: echo "${SPREAD_SNAPD_DEB_FROM_REPO:-true}")'
# Directory where the built snapd snaps and other assets are stored
SNAPD_WORK_DIR: '$(HOST: echo "${SPREAD_SNAPD_WORK_DIR:-/tmp/work-dir}")'
SNAPD_WORK_DIR: '$(HOST: echo "${SPREAD_SNAPD_WORK_DIR:-/var/tmp/work-dir}")'

# Directory where the nested images and test assets are stored
NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/tmp/work-dir}")'
NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/var/tmp/work-dir}")'
# Channel used to create the nested vm
NESTED_CORE_CHANNEL: '$(HOST: echo "${NESTED_CORE_CHANNEL:-beta}")'
# Kernel channel used to create the nested vm
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/nested.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

: "${NESTED_WORK_DIR:=/tmp/work-dir}"
: "${NESTED_WORK_DIR:=/var/tmp/work-dir}"
: "${NESTED_IMAGES_DIR:=${NESTED_WORK_DIR}/images}"
: "${NESTED_RUNTIME_DIR:=${NESTED_WORK_DIR}/runtime}"
: "${NESTED_ASSETS_DIR:=${NESTED_WORK_DIR}/assets}"
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core-revert/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ systems: [ubuntu-18.04-64]
kill-timeout: 30m

environment:
IMAGE_FILE: /tmp/work-dir/images/ubuntu-core-new.img
IMAGE_FILE: $SNAPD_WORK_DIR/images/ubuntu-core-new.img

debug: |
systemctl stop nested-vm || true
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-fault-inject-on-install/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ prepare: |
remote.exec "sudo systemctl daemon-reload"
remote.exec "sudo systemctl restart snapd.service"
cp "$(ls /tmp/work-dir/snapd_snap/snapd_*.snap)" snapd.snap
cp "$(ls "$SNAPD_WORK_DIR"/snapd_snap/snapd_*.snap)" snapd.snap
execute: |
SNAP=snapd
Expand Down

0 comments on commit 31a8a1e

Please sign in to comment.