-
Notifications
You must be signed in to change notification settings - Fork 87
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
[RHELC-642] Add integration test that install custom kernel #529
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Isn't this a copy paste error? |
||||||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kokesak does this still work? Because we have a check in Convert2RHEL to prevent UEK kernels to pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r0x0d if the check works, then the conversion should inhibit. We can keep the UEK kernel install here as well as add a scenario where the non-uek kernel is installed on centos to test that as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right... I'm having some troubles to reproduce this locally because of those checks. Do you have a step-by-step on how to do it?
Tried with the UEK and then the conversion halts on that check. Tried OL7 kernel, but it is the same version of CentOS 7 (no downgrades available for both of them)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe I had similar problem when installing OL7 kernel on CentOS so I used the UEK. I'll try it and let you know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I tried to follow the steps in this test, but didn't work because of the checks we have in place for UEK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kokesak tried with this one and it worked: https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/kernel-3.10.0-1160.76.1.0.1.el7.x86_64.rpm
Maybe we can adapt the test to include this kernel instead of the UEK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, @kokesak, do you want to merge this PR with mine, so we get everything in one place?
I can cherry-pick your changes here and merge into mine if you think that is worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r0x0d nice that it works. It will be nice to have it under the same PR. I will add the commit to your PR myself and close this one, you dont have to do it.