Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions tests/integration_tests/modules/test_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,16 @@ def test_final_message(self, class_client: IntegrationInstance):
"""Test that final_message module works as expected.

Also tests LP 1511485: final_message is silent.

It's possible that if this test is run within a minute or so of
midnight that we'll see a failure because the day in the logs
is different from the day specified in the test definition.
"""
client = class_client
log = client.read_from_file('/var/log/cloud-init.log')
# Get date on host rather than locally as our host could be in a
# wildly different timezone (or more likely recording UTC)
today = client.execute('date "+%a, %d %b %Y"')
expected = (
'This is my final message!\n'
r'\d+\.\d+.*\n'
'{}.*\n'
'DataSource.*\n'
r'\d+\.\d+'
).format(today)
"This is my final message!\n"
r"\d+\.\d+.*\n"
r"\w{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} \+\d{4}\n" # Datetime
"DataSource.*\n"
r"\d+\.\d+"
)

assert re.search(expected, log)

Expand Down