Skip to content

Commit

Permalink
Test for bad PVC specification
Browse files Browse the repository at this point in the history
Signed-off-by: Mike McKiernan <[email protected]>
  • Loading branch information
mikemckiernan committed Aug 12, 2024
1 parent 7f8ed8e commit a57125c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions internal/controller/nimcache_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ var _ = Describe("NIMCache Controller", func() {
return client.Get(ctx, pvcName, pvc)
}, time.Second*10).Should(Succeed())
})

It("should return an error if the PVC size is not specified", func() {
ctx := context.TODO()
NIMCache := &appsv1alpha1.NIMCache{
ObjectMeta: metav1.ObjectMeta{
Name: "test-nimcache",
Namespace: "default",
},
Spec: appsv1alpha1.NIMCacheSpec{
Source: appsv1alpha1.NIMSource{NGC: &appsv1alpha1.NGCSource{ModelPuller: "test-container", PullSecret: "my-secret"}},
Storage: appsv1alpha1.Storage{PVC: appsv1alpha1.PersistentVolumeClaim{Create: ptr.To[bool](true), StorageClass: "standard"}},
},
Status: appsv1alpha1.NIMCacheStatus{
State: appsv1alpha1.NimCacheStatusNotReady,
},
}
Expect(client.Create(ctx, NIMCache)).To(Succeed())

// Reconcile the resource
_, err := reconciler.reconcileNIMCache(ctx, NIMCache)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("failed to parse size for pvc creation"))
})
})

Context("When the Job completes", func() {
Expand Down

0 comments on commit a57125c

Please sign in to comment.