|
Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /usr/src/cloud-init/tests/integration_tests/bugs/ |
Upload File : |
""" 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
from tests.integration_tests.integration_settings import PLATFORM
USER_DATA = """\
#cloud-config
bootcmd:
- echo 'whoops' > /usr/bin/fallocate
swap:
filename: /swap.img
size: 10000000
maxsize: 10000000
"""
@pytest.mark.user_data(USER_DATA)
@pytest.mark.skipif(
PLATFORM == "lxd_container", reason="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