Skip to content

Add Fedora cloud image validation tests part1#4573

Open
balakreddy wants to merge 4 commits into
microsoft:mainfrom
balakreddy:fedora_ci_tests_1
Open

Add Fedora cloud image validation tests part1#4573
balakreddy wants to merge 4 commits into
microsoft:mainfrom
balakreddy:fedora_ci_tests_1

Conversation

@balakreddy

@balakreddy balakreddy commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

Adding fedora tests to run on fedora community cloud images using LISA in Azure. These tests are part of Fedora CI moving them to LISA will help us run them on nightly builds on Azure.

  • verify_fedora_edition_identification: Validates /etc/os-release fields, fedora-release package version, SUPPORT_END date, URL accessibility, hostnamectl output, and /etc/fedora-release format
  • verify_services_started: Verifies no systemd services are in failed state after boot

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:

Impacted LISA Features:

Tested Azure Marketplace Images:

  • Fedora-5e266ba4-2250-406d-adad-5d73860d958f/Fedora-Cloud-43-x64/latest

Test Results

Image VM Size Result
Fedora-Cloud-43-x64/latest Standard_D2ads_v5 PASSED

- `verify_fedora_edition_identification`: Validates /etc/os-release fields, fedora-release package version, SUPPORT_END date, URL accessibility, hostnamectl output, and /etc/fedora-release format
- `verify_services_started`: Verifies no systemd services are in failed state after boot

Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
@balakreddy balakreddy requested a review from LiliDeng as a code owner July 1, 2026 19:47
Copilot AI review requested due to automatic review settings July 1, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new LISA test suite to validate Fedora community cloud images in Azure, focusing on Fedora self-identification (/etc/os-release, fedora-release RPM, SUPPORT_END, URLs) and post-boot systemd service health.

Changes:

  • Adds FedoraCloudValidation test suite with Fedora edition identification checks.
  • Adds a boot validation test that checks for failed systemd units after startup.

Comment on lines +105 to +113
# Installed *-release RPM version must match VERSION_ID
rpm_result = node.execute("rpm -qa | grep fedora-release | tail -n1", shell=True)
release_pkg = rpm_result.stdout.strip()
if release_pkg:
rpm_ver = node.execute(f"rpm -q --qf '%{{VERSION}}' {release_pkg}")
assert_that(rpm_ver.stdout.strip()).described_as(
f"Release package version must match VERSION_ID ({version_id})"
).is_equal_to(version_id)

Comment on lines +114 to +123
# SUPPORT_END must be in the future
support_end = fields.get("SUPPORT_END", "")
if support_end:
date_check = node.execute(
f'[ "$(date +%s)" -lt "$(date -d "{support_end}" +%s)" ]',
shell=True,
)
assert_that(date_check.exit_code).described_as(
f"SUPPORT_END ({support_end}) must be in the future"
).is_equal_to(0)
simple_requirement,
)
from lisa.operating_system import Fedora
from lisa.tools import Cat
Comment on lines +158 to +169
curl = node.execute(
"curl -IsSL --connect-timeout 5 --max-time 15 --retry 2"
f' -w "%{{http_code}}" -o /dev/null "{url}"',
shell=True,
no_error_log=True,
timeout=60,
)
http_code = curl.stdout.strip()
assert_that(http_code[:1]).described_as(
f"{key}={url} must return HTTP 2xx/3xx (got {http_code})"
).is_in("2", "3")
node.log.info(f"{key} HTTP {http_code}: OK")
Comment on lines +191 to +194
# Check for "0 loaded units" in output (success case)
assert_that(result.stdout).described_as(
f"No failed services allowed. Output: {result.stdout}"
).contains("0 loaded units")
Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
@balakreddy

Copy link
Copy Markdown
Contributor Author

Adding @jeremycline for PR review.

Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py
@balakreddy

Copy link
Copy Markdown
Contributor Author

Adding @nmeyerhans for visibility.

