Skip to content

Commit

Permalink
Prepare for test coverage
Browse files Browse the repository at this point in the history
* modify the main.fmf in plans
* point packit to the EL9 targets

Signed-off-by: Daniel Diblik <[email protected]>
  • Loading branch information
danmyway committed Apr 24, 2024
1 parent 21a763e commit e69dc25
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 5 deletions.
189 changes: 189 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,141 @@ jobs:
# TEST JOBS
## Tests on pull request stage. Tests are run on demand
### Definitions of the tier0 tests (non-destructive and destructive separately)
- &tests-tier0-oraclelinux-9
job: tests
# Run tests on-demand
manual_trigger: true
# Do not merge the PR into the target branch, in case the merge is broken
# Given we are rebasing the source branches regularly, we do not need this feature enabled
merge_pr_in_ci: false
targets:
epel-9-x86_64:
distros: ["OL9.3-x86_64-HVM-2024-02-02"] # Owner ID for Oracle Linux images 131827586825
trigger: pull_request
identifier: "tier0-ol9"
tmt_plan: "tier0/non-destructive|tier0/destructive"
# Run on Red Testing Farm Hat Ranch, tag resources to sst_conversions
use_internal_tf: True
# For some targets we use official AWS marketplace images, those do not support root ssh login as default,
# therefore we need to pass post-install-script to enable root login on the host
tf_post_install_script: '#!/bin/bash\nsudo sed -i "s/^.*ssh-rsa/ssh-rsa/" /root/.ssh/authorized_keys'
tf_extra_params:
environments:
- tmt:
context:
distro: oracle-9-latest
settings:
provisioning:
tags:
BusinessUnit: sst_conversions
settings:
pipeline:
parallel-limit: 20
labels:
- tier0
- oracle9
- el9

- &tests-sanity-oraclelinux-9
<<: *tests-tier0-oraclelinux-9
identifier: "sanity-ol9"
tmt_plan: "tier0/sanity"
labels:
- tier0
- oracle9
- sanity
- el9

- &tests-tier0-almalinux-9
job: tests
# Run tests on-demand
manual_trigger: true
# Do not merge the PR into the target branch, in case the merge is broken
# Given we are rebasing the source branches regularly, we do not need this feature enabled
merge_pr_in_ci: false
targets:
epel-9-x86_64:
distros: ["AlmaLinux OS 9.3.20240303 x86_64"] # Owner ID for Rocky Linux images 764336703387
trigger: pull_request
identifier: "tier0-al9"
tmt_plan: "tier0/non-destructive|tier0/destructive"
# Run on Red Testing Farm Hat Ranch, tag resources to sst_conversions
use_internal_tf: True
# For some targets we use official AWS marketplace images, those do not support root ssh login as default,
# therefore we need to pass post-install-script to enable root login on the host
tf_post_install_script: '#!/bin/bash\nsudo sed -i "s/^.*ssh-rsa/ssh-rsa/" /root/.ssh/authorized_keys'
tf_extra_params:
environments:
- tmt:
context:
distro: alma-9-latest
settings:
provisioning:
tags:
BusinessUnit: sst_conversions
settings:
pipeline:
parallel-limit: 20
labels:
- tier0
- alma9
- el9

- &tests-sanity-almalinux-9
<<: *tests-tier0-almalinux-9
identifier: "sanity-al9"
tmt_plan: "tier0/sanity"
labels:
- tier0
- alma9
- sanity
- el9

- &tests-tier0-rockylinux-9
job: tests
# Run tests on-demand
manual_trigger: true
# Do not merge the PR into the target branch, in case the merge is broken
# Given we are rebasing the source branches regularly, we do not need this feature enabled
merge_pr_in_ci: false
targets:
epel-9-x86_64:
distros: ["Rocky-9-EC2-Base-9.3-20231113.0.x86_64"] # Owner ID for Rocky Linux images 792107900819
trigger: pull_request
identifier: "tier0-rl9"
tmt_plan: "tier0/non-destructive|tier0/destructive"
# Run on Red Testing Farm Hat Ranch, tag resources to sst_conversions
use_internal_tf: True
# For some targets we use official AWS marketplace images, those do not support root ssh login as default,
# therefore we need to pass post-install-script to enable root login on the host
tf_post_install_script: '#!/bin/bash\nsudo sed -i "s/^.*ssh-rsa/ssh-rsa/" /root/.ssh/authorized_keys'
tf_extra_params:
environments:
- tmt:
context:
distro: rocky-9-latest
settings:
provisioning:
tags:
BusinessUnit: sst_conversions
settings:
pipeline:
parallel-limit: 20
labels:
- tier0
- rocky9
- el9

- &tests-sanity-rockylinux-9
<<: *tests-tier0-rockylinux-9
identifier: "sanity-rl9"
tmt_plan: "tier0/sanity"
labels:
- tier0
- rocky9
- sanity
- el9

- &tests-tier0-centos
job: tests
# Run tests on-demand
Expand Down Expand Up @@ -401,6 +536,33 @@ jobs:
- tier1
- rocky-8

- &tests-tier1-manual-rockylinux-9
<<: *tests-tier0-rockylinux-9
identifier: "tier1-rl9"
tmt_plan: "tier1"
labels:
- tier1
- rocky9
- el9

