Skip to content

Commit

Permalink
tests: revert expectation of exit 2 from cloud-init init --local (can…
Browse files Browse the repository at this point in the history
…onical#5504)

Commit 604d80e introduced assertions expecting exit 2 from the
CLI when calling cloud-init init --local. Revert this test assertion
as only cloud-init status command exits (2) on deprecations/warnings.

Invoking cloud-init's boot stages on the commmand line will only exit
1 if critical errors are encountered to avoid degrading overall
systemd health as seen from cloud-init systemd units. When cloud-init
boot stages encounter recoverable_errors of any type, there is no
need to exit non-zero as those deprecation logs are not-critical to
the health of the system as a whole.
  • Loading branch information
blackboxsw authored and holmanb committed Aug 2, 2024
1 parent ad74cd1 commit f2642f1
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions tests/integration_tests/datasources/test_ec2_ipv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@

import pytest

from cloudinit.util import should_log_deprecation
from tests.integration_tests.instances import IntegrationInstance
from tests.integration_tests.integration_settings import PLATFORM
from tests.integration_tests.util import get_feature_flag_value


def _test_crawl(client: IntegrationInstance, ip: str):
return_code = (
2
if should_log_deprecation(
"24.3", get_feature_flag_value(client, "DEPRECATION_INFO_BOUNDARY")
)
else 0
)
assert client.execute("cloud-init clean --logs")
assert return_code == client.execute("cloud-init init --local").return_code


def _test_crawl(client, ip):
assert client.execute("cloud-init clean --logs").ok
assert client.execute("cloud-init init --local").ok
log = client.read_from_file("/var/log/cloud-init.log")
assert f"Using metadata source: '{ip}'" in log
result = re.findall(r"Crawl of metadata service.* (\d+.\d+) seconds", log)
Expand Down

0 comments on commit f2642f1

Please sign in to comment.