diff options
author | James Falcon <TheRealFalcon@users.noreply.github.com> | 2020-11-23 11:50:57 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-23 12:50:57 -0500 |
commit | e454dea5855019a5acdd6acafdef2ae07d069235 (patch) | |
tree | b046d998d43666c2dd5e9b95ebbd620bbaa10b56 /tests/integration_tests/bugs | |
parent | 66a851aca7acf3ae39cb5c03fc97c563716b5aa3 (diff) | |
download | vyos-cloud-init-e454dea5855019a5acdd6acafdef2ae07d069235.tar.gz vyos-cloud-init-e454dea5855019a5acdd6acafdef2ae07d069235.zip |
Integration test for fallocate falling back to dd (#681)
See #585
Diffstat (limited to 'tests/integration_tests/bugs')
-rw-r--r-- | tests/integration_tests/bugs/test_lp1897099.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/integration_tests/bugs/test_lp1897099.py b/tests/integration_tests/bugs/test_lp1897099.py new file mode 100644 index 00000000..27c8927f --- /dev/null +++ b/tests/integration_tests/bugs/test_lp1897099.py @@ -0,0 +1,31 @@ +""" Integration test for LP #187099 + +Ensure that if fallocate fails during mkswap that we fall back to using dd + +https://bugs.launchpad.net/cloud-init/+bug/1897099 +""" + +import pytest + + +USER_DATA = """\ +#cloud-config +bootcmd: + - echo 'whoops' > /usr/bin/fallocate +swap: + filename: /swap.img + size: 10000000 + maxsize: 10000000 +""" + + +@pytest.mark.sru_2020_11 +@pytest.mark.user_data(USER_DATA) +@pytest.mark.no_container('Containers cannot configure swap') +def test_fallocate_fallback(client): + log = client.read_from_file('/var/log/cloud-init.log') + assert '/swap.img' in client.execute('cat /proc/swaps') + assert '/swap.img' in client.execute('cat /etc/fstab') + assert 'fallocate swap creation failed, will attempt with dd' in log + assert "Running command ['dd', 'if=/dev/zero', 'of=/swap.img'" in log + assert 'SUCCESS: config-mounts ran successfully' in log |