diff options
author | James Falcon <TheRealFalcon@users.noreply.github.com> | 2021-04-19 11:31:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 12:31:28 -0400 |
commit | d132356cc361abef2d90d4073438f3ab759d5964 (patch) | |
tree | be17b95ad72951ada102204d7f52f62ccc430395 /tests/integration_tests/test_upgrade.py | |
parent | 45db197cfc7e3488baae7dc1053c45da070248f6 (diff) | |
download | vyos-cloud-init-d132356cc361abef2d90d4073438f3ab759d5964.tar.gz vyos-cloud-init-d132356cc361abef2d90d4073438f3ab759d5964.zip |
fix error on upgrade caused by new vendordata2 attributes (#869)
In #777, we added 'vendordata2' and 'vendordata2_raw' attributes to
the DataSource class, but didn't use the upgrade framework to deal
with an unpickle after upgrade. This commit adds the necessary
upgrade code.
Additionally, added a smaller-scope upgrade test to our integration
tests that will be run on every CI run so we catch these issues
immediately in the future.
LP: #1922739
Diffstat (limited to 'tests/integration_tests/test_upgrade.py')
-rw-r--r-- | tests/integration_tests/test_upgrade.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/integration_tests/test_upgrade.py b/tests/integration_tests/test_upgrade.py index c20cb3c1..48e0691b 100644 --- a/tests/integration_tests/test_upgrade.py +++ b/tests/integration_tests/test_upgrade.py @@ -1,4 +1,5 @@ import logging +import os import pytest import time from pathlib import Path @@ -8,6 +9,8 @@ from tests.integration_tests.conftest import ( get_validated_source, session_start_time, ) +from tests.integration_tests.instances import CloudInitSource + log = logging.getLogger('integration_testing') @@ -63,7 +66,7 @@ def test_upgrade(session_cloud: IntegrationCloud): return # type checking doesn't understand that skip raises launch_kwargs = { - 'image_id': session_cloud._get_initial_image(), + 'image_id': session_cloud.released_image_id, } image = ImageSpecification.from_os_image() @@ -93,6 +96,26 @@ def test_upgrade(session_cloud: IntegrationCloud): instance.install_new_cloud_init(source, take_snapshot=False) instance.execute('hostname something-else') _restart(instance) + assert instance.execute('cloud-init status --wait --long').ok _output_to_compare(instance, after_path, netcfg_path) log.info('Wrote upgrade test logs to %s and %s', before_path, after_path) + + +@pytest.mark.ci +@pytest.mark.ubuntu +def test_upgrade_package(session_cloud: IntegrationCloud): + if get_validated_source(session_cloud) != CloudInitSource.DEB_PACKAGE: + not_run_message = 'Test only supports upgrading to build deb' + if os.environ.get('TRAVIS'): + # If this isn't running on CI, we should know + pytest.fail(not_run_message) + else: + pytest.skip(not_run_message) + + launch_kwargs = {'image_id': session_cloud.released_image_id} + + with session_cloud.launch(launch_kwargs=launch_kwargs) as instance: + instance.install_deb() + instance.restart() + assert instance.execute('cloud-init status --wait --long').ok |