Skip to content

Commit

Permalink
test: Add integration test for signal handling warnings/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalcon committed Feb 20, 2025
1 parent d52950c commit 8b81ceb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/integration_tests/modules/test_power_state_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.integration_settings import PLATFORM
from tests.integration_tests.releases import IS_UBUNTU
from tests.integration_tests.util import verify_ordered_items_in_text
from tests.integration_tests.util import (
verify_clean_boot,
verify_ordered_items_in_text,
)

USER_DATA = """\
#cloud-config
Expand Down Expand Up @@ -83,6 +86,7 @@ def test_poweroff(
instance.instance.start(wait=True)
log = instance.read_from_file("/var/log/cloud-init.log")
assert _can_connect(instance)
verify_clean_boot(instance)
lines_to_check = [
"Running module power_state_change",
expected,
Expand Down
21 changes: 21 additions & 0 deletions tests/integration_tests/test_signal_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.util import verify_clean_boot

USER_DATA = """\
#cloud-config
runcmd:
- reboot
"""


@pytest.mark.user_data(USER_DATA)
def test_no_warnings(client: IntegrationInstance):
"""Test that the signal handler does not log errors on reboot.
Note that for single process boots, `Conflicts=shutdown.target` will
prevent the shutdown from happening before the cloud-init process has
exited.
"""
verify_clean_boot(client)

0 comments on commit 8b81ceb

Please sign in to comment.