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

Add missing controller test for PoolName #1069

Merged
merged 2 commits into from
Nov 22, 2024
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
17 changes: 17 additions & 0 deletions controllers/numaresourcesoperator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ var _ = Describe("Test NUMAResourcesOperator Reconcile", func() {
})
})

Context("with PoolName set to empty string", func() {
It("should update the CR condition to degraded", func() {
pn := ""
ng := nropv1.NodeGroup{
PoolName: &pn,
}
nro := testobjs.NewNUMAResourcesOperator(objectnames.DefaultNUMAResourcesOperatorCrName, ng)
verifyDegradedCondition(nro, validation.NodeGroupsError, platf)
})
})

Context("with NRO mutiple pool specifiers set on same node group", func() {
It("should update the CR condition to degraded", func() {
pn := "test"
Expand Down Expand Up @@ -211,6 +222,12 @@ var _ = Describe("Test NUMAResourcesOperator Reconcile", func() {
result, err := reconciler.Reconcile(context.TODO(), reconcile.Request{NamespacedName: nroKey})
Expect(err).ToNot(HaveOccurred())
Expect(result).To(Equal(reconcile.Result{}))

Expect(reconciler.Client.Get(context.TODO(), client.ObjectKeyFromObject(nro), nro)).ToNot(HaveOccurred())

availableCondition := getConditionByType(nro.Status.Conditions, status.ConditionAvailable)
Expect(availableCondition).ToNot(BeNil())
Expect(availableCondition.Status).To(Equal(metav1.ConditionTrue))
})

It("should create all CRDs and objects and operator status are updated from the first reconcile iteration", func() {
Expand Down