-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Integration test to ckeck the presence of the custom kernel insta…
…lled
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/integration/tier0/custom-kernel/install_custom_kernel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import platform | ||
|
||
from envparse import env | ||
|
||
|
||
def test_install_custom_kernel(shell): | ||
# We install CentOS kernel on Oracle Linux and vice versa to mimic the custom kernel | ||
# that is not signed by the running OS official vendor | ||
system_version = platform.platform() | ||
|
||
if "centos-7" in system_version: | ||
# Install dependency for kernel-uek | ||
assert ( | ||
shell( | ||
"yum install https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/linux-firmware-20200124-999.4.git1eb2408c.el7.noarch.rpm -y" | ||
).returncode | ||
== 0 | ||
) | ||
assert ( | ||
shell( | ||
"yum install https://yum.oracle.com/repo/OracleLinux/OL7/UEKR6/x86_64/getPackage/kernel-uek-5.4.17-2011.0.7.el7uek.x86_64.rpm -y" | ||
).returncode | ||
== 0 | ||
) | ||
shell("grub2-set-default 'CentOS Linux (5.4.17-2011.0.7.el7uek.x86_64) 7 (Core)'") | ||
elif "oracle-7" in system_version: | ||
assert ( | ||
shell( | ||
"yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/kernel-3.10.0-1160.el7.x86_64.rpm -y" | ||
).returncode | ||
== 0 | ||
) | ||
shell("grub2-set-default 'Oracle Linux Server 7.9, with Linux 3.10.0-1160.el7.x86_64'") | ||
elif "centos-8.4" in system_version: | ||
assert ( | ||
shell( | ||
"yum install https://yum.oracle.com/repo/OracleLinux/OL8/4/baseos/base/x86_64/getPackage/kernel-core-4.18.0-305.el8.x86_64.rpm -y" | ||
).returncode | ||
== 0 | ||
) | ||
shell("grub2-set-default 'Oracle Linux Server (4.18.0-305.el8.x86_64) 8.4'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
summary: custom kernel inhibitor | ||
|
||
tier: 0 | ||
|
||
test: | | ||
pytest -svv |
18 changes: 18 additions & 0 deletions
18
tests/integration/tier0/custom-kernel/test_cutsom_kernel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import platform | ||
|
||
from envparse import env | ||
|
||
|
||
def test_custom_kernel(convert2rhel): | ||
# Run c2r with --variant option | ||
system_version = platform.platform() | ||
|
||
if "centos-7" in system_version: | ||
string = "CentOS" | ||
elif "oracle-7" in system_version: | ||
string = "Oracle" | ||
|
||
with convert2rhel(("--no-rpm-va --debug")) as c2r: | ||
c2r.expect("WARNING - Custom kernel detected. The booted kernel needs to be signed by") | ||
c2r.expect("CRITICAL - The booted kernel version is incompatible with the standard RHEL kernel.") | ||
assert c2r.exitstatus != 0 |