summaryrefslogtreecommitdiff
path: root/tests/integration_tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration_tests/bugs')
-rw-r--r--tests/integration_tests/bugs/test_lp1886531.py27
-rw-r--r--tests/integration_tests/bugs/test_lp1897099.py31
-rw-r--r--tests/integration_tests/bugs/test_lp1900837.py28
3 files changed, 86 insertions, 0 deletions
diff --git a/tests/integration_tests/bugs/test_lp1886531.py b/tests/integration_tests/bugs/test_lp1886531.py
new file mode 100644
index 00000000..058ea8bb
--- /dev/null
+++ b/tests/integration_tests/bugs/test_lp1886531.py
@@ -0,0 +1,27 @@
+"""Integration test for LP: #1886531
+
+This test replicates the failure condition (absent /etc/fstab) on all releases
+by removing it in a bootcmd; this runs well before the part of cloud-init which
+causes the failure.
+
+The only required assertion is that cloud-init does not emit a WARNING to the
+log: this indicates that the fstab parsing code has not failed.
+
+https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1886531
+"""
+import pytest
+
+
+USER_DATA = """\
+#cloud-config
+bootcmd:
+- rm -f /etc/fstab
+"""
+
+
+class TestLp1886531:
+
+ @pytest.mark.user_data(USER_DATA)
+ def test_lp1886531(self, client):
+ log_content = client.read_from_file("/var/log/cloud-init.log")
+ assert "WARNING" not in log_content
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
diff --git a/tests/integration_tests/bugs/test_lp1900837.py b/tests/integration_tests/bugs/test_lp1900837.py
new file mode 100644
index 00000000..3fe7d0d0
--- /dev/null
+++ b/tests/integration_tests/bugs/test_lp1900837.py
@@ -0,0 +1,28 @@
+"""Integration test for LP: #1900836.
+
+This test mirrors the reproducing steps from the reported bug: it changes the
+permissions on cloud-init.log to 600 and confirms that they remain 600 after a
+reboot.
+"""
+import pytest
+
+
+def _get_log_perms(client):
+ return client.execute("stat -c %a /var/log/cloud-init.log")
+
+
+@pytest.mark.sru_2020_11
+class TestLogPermissionsNotResetOnReboot:
+ def test_permissions_unchanged(self, client):
+ # Confirm that the current permissions aren't 600
+ assert "644" == _get_log_perms(client)
+
+ # Set permissions to 600 and confirm our assertion passes pre-reboot
+ client.execute("chmod 600 /var/log/cloud-init.log")
+ assert "600" == _get_log_perms(client)
+
+ # Reboot
+ client.instance.restart()
+
+ # Check that permissions are not reset on reboot
+ assert "600" == _get_log_perms(client)