summaryrefslogtreecommitdiff
path: root/tests
diff options
authorMichael Vogt <mvo@ubuntu.com>2016-09-04 13:35:01 +0200
committerMichael Vogt <mvo@ubuntu.com>2016-09-04 13:35:01 +0200
commit7b093f95639e2bf44f469e1fb855e21851f5844e (patch)
tree2a7d1e4b2969b18316f49ec7481c15968797805d /tests
parent6cae635b6c2e77614a9412de0aaaf2cf2582994f (diff)
fix race in op-remove-retry
Diffstat (limited to 'tests')
-rwxr-xr-xtests/lib/snaps/test-snapd-tools/bin/block2
-rw-r--r--tests/main/op-remove-retry/task.yaml6
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/lib/snaps/test-snapd-tools/bin/block b/tests/lib/snaps/test-snapd-tools/bin/block
index 2c68e4ef68..cf220677a2 100755
--- a/tests/lib/snaps/test-snapd-tools/bin/block
+++ b/tests/lib/snaps/test-snapd-tools/bin/block
@@ -5,6 +5,8 @@ set -ex
cd $SNAP
echo "blocking dir $(pwd)"
+touch $SNAP_DATA/block
+
echo "waiting, press ctrl-c to stop"
sleep 999999
exit 0
diff --git a/tests/main/op-remove-retry/task.yaml b/tests/main/op-remove-retry/task.yaml
index aa087d13cf..5edba91ec6 100644
--- a/tests/main/op-remove-retry/task.yaml
+++ b/tests/main/op-remove-retry/task.yaml
@@ -21,8 +21,14 @@ execute: |
snap install --dangerous test-snapd-tools_1.0_all.snap
echo "And its mount point is kept busy"
+ # we need a marker file, because just using systemd to figure out
+ # if the service has started is racy, start just means started,
+ # not that the dir is actually blocked yet
+ MARKER=/var/snap/test-snapd-tools/current/block
+ rm -f $MARKER
systemd-run --unit unmount-blocker $(which test-snapd-tools.block)
wait_for_service unmount-blocker active
+ while [ ! -f $MARKER ]; do sleep 1; done
echo "When we try to remove the snap"
snap remove test-snapd-tools &