summaryrefslogtreecommitdiff
diff options
authorJonathan Cave <jonathan.cave@canonical.com>2020-02-12 16:32:09 +0000
committerJonathan Cave <jonathan.cave@canonical.com>2020-02-13 11:27:37 +0000
commitc17f3b50a78d72cb632f0327d8395b4d1fafaf21 (patch)
tree1a2bf70e04b24f3070de4c75372e8211e8bfe9db
parent03c65ccf739e1c2c89968061439eac94fd560306 (diff)
snap_tests.py: pick test snap based on base
The attempt to install the test snap can be significantly slowed down if its base snap is not currently installed on the system. Use appropriate base snap based on which base checkbox is using.
-rwxr-xr-xbin/snap_tests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/snap_tests.py b/bin/snap_tests.py
index f548db8..914afab 100755
--- a/bin/snap_tests.py
+++ b/bin/snap_tests.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-# Copyright 2015-2019 Canonical Ltd.
+# Copyright 2015-2020 Canonical Ltd.
# All rights reserved.
#
# Written by:
@@ -15,7 +15,16 @@ from checkbox_support.snap_utils.snapd import Snapd
# - the snap must not be installed at the start of the nested test plan
# - the snap must be strictly confined (no classic or devmode flags)
# - there must be different revisions on the stable & edge channels
-TEST_SNAP = os.getenv('TEST_SNAP', 'test-snapd-tools')
+try:
+ TEST_SNAP = os.environ['TEST_SNAP']
+except KeyError:
+ runtime = os.getenv('CHECKBOX_RUNTIME', '/snap/checkbox/current')
+ if 'checkbox18' in runtime:
+ TEST_SNAP = 'test-snapd-tools-core18'
+ elif 'checkbox20' in runtime:
+ TEST_SNAP = 'test-snapd-tools-core20'
+ else:
+ TEST_SNAP = 'test-snapd-tools'
SNAPD_TASK_TIMEOUT = int(os.getenv('SNAPD_TASK_TIMEOUT', 30))
SNAPD_POLL_INTERVAL = int(os.getenv('SNAPD_POLL_INTERVAL', 1))