Skip to content

Commit

Permalink
tests/lib/prepare: remove the unpack directory
Browse files Browse the repository at this point in the history
It may happen that a prepare step of a 'core' suite fails, which
followed by successful restore, will lead spread to try and run another
suite on the same host (eg. tests/core/ fails, followed by attempt to
start tests/main/). Make sure that we clean up the directory where the
core snap from previous attempt was repacked.

Signed-off-by: Maciej Borzecki <[email protected]>
  • Loading branch information
bboozzoo committed Nov 5, 2024
1 parent 78fb2de commit 89c5858
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/lib/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,11 @@ setup_reflash_magic() {
# remove the above debug lines once the mentioned bug is fixed
snap install "--channel=${CORE_CHANNEL}" "$core_name"
UNPACK_DIR="/tmp/$core_name-snap"
# make sure that the unpack directory does not exist, which may happen a
# previous attempt of 'core' suite prepare failed on this host (followed by
# successful restore), and we still want to give this one a chance so that
# we're not wasting CPU cycles
rm -rf "$UNPACK_DIR"
unsquashfs -no-progress -d "$UNPACK_DIR" /var/lib/snapd/snaps/${core_name}_*.snap

if os.query is-arm; then
Expand Down

0 comments on commit 89c5858

Please sign in to comment.