summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2021-02-18 15:36:31 -0500
committerGitHub <noreply@github.com>2021-02-18 15:36:31 -0500
commit28d2d4b86ebde5261fbe3a3ffb28292b2bbdbd76 (patch)
tree233217c8d2ae967b936c672929ccf10cc52c6299
parent5a9008e53d7cf987b5cfb78964d2bd987d180993 (diff)
downloadvyos-cloud-init-28d2d4b86ebde5261fbe3a3ffb28292b2bbdbd76.tar.gz
vyos-cloud-init-28d2d4b86ebde5261fbe3a3ffb28292b2bbdbd76.zip
integration_tests: add UPGRADE CloudInitSource (#812)
This allows out-of-date images to be brought up-to-date with the archive, so that tests written against the latest cloud-init release will pass.
-rw-r--r--tests/integration_tests/conftest.py2
-rw-r--r--tests/integration_tests/instances.py8
-rw-r--r--tests/integration_tests/integration_settings.py2
3 files changed, 12 insertions, 0 deletions
diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py
index 99dd8d9e..3933d647 100644
--- a/tests/integration_tests/conftest.py
+++ b/tests/integration_tests/conftest.py
@@ -124,6 +124,8 @@ def get_validated_source(
return CloudInitSource.PPA
elif os.path.isfile(str(source)):
return CloudInitSource.DEB_PACKAGE
+ elif source == "UPGRADE":
+ return CloudInitSource.UPGRADE
raise ValueError(
'Invalid value for CLOUD_INIT_SOURCE setting: {}'.format(source))
diff --git a/tests/integration_tests/instances.py b/tests/integration_tests/instances.py
index 0d1e1aef..0d9852c3 100644
--- a/tests/integration_tests/instances.py
+++ b/tests/integration_tests/instances.py
@@ -39,6 +39,7 @@ class CloudInitSource(Enum):
PROPOSED = 3
PPA = 4
DEB_PACKAGE = 5
+ UPGRADE = 6
def installs_new_version(self):
if self.name in [self.NONE.name, self.IN_PLACE.name]:
@@ -123,6 +124,8 @@ class IntegrationInstance:
self.install_ppa()
elif source == CloudInitSource.PROPOSED:
self.install_proposed_image()
+ elif source == CloudInitSource.UPGRADE:
+ self.upgrade_cloud_init()
else:
raise Exception(
"Specified to install {} which isn't supported here".format(
@@ -166,6 +169,11 @@ class IntegrationInstance:
remote_script = 'dpkg -i {path}'.format(path=remote_path)
self.execute(remote_script)
+ def upgrade_cloud_init(self):
+ log.info('Upgrading cloud-init to latest version in archive')
+ self.execute("apt-get update -q")
+ self.execute("apt-get install -qy cloud-init")
+
def __enter__(self):
return self
diff --git a/tests/integration_tests/integration_settings.py b/tests/integration_tests/integration_settings.py
index 54d09d9b..157d34ad 100644
--- a/tests/integration_tests/integration_settings.py
+++ b/tests/integration_tests/integration_settings.py
@@ -59,6 +59,8 @@ EXISTING_INSTANCE_ID = None
# code.
# PROPOSED
# Install from the Ubuntu proposed repo
+# UPGRADE
+# Upgrade cloud-init to the version in the Ubuntu archive
# <ppa repo>, e.g., ppa:cloud-init-dev/proposed
# Install from a PPA. It MUST start with 'ppa:'
# <file path>