diff options
author | James Falcon <james.falcon@canonical.com> | 2021-12-15 20:16:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 19:16:38 -0700 |
commit | bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf (patch) | |
tree | 1fbb3269fc87e39832e3286ef42eefd2b23fcd44 /tests/integration_tests/modules/test_version_change.py | |
parent | 2bcf4fa972fde686c2e3141c58e640640b44dd00 (diff) | |
download | vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.tar.gz vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.zip |
Adopt Black and isort (SC-700) (#1157)
Applied Black and isort, fixed any linting issues, updated tox.ini
and CI.
Diffstat (limited to 'tests/integration_tests/modules/test_version_change.py')
-rw-r--r-- | tests/integration_tests/modules/test_version_change.py | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/tests/integration_tests/modules/test_version_change.py b/tests/integration_tests/modules/test_version_change.py index f28079d4..3168cd60 100644 --- a/tests/integration_tests/modules/test_version_change.py +++ b/tests/integration_tests/modules/test_version_change.py @@ -5,39 +5,40 @@ import pytest from tests.integration_tests.instances import IntegrationInstance from tests.integration_tests.util import ASSETS_DIR, verify_clean_log - -PICKLE_PATH = Path('/var/lib/cloud/instance/obj.pkl') -TEST_PICKLE = ASSETS_DIR / 'test_version_change.pkl' +PICKLE_PATH = Path("/var/lib/cloud/instance/obj.pkl") +TEST_PICKLE = ASSETS_DIR / "test_version_change.pkl" def _assert_no_pickle_problems(log): - assert 'Failed loading pickled blob' not in log + assert "Failed loading pickled blob" not in log verify_clean_log(log) def test_reboot_without_version_change(client: IntegrationInstance): - log = client.read_from_file('/var/log/cloud-init.log') - assert 'Python version change detected' not in log - assert 'Cache compatibility status is currently unknown.' not in log + log = client.read_from_file("/var/log/cloud-init.log") + assert "Python version change detected" not in log + assert "Cache compatibility status is currently unknown." not in log _assert_no_pickle_problems(log) client.restart() - log = client.read_from_file('/var/log/cloud-init.log') - assert 'Python version change detected' not in log - assert 'Could not determine Python version used to write cache' not in log + log = client.read_from_file("/var/log/cloud-init.log") + assert "Python version change detected" not in log + assert "Could not determine Python version used to write cache" not in log _assert_no_pickle_problems(log) # Now ensure that loading a bad pickle gives us problems client.push_file(TEST_PICKLE, PICKLE_PATH) client.restart() - log = client.read_from_file('/var/log/cloud-init.log') + log = client.read_from_file("/var/log/cloud-init.log") # no cache found is an "expected" upgrade error, and # "Failed" means we're unable to load the pickle - assert any([ - 'Failed loading pickled blob from {}'.format(PICKLE_PATH) in log, - 'no cache found' in log - ]) + assert any( + [ + "Failed loading pickled blob from {}".format(PICKLE_PATH) in log, + "no cache found" in log, + ] + ) @pytest.mark.ec2 @@ -54,8 +55,8 @@ def test_cache_purged_on_version_change(client: IntegrationInstance): client.push_file(TEST_PICKLE, PICKLE_PATH) client.execute("echo '1.0' > /var/lib/cloud/data/python-version") client.restart() - log = client.read_from_file('/var/log/cloud-init.log') - assert 'Python version change detected. Purging cache' in log + log = client.read_from_file("/var/log/cloud-init.log") + assert "Python version change detected. Purging cache" in log _assert_no_pickle_problems(log) @@ -65,11 +66,11 @@ def test_log_message_on_missing_version_file(client: IntegrationInstance): client.execute("rm /var/lib/cloud/data/python-version") client.execute("rm /var/log/cloud-init.log") client.restart() - log = client.read_from_file('/var/log/cloud-init.log') - if 'no cache found' not in log: + log = client.read_from_file("/var/log/cloud-init.log") + if "no cache found" not in log: # We don't expect the python version file to exist if we have no # pre-existing cache assert ( - 'Writing python-version file. ' - 'Cache compatibility status is currently unknown.' - ) in log + "Writing python-version file. " + "Cache compatibility status is currently unknown." in log + ) |