Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/e2e/mcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ func TestKernelType(t *testing.T) {
assert.Equal(t, infraNode.Annotations[constants.CurrentMachineConfigAnnotationKey], renderedConfig)
assert.Equal(t, infraNode.Annotations[constants.MachineConfigDaemonStateAnnotationKey], constants.MachineConfigDaemonStateDone)

kernelInfo := execCmdOnNode(t, cs, infraNode, "uname", "-a")
if !strings.Contains(kernelInfo, "PREEMPT RT") {
kernelInfo := execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-qa", "kernel-rt-core")
Copy link
Member

Choose a reason for hiding this comment

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

The -a there is unnecessary (but fine as is, we can address it in a followup). We should also probably make execCmdOnNode do the chroot /rootfs internally because basically everything else in this function is targeting the real root too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-a is not necessary but -a explicitly says query/verify all packages and that made me use it :)
yeah, you are right. We can look at execCmdOnNode() to do chroot /rootfs

Copy link
Member

Choose a reason for hiding this comment

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

the funny thing is the other uses of execCmdOnNode play from outside the chroot by just string matching on files within /rootfs - but I agree we can implement chroot in the function to make it transparent that commands are executed on the node's root directly

if !strings.Contains(kernelInfo, "kernel-rt-core") {
t.Fatalf("Node %s doesn't have expected kernel", infraNode.Name)
}
t.Logf("Node %s has expected kernel", infraNode.Name)
Expand All @@ -210,8 +210,8 @@ func TestKernelType(t *testing.T) {

assert.Equal(t, infraNode.Annotations[constants.CurrentMachineConfigAnnotationKey], oldInfraRenderedConfig)
assert.Equal(t, infraNode.Annotations[constants.MachineConfigDaemonStateAnnotationKey], constants.MachineConfigDaemonStateDone)
kernelInfo = execCmdOnNode(t, cs, infraNode, "uname", "-a")
if strings.Contains(kernelInfo, "PREEMPT RT") {
kernelInfo = execCmdOnNode(t, cs, infraNode, "chroot", "/rootfs", "rpm", "-qa", "kernel-rt-core")
if strings.Contains(kernelInfo, "kernel-rt-core") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if strings.Contains(kernelInfo, "kernel-rt-core") {
if strings.hasPrefix(kernelInfo, "kernel-rt-core") {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! let's fix this in a followup PR to unblock tests and pending prs.

t.Fatalf("Node %s did not rollback successfully", infraNode.Name)
}
t.Logf("Node %s has successfully rolled back", infraNode.Name)
Expand Down