Skip to content
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

e2e: verify NROP machineconfigs are removed #1073

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions test/e2e/install/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/k8stopologyawareschedwg/deployer/pkg/manifests/rte"
nropv1 "github.com/openshift-kni/numaresources-operator/api/numaresourcesoperator/v1"
"github.com/openshift-kni/numaresources-operator/internal/api/annotations"
"github.com/openshift-kni/numaresources-operator/pkg/objectnames"
"github.com/openshift-kni/numaresources-operator/pkg/status"
machineconfigv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"

Expand Down Expand Up @@ -144,6 +145,22 @@ var _ = Describe("[Install] continuousIntegration", func() {
rteContainer, err := findContainerByName(*ds, containerNameRTE)
Expect(err).ToNot(HaveOccurred())
Expect(rteContainer.SecurityContext.SELinuxOptions.Type).To(Equal(selinux.RTEContextType), "container %s is running with wrong selinux context", rteContainer.Name)

By("checking numaresources machineconfigs removed when no SELinux policy annotation is present")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this test deserves to be running on a suite of its own which will be targeted for the an upgrade lane: openshift/release#58457
@ffromani WDYT?

if !annotations.IsCustomPolicyEnabled(updatedNROObj.Annotations) {
mcps, err := nropmcp.GetListByNodeGroupsV1(context.TODO(), e2eclient.Client, updatedNROObj.Spec.NodeGroups)
Expect(err).NotTo(HaveOccurred())
for _, mcp := range mcps {
mc := &machineconfigv1.MachineConfig{}
// Check mc not created
mcKey := client.ObjectKey{
Name: objectnames.GetMachineConfigName(updatedNROObj.Name, mcp.Name),
}
err := e2eclient.Client.Get(context.TODO(), mcKey, mc)
Expect(err).ToNot(BeNil(), "MachineConfig %s is not expected to to be present", mcKey.String())
Expect(errors.IsNotFound(err)).To(BeTrue(), "Unexpected error occurred while getting MachineConfig %s: %v", mcKey.String(), err)
}
}
})
})
})
Expand Down