systemctl reports zero failed units.
""",
priority=1,
requirement=simple_requirement(supported_os=[Fedora]),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it's a generally useful test for any image that uses systemd, for what it's worth. I assume Debian and others also expect their base images to have no failed units.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Additionally, there's already code checking systemctl is-system-running in lisa/microsoft/testsuites/kexec/kexec_suite.py. Would probably be worth generalizing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this PR scoped to Fedora for now. Will add Debian support in a follow-up PR

Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
Comment thread lisa/microsoft/testsuites/fedora/fedora_cloud_validation.py Outdated
- Add before_case to restrict to fedora only
- Use systemctl -is-system-running as suggested
- Remove Version check, hostnamectl assertion, url validation and
  /etc/fedora-release check

Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
Copilot AI review requested due to automatic review settings July 8, 2026 03:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 9 comments.

Comment on lines +57 to +62
description="""
Verify Fedora edition self-identification.

Validates /etc/os-release fields, fedora-release package version,
and SUPPORT_END date.
""",
Comment on lines +70 to +76
Reads /etc/os-release and checks:
- ID is "fedora"
- VERSION is present
- CPE_NAME includes :fedora:<VERSION_ID>
- Installed fedora-release RPM version matches VERSION_ID
- SUPPORT_END date is still in the future
- PRETTY_NAME field is present
Comment on lines +25 to +26
from lisa.operating_system import Fedora
from lisa.tools import Cat
Comment on lines +63 to +65
priority=1,
requirement=simple_requirement(supported_os=[Fedora]),
)
Comment on lines +145 to +147
priority=1,
requirement=simple_requirement(supported_os=[Fedora]),
)
Comment on lines +123 to +129
date_check = node.execute(
f'[ "$(date +%s)" -lt "$(date -d "{support_end}" +%s)" ]',
shell=True,
)
assert_that(date_check.exit_code).described_as(
f"SUPPORT_END ({support_end}) must be in the future"
).is_equal_to(0)
Comment on lines +112 to +118
rpm_ver = node.execute("rpm -q --qf '%{VERSION}' fedora-release-common")
assert_that(rpm_ver.exit_code).described_as(
"fedora-release-common must be installed"
).is_equal_to(0)
assert_that(rpm_ver.stdout.strip()).described_as(
f"fedora-release-common version must match VERSION_ID ({version_id})"
).is_equal_to(version_id)
Comment on lines +7 to +9
This test suite validates Fedora cloud image configuration and
functionality. Tests cover OS identification, package management,
boot validation, service status, system logging, and user management.
Comment on lines +35 to +37
Validates Fedora cloud image configuration across cloud platforms.
Tests cover: OS identification, package management, boot validation,
service status, system logging, and user management.
Signed-off-by: Bala Konda Reddy M <bala12352@gmail.com>
Copilot AI review requested due to automatic review settings July 8, 2026 03:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

Comment on lines +60 to +61
Validates /etc/os-release fields, fedora-release package version,
and SUPPORT_END date.
- ID is "fedora"
- VERSION is present
- CPE_NAME includes :fedora:<VERSION_ID>
- Installed fedora-release RPM version matches VERSION_ID
Comment on lines +111 to +113
# Installed fedora-release-common RPM version must match VERSION_ID
rpm_ver = node.execute("rpm -q --qf '%{VERSION}' fedora-release-common")
assert_that(rpm_ver.exit_code).described_as(
Comment on lines +120 to +129
# SUPPORT_END must be in the future
support_end = fields.get("SUPPORT_END", "")
if support_end:
date_check = node.execute(
f'[ "$(date +%s)" -lt "$(date -d "{support_end}" +%s)" ]',
shell=True,
)
assert_that(date_check.exit_code).described_as(
f"SUPPORT_END ({support_end}) must be in the future"
).is_equal_to(0)
Comment on lines +154 to +165
# Check for failed services
result = node.execute("systemctl is-system-running")
state = result.stdout.strip()
node.log.info(f"systemctl is-system-running:\n{state}")

if result.exit_code != 0:
failed_units_result = node.execute("systemctl --all --failed --no-pager")
node.log.info(f"Failed units:\n{failed_units_result.stdout}")
assert_that(state).described_as(
f"System must be running (got {state}). "
f"Failed: {failed_units_result.stdout}"
).is_equal_to("running")
state = result.stdout.strip()
node.log.info(f"systemctl is-system-running:\n{state}")

if result.exit_code != 0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're not checking what the state is it could be one of the pre-failure states as described in the manual. I'm not sure how likely it is for the test suite to run prior to the system settling into the running state, but it could lead to false failures if the system is still in the starting state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants