@@ -87,6 +87,24 @@ var _ = Describe("PlacementAPI controller", func() {
8787 condition .InputReadyCondition ,
8888 corev1 .ConditionFalse ,
8989 )
90+ th .ExpectCondition (
91+ names .PlacementAPIName ,
92+ ConditionGetterFunc (PlacementConditionGetter ),
93+ condition .RoleBindingReadyCondition ,
94+ corev1 .ConditionTrue ,
95+ )
96+ th .ExpectCondition (
97+ names .PlacementAPIName ,
98+ ConditionGetterFunc (PlacementConditionGetter ),
99+ condition .RoleReadyCondition ,
100+ corev1 .ConditionTrue ,
101+ )
102+ th .ExpectCondition (
103+ names .PlacementAPIName ,
104+ ConditionGetterFunc (PlacementConditionGetter ),
105+ condition .ServiceAccountReadyCondition ,
106+ corev1 .ConditionTrue ,
107+ )
90108 unknownConditions := []condition.Type {
91109 condition .DBReadyCondition ,
92110 condition .DBSyncReadyCondition ,
@@ -96,14 +114,11 @@ var _ = Describe("PlacementAPI controller", func() {
96114 condition .KeystoneServiceReadyCondition ,
97115 condition .KeystoneEndpointReadyCondition ,
98116 condition .NetworkAttachmentsReadyCondition ,
99- condition .ServiceAccountReadyCondition ,
100- condition .RoleReadyCondition ,
101- condition .RoleBindingReadyCondition ,
102117 }
103118
104119 placement := GetPlacementAPI (names .PlacementAPIName )
105- // +2 as InputReady and Ready is False asserted above
106- Expect (placement .Status .Conditions ).To (HaveLen (len (unknownConditions ) + 2 ))
120+ // +5 as InputReady, Ready, Service and Role are ready is False asserted above
121+ Expect (placement .Status .Conditions ).To (HaveLen (len (unknownConditions ) + 5 ))
107122
108123 for _ , cond := range unknownConditions {
109124 th .ExpectCondition (
@@ -234,6 +249,8 @@ var _ = Describe("PlacementAPI controller", func() {
234249 ContainSubstring ("www_authenticate_uri = %s" , keystoneAPI .Status .APIEndpoints ["public" ]))
235250 Expect (cm .Data ["placement.conf" ]).Should (
236251 ContainSubstring ("username = placement" ))
252+ Expect (cm .Data ["placement.conf" ]).Should (
253+ ContainSubstring ("connection = mysql+pymysql://placement:PlacementDatabasePassword@/placement" ))
237254 })
238255
239256 It ("creates service account, role and rolebindig" , func () {
@@ -361,27 +378,8 @@ var _ = Describe("PlacementAPI controller", func() {
361378
362379 job := th .GetJob (names .DBSyncJobName )
363380 Expect (job .Spec .Template .Spec .Volumes ).To (HaveLen (4 ))
364- Expect (job .Spec .Template .Spec .InitContainers ).To (HaveLen (1 ))
365381 Expect (job .Spec .Template .Spec .Containers ).To (HaveLen (1 ))
366382
367- init := job .Spec .Template .Spec .InitContainers [0 ]
368- Expect (init .VolumeMounts ).To (HaveLen (4 ))
369- Expect (init .Args [1 ]).To (ContainSubstring ("init.sh" ))
370- Expect (init .Image ).To (Equal ("quay.io/podified-antelope-centos9/openstack-placement-api:current-podified" ))
371- env := & corev1.EnvVar {}
372- Expect (init .Env ).To (ContainElement (HaveField ("Name" , "DatabaseHost" ), env ))
373- Expect (env .Value ).To (Equal ("hostname-for-openstack" ))
374- Expect (init .Env ).To (ContainElement (HaveField ("Name" , "DatabaseUser" ), env ))
375- Expect (env .Value ).To (Equal ("placement" ))
376- Expect (init .Env ).To (ContainElement (HaveField ("Name" , "DatabaseName" ), env ))
377- Expect (env .Value ).To (Equal ("placement" ))
378- Expect (init .Env ).To (ContainElement (HaveField ("Name" , "DatabasePassword" ), env ))
379- Expect (env .ValueFrom .SecretKeyRef .LocalObjectReference .Name ).To (Equal (SecretName ))
380- Expect (env .ValueFrom .SecretKeyRef .Key ).To (Equal ("PlacementDatabasePassword" ))
381- Expect (init .Env ).To (ContainElement (HaveField ("Name" , "PlacementPassword" ), env ))
382- Expect (env .ValueFrom .SecretKeyRef .LocalObjectReference .Name ).To (Equal (SecretName ))
383- Expect (env .ValueFrom .SecretKeyRef .Key ).To (Equal ("PlacementPassword" ))
384-
385383 container := job .Spec .Template .Spec .Containers [0 ]
386384 Expect (container .VolumeMounts ).To (HaveLen (4 ))
387385 Expect (container .Image ).To (Equal ("quay.io/podified-antelope-centos9/openstack-placement-api:current-podified" ))
0 commit comments