Skip to content

Commit 8c283c0

Browse files
committed
Add tests for supported kernel conversion
Signed-off-by: Daniel Diblik <ddiblik@redhat.com>
1 parent 9774bf0 commit 8c283c0

3 files changed

Lines changed: 63 additions & 0 deletions

File tree

plans/tier0.fmf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,46 @@ adjust+:
117117
exclude:
118118
- checks-after-conversion/rhel_subman
119119

120+
/amazon_linux2_supported_kernels:
121+
summary+: |
122+
RHSM conversion on Amazon Linux 2 kernel 5.10 and 5.15
123+
description+: |
124+
Two plans set C2R_AL2_TARGET_KERNEL to 5.10 or 5.15; prepare installs that line and reboots.
125+
Kernel 4.14 is omitted: the test AMI already boots 4.14, so other tier0 runs cover that line.
126+
adjust+:
127+
- enabled: false
128+
when: distro != amazon2
129+
because: The matrix applies only to Amazon Linux 2.
130+
prepare+:
131+
- name: Install and boot the target Amazon Linux 2 kernel
132+
how: shell
133+
script: pytest tests/integration/*/destructive/amazon-linux2-supported-kernels/prepare_boot_target_kernel.py
134+
- name: Reboot into the selected kernel
135+
how: ansible
136+
playbook: tests/ansible_collections/roles/reboot/main.yml
137+
/kernel_5_4:
138+
summary+: Boot into kernel-5.4 then convert
139+
environment+:
140+
C2R_AL2_TARGET_KERNEL: "kernel-5.4"
141+
discover+:
142+
test+<:
143+
- conversion-method/activation_key_conversion
144+
/kernel_5_10:
145+
summary+: Boot into kernel-5.10 then convert
146+
environment+:
147+
C2R_AL2_TARGET_KERNEL: "kernel-5.10"
148+
discover+:
149+
test+<:
150+
- conversion-method/activation_key_conversion
151+
152+
/kernel_5_15:
153+
summary+: Boot into kernel-5.15 then convert
154+
environment+:
155+
C2R_AL2_TARGET_KERNEL: "kernel-5.15"
156+
discover+:
157+
test+<:
158+
- conversion-method/activation_key_conversion
159+
120160

121161
/single_yum_transaction:
122162
/packages_upgraded_after_conversion:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary+: |
2+
Amazon Linux 2 supported kernel
3+
4+
description+: |
5+
Plans boot into Amazon Linux 2 kernel 5.4, 5.10 or 5.15 (extras); 4.14 is covered by the default
6+
test AMI and other tier0 scenarios. Each plan performs a full RHSM conversion with the usual
7+
destructive reboot and post-conversion checks.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
5+
6+
def test_upgrade_amzn2_kernel(shell):
7+
"""
8+
tmt prepare step: install the Amazon Linux 2 kernel line from C2R_AL2_TARGET_KERNEL
9+
(5.4, 5.10 or 5.15), set GRUB default, and mkconfig. A follow-up ansible reboot applies it.
10+
"""
11+
target_kernel = os.environ.get("C2R_AL2_TARGET_KERNEL")
12+
13+
assert shell(["amazon-linux-extras", "install", "-y", target_kernel]).returncode == 0
14+
vmlinuz = shell("rpm -q --last kernel | head -1 | cut -d ' ' -f1 | sed 's/kernel-/\/boot\/vmlinux-/'").output
15+
assert shell(["grubby", "--set-default", vmlinuz]).returncode == 0
16+
assert shell(["grub2-mkconfig", "-o", "/boot/grub2/grub.cfg"]).returncode == 0

0 commit comments

Comments
 (0)