@@ -598,38 +598,40 @@ func TestROSARoleConfigReconcileExist(t *testing.T) {
598598 // Assertions - since all resources exist, reconciliation should succeed
599599 g .Expect (errReconcile ).ToNot (HaveOccurred ())
600600
601- // Sleep to ensure the status is updated
602- time . Sleep ( 100 * time . Millisecond )
603-
604- // Check the status of the ROSARoleConfig resource
605- updatedRoleConfig : = & expinfrav1.ROSARoleConfig {}
606- err = reconciler .Client .Get (ctx , req .NamespacedName , updatedRoleConfig )
607- g . Expect ( err ). ToNot ( HaveOccurred ())
608-
609- // Verify that all existing account roles are preserved
610- g .Expect (updatedRoleConfig .Status .AccountRolesRef .InstallerRoleARN ).To (Equal ("arn:aws:iam::123456789012:role/test-HCP-ROSA-Installer -Role" ))
611- g .Expect (updatedRoleConfig .Status .AccountRolesRef .SupportRoleARN ).To (Equal ("arn:aws:iam::123456789012:role/test-HCP-ROSA-Support -Role" ))
612- g . Expect ( updatedRoleConfig . Status . AccountRolesRef . WorkerRoleARN ). To ( Equal ( "arn:aws:iam::123456789012:role/test-HCP-ROSA-Worker-Role" ))
613-
614- // Verify OIDC config is preserved
615- g .Expect (updatedRoleConfig .Status .OIDCID ).To (Equal ("test-existing-oidc-id" ))
616- g . Expect ( updatedRoleConfig . Status . OIDCProviderARN ). To ( Equal ( "arn:aws:iam::123456789012:oidc-provider/test-existing-oidc-id" ))
617-
618- // Verify operator roles are populated with existing roles
619- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .IngressARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-ingress-operator -cloud-credentials" ))
620- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .ImageRegistryARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-image-registry-installer -cloud-credentials" ))
621- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .StorageARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-cluster-csi-drivers-ebs -cloud-credentials" ))
622- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .NetworkARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-cloud-network-config- controller-cloud-credentials " ))
623- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .KubeCloudControllerARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-kube -controller-manager" ))
624- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .NodePoolManagementARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-capa-controller-manager " ))
625- g .Expect (updatedRoleConfig .Status .OperatorRolesRef .ControlPlaneOperatorARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-control-plane-operator " ))
626- g . Expect ( updatedRoleConfig . Status . OperatorRolesRef . KMSProviderARN ). To ( Equal ( "arn:aws:iam::123456789012:role/test-kube-system-kms-provider" ))
601+ var updatedRoleConfig * expinfrav1. ROSARoleConfig
602+
603+ g . Eventually ( func ( g Gomega ) {
604+ // Check the status of the ROSARoleConfig resource
605+ updatedRoleConfig = & expinfrav1.ROSARoleConfig {}
606+ g . Expect ( reconciler .Client .Get (ctx , req .NamespacedName , updatedRoleConfig )). ToNot ( HaveOccurred () )
607+
608+ // Verify that all existing account roles are preserved
609+ g . Expect ( updatedRoleConfig . Status . AccountRolesRef . InstallerRoleARN ). To ( Equal ( "arn:aws:iam::123456789012:role/test-HCP-ROSA-Installer-Role" ))
610+ g .Expect (updatedRoleConfig .Status .AccountRolesRef .SupportRoleARN ).To (Equal ("arn:aws:iam::123456789012:role/test-HCP-ROSA-Support -Role" ))
611+ g .Expect (updatedRoleConfig .Status .AccountRolesRef .WorkerRoleARN ).To (Equal ("arn:aws:iam::123456789012:role/test-HCP-ROSA-Worker -Role" ))
612+
613+ // Verify OIDC config is preserved
614+ g . Expect ( updatedRoleConfig . Status . OIDCID ). To ( Equal ( "test-existing-oidc-id" ))
615+ g .Expect (updatedRoleConfig .Status .OIDCProviderARN ).To (Equal ("arn:aws:iam::123456789012:oidc-provider/ test-existing-oidc-id" ))
616+
617+ // Verify operator roles are populated with existing roles
618+ g . Expect ( updatedRoleConfig . Status . OperatorRolesRef . IngressARN ). To ( Equal ( "arn:aws:iam::123456789012:role/test-openshift-ingress- operator-cloud-credentials" ))
619+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .ImageRegistryARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-image-registry-installer -cloud-credentials" ))
620+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .StorageARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-cluster-csi-drivers-ebs -cloud-credentials" ))
621+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .NetworkARN ).To (Equal ("arn:aws:iam::123456789012:role/test-openshift-cloud-network-config-controller -cloud-credentials" ))
622+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .KubeCloudControllerARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-kube- controller-manager " ))
623+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .NodePoolManagementARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-capa -controller-manager" ))
624+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .ControlPlaneOperatorARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-control-plane-operator " ))
625+ g .Expect (updatedRoleConfig .Status .OperatorRolesRef .KMSProviderARN ).To (Equal ("arn:aws:iam::123456789012:role/test-kube-system-kms-provider " ))
626+ }). Should ( Succeed ( ))
627627
628628 // Should have a condition indicating success - expect Ready condition to be True
629- readyCondition := v1beta1conditions .Get (updatedRoleConfig , expinfrav1 .RosaRoleConfigReadyCondition )
630- g .Expect (readyCondition ).ToNot (BeNil ())
631- g .Expect (readyCondition .Status ).To (Equal (corev1 .ConditionTrue ))
632- g .Expect (readyCondition .Reason ).To (Equal (expinfrav1 .RosaRoleConfigCreatedReason ))
629+ g .Eventually (func (g Gomega ) {
630+ readyCondition := v1beta1conditions .Get (updatedRoleConfig , expinfrav1 .RosaRoleConfigReadyCondition )
631+ g .Expect (readyCondition ).ToNot (BeNil ())
632+ g .Expect (readyCondition .Status ).To (Equal (corev1 .ConditionTrue ))
633+ g .Expect (readyCondition .Reason ).To (Equal (expinfrav1 .RosaRoleConfigCreatedReason ))
634+ }).Should (Succeed ())
633635}
634636
635637func TestROSARoleConfigReconcileDelete (t * testing.T ) {
0 commit comments