- &tests-tier1-manual-almalinux-9
<<: *tests-tier0-almalinux-9
identifier: "tier1-al9"
tmt_plan: "tier1"
labels:
- tier1
- alma9
- el9

- &tests-tier1-manual-oraclelinux-9
<<: *tests-tier0-oraclelinux-9
identifier: "tier1-ol9"
tmt_plan: "tier1"
labels:
- tier1
- oracle9
- el9

## Tests on merge to main stage. Tests are run automatically
- &tests-main-tier1-centos
<<: *tests-tier0-centos
Expand Down Expand Up @@ -464,3 +626,30 @@ jobs:
tmt_plan: "tier1"
trigger: commit
branch: main

- &tests-main-tier1-rockylinux-9
<<: *tests-tier0-rockylinux-9
# Run test automatically with merge commit to main branch
manual_trigger: false
identifier: "tier1-rl9"
tmt_plan: "tier1"
trigger: commit
branch: main

- &tests-main-tier1-almalinux-9
<<: *tests-tier0-almalinux-9
# Run test automatically with merge commit to main branch
manual_trigger: false
identifier: "tier1-al9"
tmt_plan: "tier1"
trigger: commit
branch: main

- &tests-main-tier1-oraclelinux-9
<<: *tests-tier0-oraclelinux-9
# Run test automatically with merge commit to main branch
manual_trigger: false
identifier: "tier1-ol9"
tmt_plan: "tier1"
trigger: commit
branch: main
1 change: 1 addition & 0 deletions convert2rhel/systeminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# Allowed conversion paths to RHEL. We want to prevent a conversion and minor
# version update at the same time.
RELEASE_VER_MAPPING = {
"9.3": "9.3",
"9.2": "9.2",
"9.1": "9.1",
"9.0": "9.0",
Expand Down
9 changes: 9 additions & 0 deletions plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ adjust+:
- environment+:
SYSTEM_RELEASE_ENV: rocky-8-latest
when: distro == rocky-8-latest
- environment+:
SYSTEM_RELEASE_ENV: oracle-9-latest
when: distro == oracle-9-latest
- environment+:
SYSTEM_RELEASE_ENV: alma-9-latest
when: distro == alma-9-latest
- environment+:
SYSTEM_RELEASE_ENV: rocky-9-latest
when: distro == rocky-9-latest

prepare+:
- name: main preparation step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ def _check_eus_enabled_repos_rhel8(enabled_repos):
assert appstream_repo in enabled_repos


def _check_enabled_repos_rhel9(enabled_repos):
"""Helper function to assert RHEL repositories."""
baseos_repo = "rhel-9-for-x86_64-baseos-rpms"
appstream_repo = "rhel-9-for-x86_64-appstream-rpms"

assert baseos_repo in enabled_repos
assert appstream_repo in enabled_repos


def _check_eus_enabled_repos_rhel9(enabled_repos):
"""Helper function to assert EUS repositories."""
baseos_repo = "rhel-8-for-x86_64-baseos-eus-rpms"
appstream_repo = "rhel-9-for-x86_64-appstream-eus-rpms"

assert baseos_repo in enabled_repos
assert appstream_repo in enabled_repos


@pytest.mark.test_enabled_repositories
def test_enabled_repositories(shell, system_release):
"""
Expand All @@ -33,13 +51,20 @@ def test_enabled_repositories(shell, system_release):
try:
# Using system_release fixture here, to read live data from /etc/os-release or /etc/system-release.
# Usage of hardcoded environment variable SYSTEM_RELEASE_ENV is not feasible.
if re.match(r"redhat-8\.8", system_release):
# Handle the special test case scenario where we do not use the
# premium account with EUS repositories
if os.path.exists("/non_eus_repos_used"):
_check_enabled_repos_rhel8(enabled_repos)
if re.match(r"redhat-9\.(\d+)", system_release):
if re.match(r"redhat-9\.[2468]]", system_release) and not os.path.exists("/non_eus_repos_used"):
_check_eus_enabled_repos_rhel9(enabled_repos)
else:
# Apart from non-EUS minors, handle the special test case scenario where
# we do not use the premium account with EUS repositories
_check_enabled_repos_rhel9(enabled_repos)
elif re.match(r"redhat-8\.(\d+)", system_release):
if re.match(r"redhat-8\.[68]", system_release) and not os.path.exists("/non_eus_repos_used"):
_check_eus_enabled_repos_rhel8(enabled_repos)
else:
# Apart from non-EUS minors, handle the special test case scenario where
# we do not use the premium account with EUS repositories
_check_enabled_repos_rhel8(enabled_repos)
elif "redhat-8.5" in system_release:
_check_enabled_repos_rhel8(enabled_repos)
elif "redhat-7.9" in system_release:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def test_sanity_conversion(shell):
{"id": "Midnight Oncilla", "name": "AlmaLinux", "version": "8.9"},
{"id": "Green Obsidian", "name": "Rocky Linux", "version": "8.9"},
),
"Red Hat Enterprise Linux release 9.3 (Plow)": (
{"id": "null", "name": "Oracle Linux Server", "version": "9.3"},
{"id": "Shamrock Pampas Cat", "name": "AlmaLinux", "version": "9.3"},
{"id": "Blue Onyx", "name": "Rocky Linux", "version": "9.3"},
),
}


Expand Down

0 comments on commit e69dc25

Please sign in to comment.