diff options
author | Daniel Watkins <oddbloke@ubuntu.com> | 2021-04-26 16:41:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 15:41:50 -0500 |
commit | 5c740dcf6f278a180c32863d2b4225b6db925ef0 (patch) | |
tree | 68f579e8b24ce5f7452a701e973aa052c93d6542 | |
parent | 02db2c3ecf29924690d4c4adf6ec059f36f31103 (diff) | |
download | vyos-cloud-init-5c740dcf6f278a180c32863d2b4225b6db925ef0.tar.gz vyos-cloud-init-5c740dcf6f278a180c32863d2b4225b6db925ef0.zip |
test_upgrade: modify test_upgrade_package to run for more sources (#883)
This allows us to use it when validating packages from -proposed (and
PPAs etc.).
-rw-r--r-- | tests/integration_tests/test_upgrade.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/integration_tests/test_upgrade.py b/tests/integration_tests/test_upgrade.py index 48e0691b..7478a1b9 100644 --- a/tests/integration_tests/test_upgrade.py +++ b/tests/integration_tests/test_upgrade.py @@ -9,11 +9,13 @@ from tests.integration_tests.conftest import ( get_validated_source, session_start_time, ) -from tests.integration_tests.instances import CloudInitSource log = logging.getLogger('integration_testing') +UNSUPPORTED_INSTALL_METHOD_MSG = ( + "Install method '{}' not supported for this test" +) USER_DATA = """\ #cloud-config hostname: SRU-worked @@ -57,12 +59,10 @@ def _restart(instance): @pytest.mark.sru_2020_11 -def test_upgrade(session_cloud: IntegrationCloud): +def test_clean_boot_of_upgraded_package(session_cloud: IntegrationCloud): source = get_validated_source(session_cloud) if not source.installs_new_version(): - pytest.skip("Install method '{}' not supported for this test".format( - source - )) + pytest.skip(UNSUPPORTED_INSTALL_METHOD_MSG.format(source)) return # type checking doesn't understand that skip raises launch_kwargs = { @@ -104,18 +104,21 @@ def test_upgrade(session_cloud: IntegrationCloud): @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' +def test_subsequent_boot_of_upgraded_package(session_cloud: IntegrationCloud): + source = get_validated_source(session_cloud) + if not source.installs_new_version(): if os.environ.get('TRAVIS'): # If this isn't running on CI, we should know - pytest.fail(not_run_message) + pytest.fail(UNSUPPORTED_INSTALL_METHOD_MSG.format(source)) else: - pytest.skip(not_run_message) + pytest.skip(UNSUPPORTED_INSTALL_METHOD_MSG.format(source)) + return # type checking doesn't understand that skip raises launch_kwargs = {'image_id': session_cloud.released_image_id} with session_cloud.launch(launch_kwargs=launch_kwargs) as instance: - instance.install_deb() + instance.install_new_cloud_init( + source, take_snapshot=False, clean=False + ) instance.restart() assert instance.execute('cloud-init status --wait --long').ok |