@@ -93,7 +93,6 @@ var _ = Describe("DPFHCPBridge Integration Tests with envtest", func() {
9393 initialGeneration := toUpdate .Generation
9494 // Update only mutable fields
9595 toUpdate .Spec .OCPReleaseImage = "quay.io/openshift-release-dev/ocp-release:4.19.0-ec.6-multi"
96- toUpdate .Spec .VirtualIP = "192.168.1.100"
9796
9897 err = k8sClient .Update (ctx , toUpdate )
9998 Expect (err ).NotTo (HaveOccurred ())
@@ -103,7 +102,6 @@ var _ = Describe("DPFHCPBridge Integration Tests with envtest", func() {
103102 err = k8sClient .Get (ctx , types.NamespacedName {Name : bridgeName , Namespace : "default" }, updated )
104103 Expect (err ).NotTo (HaveOccurred ())
105104 Expect (updated .Spec .OCPReleaseImage ).To (Equal ("quay.io/openshift-release-dev/ocp-release:4.19.0-ec.6-multi" ))
106- Expect (updated .Spec .VirtualIP ).To (Equal ("192.168.1.100" ))
107105 Expect (updated .Generation ).To (BeNumerically (">" , initialGeneration ))
108106
109107 // DELETE
@@ -241,91 +239,6 @@ var _ = Describe("DPFHCPBridge Integration Tests with envtest", func() {
241239 })
242240 })
243241
244- Context ("CRD Validation with envtest" , func () {
245- It ("should reject CR with invalid baseDomain at API server level" , func () {
246- bridge := & provisioningv1alpha1.DPFHCPBridge {
247- ObjectMeta : metav1.ObjectMeta {
248- Name : "invalid-domain" ,
249- Namespace : "default" ,
250- },
251- Spec : provisioningv1alpha1.DPFHCPBridgeSpec {
252- DPUClusterRef : provisioningv1alpha1.DPUClusterReference {
253- Name : "test-dpu" ,
254- Namespace : "dpu-system" ,
255- },
256- BaseDomain : "INVALID.DOMAIN.COM" , // Uppercase not allowed
257- OCPReleaseImage : "quay.io/openshift-release-dev/ocp-release:4.19.0-ec.5-multi" ,
258- SSHKeySecretRef : corev1.LocalObjectReference {Name : "test-ssh-key" },
259- PullSecretRef : corev1.LocalObjectReference {Name : "test-pull-secret" },
260- EtcdStorageClass : "test-storage-class" ,
261- ControlPlaneAvailabilityPolicy : hyperv1 .SingleReplica ,
262- },
263- }
264-
265- err := k8sClient .Create (ctx , bridge )
266- Expect (err ).To (HaveOccurred (), "Invalid baseDomain should be rejected by CRD validation" )
267- })
268-
269- It ("should reject CR missing required fields at API server level" , func () {
270- bridge := & provisioningv1alpha1.DPFHCPBridge {
271- ObjectMeta : metav1.ObjectMeta {
272- Name : "missing-required" ,
273- Namespace : "default" ,
274- },
275- Spec : provisioningv1alpha1.DPFHCPBridgeSpec {
276- DPUClusterRef : provisioningv1alpha1.DPUClusterReference {
277- Name : "test-dpu" ,
278- Namespace : "dpu-system" ,
279- },
280- // Missing BaseDomain (required)
281- OCPReleaseImage : "quay.io/openshift-release-dev/ocp-release:4.19.0-ec.5-multi" ,
282- SSHKeySecretRef : corev1.LocalObjectReference {Name : "test-ssh-key" },
283- PullSecretRef : corev1.LocalObjectReference {Name : "test-pull-secret" },
284- EtcdStorageClass : "test-storage-class" ,
285- ControlPlaneAvailabilityPolicy : hyperv1 .SingleReplica ,
286- },
287- }
288-
289- err := k8sClient .Create (ctx , bridge )
290- Expect (err ).To (HaveOccurred (), "Missing required field should be rejected by CRD validation" )
291- })
292-
293- It ("should apply defaults when optional fields are omitted" , func () {
294- bridge := & provisioningv1alpha1.DPFHCPBridge {
295- ObjectMeta : metav1.ObjectMeta {
296- Name : "test-defaults-applied" ,
297- Namespace : "default" ,
298- },
299- Spec : provisioningv1alpha1.DPFHCPBridgeSpec {
300- DPUClusterRef : provisioningv1alpha1.DPUClusterReference {
301- Name : "test-dpu" ,
302- Namespace : "dpu-system" ,
303- },
304- BaseDomain : "defaults.example.com" ,
305- OCPReleaseImage : "quay.io/openshift-release-dev/ocp-release:4.19.0-ec.5-multi" ,
306- SSHKeySecretRef : corev1.LocalObjectReference {Name : "test-ssh-key" },
307- PullSecretRef : corev1.LocalObjectReference {Name : "test-pull-secret" },
308- EtcdStorageClass : "test-storage-class" ,
309- VirtualIP : "192.168.1.100" , // Required for HighlyAvailable default
310- // Optional fields omitted - defaults should be applied
311- },
312- }
313-
314- err := k8sClient .Create (ctx , bridge )
315- Expect (err ).NotTo (HaveOccurred ())
316-
317- created := & provisioningv1alpha1.DPFHCPBridge {}
318- err = k8sClient .Get (ctx , types.NamespacedName {Name : "test-defaults-applied" , Namespace : "default" }, created )
319- Expect (err ).NotTo (HaveOccurred ())
320-
321- // Verify defaults
322- Expect (created .Spec .ControlPlaneAvailabilityPolicy ).To (Equal (hyperv1 .HighlyAvailable ))
323-
324- // Clean up
325- _ = k8sClient .Delete (ctx , bridge )
326- })
327- })
328-
329242 Context ("List Operations" , func () {
330243 It ("should list multiple DPFHCPBridge resources" , func () {
331244 // Create multiple bridges
0 commit comments