[lxc-devel] [lxd/master] tests: Fix race condition
stgraber on Github
lxc-bot at linuxcontainers.org
Thu Feb 22 20:09:54 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180222/68963ebb/attachment.bin>
-------------- next part --------------
From 07bed73d52a53ed4a82162079e5c4bf34c91007b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 22 Feb 2018 15:08:25 -0500
Subject: [PATCH 1/2] tests: Wait up to 20s for image to expire
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
test/suites/image.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/suites/image.sh b/test/suites/image.sh
index e36bb149e..e4a9a5db7 100644
--- a/test/suites/image.sh
+++ b/test/suites/image.sh
@@ -31,7 +31,13 @@ test_image_expiry() {
# Trigger the expiry
lxc_remote config set l2: images.remote_cache_expiry 1
- sleep 5
+
+ # shellcheck disable=SC2034
+ for i in $(seq 20); do
+ sleep 1
+ ! lxc_remote image list l2: | grep -q "${fpbrief}" && break
+ done
+
! lxc_remote image list l2: | grep -q "${fpbrief}" || false
# Cleanup and reset
From 377a9b4a06bc528c8b3422498d2aeccda9b013a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 22 Feb 2018 15:08:56 -0500
Subject: [PATCH 2/2] tests: Consistency
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
test/suites/migration.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/suites/migration.sh b/test/suites/migration.sh
index 16b1d0bbd..5cd8232d1 100644
--- a/test/suites/migration.sh
+++ b/test/suites/migration.sh
@@ -230,7 +230,7 @@ migration() {
lxc_remote launch testimage l1:migratee
# let the container do some interesting things
- sleep 1s
+ sleep 1
lxc_remote stop --stateful l1:migratee
lxc_remote start l1:migratee
More information about the lxc-devel
mailing list