Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: make verify_clean_boot respect return code by series #5695

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
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
17 changes: 13 additions & 4 deletions tests/integration_tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from cloudinit.subp import subp
from tests.integration_tests.integration_settings import PLATFORM
from tests.integration_tests.releases import CURRENT_RELEASE, NOBLE

LOG = logging.getLogger("integration_testing.util")

Expand Down Expand Up @@ -347,15 +348,23 @@ def _verify_clean_boot(
out = instance.execute("cloud-init status --long")
assert 1 != out.return_code, (
f"Unexpected return code from `cloud-init status`. Expected rc=0 "
f"or rc=2, received rc={out.return_code}\nstdout: "
f"{out.stdout}\nstderr: {out.stderr}"
f"or rc=2, received rc={out.return_code}\nstdout:\n"
f"{out.stdout}\nstderr:\n{out.stderr}"
)
else:
# we know that we should have a return code of 2
out = instance.execute("cloud-init status --long")
assert 2 == out.return_code, (
rc = 2
if CURRENT_RELEASE < NOBLE and "main" != os.environ.get(
"GITHUB_BASE_REF"
):
# Old releases return 0 for backwards compatibility
rc = 0
assert rc == out.return_code, (
# CI on main doen't patch out this behavior so despite running on
# old releases it behaves as tip of main does
f"Unexpected return code from `cloud-init status`. "
f"Expected rc=2, received rc={out.return_code}\nstdout: "
f"Expected rc={rc}, received rc={out.return_code}\nstdout: "
f"{out.stdout}\nstderr: {out.stderr}"
)
schema = instance.execute("cloud-init schema --system --annotate")
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ passenv =
CLOUD_INIT_*
SSH_AUTH_SOCK
OS_*
GITHUB_*
setenv =
PYTEST_ADDOPTS="-m ci and not adhoc"

Expand Down