@@ -19,13 +19,15 @@ package functional_test
1919import (
2020 . "github.com/onsi/gomega" //revive:disable:dot-imports
2121
22+ appsv1 "k8s.io/api/apps/v1"
2223 batchv1 "k8s.io/api/batch/v1"
2324 corev1 "k8s.io/api/core/v1"
2425 k8s_errors "k8s.io/apimachinery/pkg/api/errors"
2526 "k8s.io/apimachinery/pkg/types"
2627 "sigs.k8s.io/controller-runtime/pkg/client"
2728
2829 heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1"
30+ "github.com/openstack-k8s-operators/heat-operator/internal/heat"
2931 rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
3032 condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
3133)
@@ -155,6 +157,81 @@ func GetHeatSpecWithNotificationsBus(notificationsCluster *string, notifications
155157 return spec
156158}
157159
160+ func simulateHeatSubCRReady (g Gomega , name types.NamespacedName ) {
161+ heatAPI := & heatv1.HeatAPI {}
162+ g .Expect (k8sClient .Get (ctx , types.NamespacedName {
163+ Namespace : name .Namespace ,
164+ Name : name .Name + "-api" ,
165+ }, heatAPI )).To (Succeed ())
166+ heatAPI .Status .ObservedGeneration = heatAPI .Generation
167+ heatAPI .Status .ReadyCount = 1
168+ heatAPI .Status .Conditions .MarkTrue (condition .ReadyCondition , condition .ReadyMessage )
169+ g .Expect (k8sClient .Status ().Update (ctx , heatAPI )).To (Succeed ())
170+
171+ heatCfnAPI := & heatv1.HeatCfnAPI {}
172+ g .Expect (k8sClient .Get (ctx , types.NamespacedName {
173+ Namespace : name .Namespace ,
174+ Name : name .Name + "-cfnapi" ,
175+ }, heatCfnAPI )).To (Succeed ())
176+ heatCfnAPI .Status .ObservedGeneration = heatCfnAPI .Generation
177+ heatCfnAPI .Status .ReadyCount = 1
178+ heatCfnAPI .Status .Conditions .MarkTrue (condition .ReadyCondition , condition .ReadyMessage )
179+ g .Expect (k8sClient .Status ().Update (ctx , heatCfnAPI )).To (Succeed ())
180+
181+ heatEngine := & heatv1.HeatEngine {}
182+ g .Expect (k8sClient .Get (ctx , types.NamespacedName {
183+ Namespace : name .Namespace ,
184+ Name : name .Name + "-engine" ,
185+ }, heatEngine )).To (Succeed ())
186+ heatEngine .Status .ObservedGeneration = heatEngine .Generation
187+ heatEngine .Status .ReadyCount = 1
188+ heatEngine .Status .Conditions .MarkTrue (condition .ReadyCondition , condition .ReadyMessage )
189+ g .Expect (k8sClient .Status ().Update (ctx , heatEngine )).To (Succeed ())
190+ }
191+
192+ func simulateHeatSubServicesReady (name types.NamespacedName ) {
193+ Eventually (func (g Gomega ) {
194+ for _ , depName := range []string {"heat-api" , "heat-cfnapi" , "heat-engine" } {
195+ deployment := & appsv1.Deployment {}
196+ g .Expect (k8sClient .Get (ctx , types.NamespacedName {
197+ Namespace : name .Namespace ,
198+ Name : depName ,
199+ }, deployment )).To (Succeed ())
200+ }
201+ }, timeout , interval ).Should (Succeed ())
202+ th .SimulateDeploymentReplicaReady (types.NamespacedName {
203+ Namespace : name .Namespace ,
204+ Name : "heat-api" ,
205+ })
206+ th .SimulateDeploymentReplicaReady (types.NamespacedName {
207+ Namespace : name .Namespace ,
208+ Name : "heat-cfnapi" ,
209+ })
210+ th .SimulateDeploymentReplicaReady (types.NamespacedName {
211+ Namespace : name .Namespace ,
212+ Name : "heat-engine" ,
213+ })
214+ Eventually (func (g Gomega ) {
215+ simulateHeatSubCRReady (g , name )
216+ }, timeout , interval ).Should (Succeed ())
217+ keystone .SimulateKeystoneServiceReady (types.NamespacedName {
218+ Namespace : name .Namespace ,
219+ Name : heat .ServiceName ,
220+ })
221+ keystone .SimulateKeystoneEndpointReady (types.NamespacedName {
222+ Namespace : name .Namespace ,
223+ Name : heat .ServiceName ,
224+ })
225+ keystone .SimulateKeystoneServiceReady (types.NamespacedName {
226+ Namespace : name .Namespace ,
227+ Name : heat .CfnServiceName ,
228+ })
229+ keystone .SimulateKeystoneEndpointReady (types.NamespacedName {
230+ Namespace : name .Namespace ,
231+ Name : heat .CfnServiceName ,
232+ })
233+ }
234+
158235func GetTransportURL (name types.NamespacedName ) * rabbitmqv1.TransportURL {
159236 instance := & rabbitmqv1.TransportURL {}
160237 Eventually (func (g Gomega ) {
0 commit comments