From 721977661639dcd97a8c69b5d0a7c8eff1ebfd86 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Fri, 20 Oct 2023 10:56:39 +0200 Subject: [PATCH] Improve functional tests to support single mode API This commit improves the existing functional tests to reflect the new changes introduced by the previous patches. In particular the glance_controller_test: 1. handles the creation of a single API (split vs single) 2. checks if a CronJob exists when the main CR is created 3. checks if a PVC associated to imageCacheSize exists Signed-off-by: Francesco Pantano --- test/functional/base_test.go | 17 ++- test/functional/glance_controller_test.go | 58 ++++++---- test/functional/glance_test_data.go | 21 +++- test/functional/glanceapi_controller_test.go | 115 ++++++++++++------- 4 files changed, 144 insertions(+), 67 deletions(-) diff --git a/test/functional/base_test.go b/test/functional/base_test.go index 3e115e32d..4836a60ce 100644 --- a/test/functional/base_test.go +++ b/test/functional/base_test.go @@ -28,6 +28,7 @@ import ( glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1" "github.com/openstack-k8s-operators/lib-common/modules/common/condition" + batchv1 "k8s.io/api/batch/v1" ) func GetGlance(name types.NamespacedName) *glancev1.Glance { @@ -154,10 +155,9 @@ func CreateGlanceSecret(namespace string, name string) *corev1.Secret { func GetDefaultGlanceSpec() map[string]interface{} { return map[string]interface{}{ - "databaseInstance": "openstack", - "secret": SecretName, - "glanceAPIInternal": GetDefaultGlanceAPITemplate(GlanceAPITypeInternal), - "glanceAPIExternal": GetDefaultGlanceAPITemplate(GlanceAPITypeExternal), + "databaseInstance": "openstack", + "secret": SecretName, + "glanceAPI": GetDefaultGlanceAPITemplate(GlanceAPITypeSingle), } } @@ -212,3 +212,12 @@ func AssertPVCExist(name types.NamespacedName) { g.Expect(k8s_errors.IsNotFound(err)).To(BeFalse()) }, th.Timeout, th.Interval).Should(Succeed()) } + +// AssertCronJobDoesNotExist ensures the CronJob resource does not exist in a k8s cluster. +func AssertCronJobDoesNotExist(name types.NamespacedName) { + instance := &batchv1.CronJob{} + Eventually(func(g Gomega) { + err := th.K8sClient.Get(th.Ctx, name, instance) + g.Expect(k8s_errors.IsNotFound(err)).To(BeTrue()) + }, th.Timeout, th.Interval).Should(Succeed()) +} diff --git a/test/functional/glance_controller_test.go b/test/functional/glance_controller_test.go index a0cfd00fb..c3d89814e 100644 --- a/test/functional/glance_controller_test.go +++ b/test/functional/glance_controller_test.go @@ -116,6 +116,9 @@ var _ = Describe("Glance controller", func() { It("should not have a pvc yet", func() { AssertPVCDoesNotExist(glanceTest.Instance) }) + It("dbPurge cronJob does not exist yet", func() { + AssertCronJobDoesNotExist(glanceTest.Instance) + }) }) When("Glance DB is created", func() { BeforeEach(func() { @@ -216,7 +219,6 @@ var _ = Describe("Glance controller", func() { It("has the expected container image defaults", func() { glanceDefault := GetGlance(glanceTest.Instance) Expect(glanceDefault.Spec.GlanceAPI.ContainerImage).To(Equal(util.GetEnvVar("RELATED_IMAGE_GLANCE_API_IMAGE_URL_DEFAULT", glancev1.GlanceAPIContainerImage))) - //Expect(glanceDefault.Spec.GlanceAPIs.GlanceAPIInternal.ContainerImage).To(Equal(util.GetEnvVar("RELATED_IMAGE_GLANCE_API_IMAGE_URL_DEFAULT", glancev1.GlanceAPIContainerImage))) }) }) When("All the Resources are ready", func() { @@ -239,15 +241,21 @@ var _ = Describe("Glance controller", func() { keystone.SimulateKeystoneServiceReady(glanceTest.Instance) keystone.SimulateKeystoneEndpointReady(glanceTest.GlancePublicRoute) }) - It("should have a local pvc", func() { + It("should have a local pvc but not for cache", func() { AssertPVCExist(glanceTest.Instance) AssertPVCDoesNotExist(glanceTest.GlanceCache) }) It("Creates glanceAPI", func() { + // Default type is "split", make sure that behind the scenes two + // glanceAPI deployment are created GlanceAPIExists(glanceTest.GlanceExternal) + GlanceAPIExists(glanceTest.GlanceInternal) }) It("Assert Services are created", func() { + // Both glance-public and glance-internal svc are created regardless + // if we split behind the scenes th.AssertServiceExists(glanceTest.GlancePublicSvc) + th.AssertServiceExists(glanceTest.GlanceInternalSvc) }) It("should not have a cache pvc (no imageCacheSize provided)", func() { AssertPVCDoesNotExist(glanceTest.GlanceCache) @@ -282,26 +290,34 @@ var _ = Describe("Glance controller", func() { BeforeEach(func() { nad := th.CreateNetworkAttachmentDefinition(glanceTest.InternalAPINAD) DeferCleanup(th.DeleteInstance, nad) - var externalEndpoints []interface{} - externalEndpoints = append( - externalEndpoints, map[string]interface{}{ - "endpoint": "internal", - "ipAddressPool": "osp-internalapi", - "loadBalancerIPs": []string{"10.1.0.1", "10.1.0.2"}, + + serviceOverride := map[string]interface{}{} + serviceOverride["internal"] = map[string]interface{}{ + "metadata": map[string]map[string]string{ + "annotations": { + "metallb.universe.tf/address-pool": "osp-internalapi", + "metallb.universe.tf/allow-shared-ip": "osp-internalapi", + "metallb.universe.tf/loadBalancerIPs": "internal-lb-ip-1,internal-lb-ip-2", + }, + "labels": { + "internal": "true", + "service": "glance", + }, }, - ) + "spec": map[string]interface{}{ + "type": "LoadBalancer", + }, + } rawSpec := map[string]interface{}{ "storageRequest": glanceTest.GlancePVCSize, "secret": SecretName, "databaseInstance": "openstack", - "glanceAPIInternal": map[string]interface{}{ - "containerImage": glancev1.GlanceAPIContainerImage, - "networkAttachments": []string{"internalapi"}, - "externalEndpoints": externalEndpoints, - }, "glanceAPI": map[string]interface{}{ "containerImage": glancev1.GlanceAPIContainerImage, "networkAttachments": []string{"internalapi"}, + "override": map[string]interface{}{ + "service": serviceOverride, + }, }, } DeferCleanup(th.DeleteInstance, CreateGlance(glanceTest.Instance, rawSpec)) @@ -327,20 +343,22 @@ var _ = Describe("Glance controller", func() { keystone.SimulateKeystoneServiceReady(glanceTest.Instance) }) It("Check the resulting endpoints of the generated sub-CRs", func() { - /*th.SimulateDeploymentReadyWithPods( + th.SimulateDeploymentReadyWithPods( glanceTest.GlanceInternalAPI, map[string][]string{glanceName.Namespace + "/internalapi": {"10.0.0.1"}}, - )*/ + ) th.SimulateDeploymentReadyWithPods( glanceTest.GlanceExternalAPI, map[string][]string{glanceName.Namespace + "/internalapi": {"10.0.0.1"}}, ) - // Retrieve the generated resources + // Retrieve the generated resources and the two internal/external + // instances that are split behind the scenes glance := GetGlance(glanceTest.Instance) - //internalAPI := GetGlanceAPI(glanceTest.GlanceInternal) + internalAPI := GetGlanceAPI(glanceTest.GlanceInternal) externalAPI := GetGlanceAPI(glanceTest.GlanceExternal) - // Check GlanceAPI NADs - //Expect(internalAPI.Spec.NetworkAttachments).To(Equal(glance.Spec.GlanceAPIs.GlanceAPIInternal.NetworkAttachments)) + // Check GlanceAPI(s): we expect the two instances (internal/external) + // to have the same NADs as we mirror the deployment + Expect(internalAPI.Spec.NetworkAttachments).To(Equal(glance.Spec.GlanceAPI.NetworkAttachments)) Expect(externalAPI.Spec.NetworkAttachments).To(Equal(glance.Spec.GlanceAPI.NetworkAttachments)) }) }) diff --git a/test/functional/glance_test_data.go b/test/functional/glance_test_data.go index 75a1f28f6..c8aa0e4a0 100644 --- a/test/functional/glance_test_data.go +++ b/test/functional/glance_test_data.go @@ -27,6 +27,8 @@ const ( GlanceAPITypeInternal APIType = "internal" //GlanceAPITypeExternal - GlanceAPITypeExternal APIType = "external" + //GlanceAPITypeSingle - + GlanceAPITypeSingle APIType = "single" ) // GlanceTestData is the data structure used to provide input data to envTest @@ -39,6 +41,7 @@ type GlanceTestData struct { GlancePort string GlanceQuotas map[string]interface{} Instance types.NamespacedName + GlanceSingle types.NamespacedName GlanceInternal types.NamespacedName GlanceExternal types.NamespacedName GlanceRole types.NamespacedName @@ -47,11 +50,13 @@ type GlanceTestData struct { GlanceDBSync types.NamespacedName GlancePublicRoute types.NamespacedName GlancePublicSvc types.NamespacedName - GlanceInternalRoute types.NamespacedName + GlanceInternalSvc types.NamespacedName GlanceService types.NamespacedName GlanceConfigMapData types.NamespacedName GlanceInternalConfigMapData types.NamespacedName + GlanceSingleConfigMapData types.NamespacedName GlanceConfigMapScripts types.NamespacedName + GlanceSingleAPI types.NamespacedName GlanceInternalAPI types.NamespacedName GlanceExternalAPI types.NamespacedName InternalAPINAD types.NamespacedName @@ -70,6 +75,10 @@ func GetGlanceTestData(glanceName types.NamespacedName) GlanceTestData { Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-db-sync", glanceName.Name), }, + GlanceSingleAPI: types.NamespacedName{ + Namespace: glanceName.Namespace, + Name: fmt.Sprintf("%s-single-api", glanceName.Name), + }, GlanceInternalAPI: types.NamespacedName{ Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-internal-api", glanceName.Name), @@ -78,6 +87,10 @@ func GetGlanceTestData(glanceName types.NamespacedName) GlanceTestData { Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-external-api", glanceName.Name), }, + GlanceSingle: types.NamespacedName{ + Namespace: glanceName.Namespace, + Name: fmt.Sprintf("%s-single", glanceName.Name), + }, GlanceInternal: types.NamespacedName{ Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-internal", glanceName.Name), @@ -110,12 +123,16 @@ func GetGlanceTestData(glanceName types.NamespacedName) GlanceTestData { Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-%s", glanceName.Name, "internal-config-data"), }, + GlanceSingleConfigMapData: types.NamespacedName{ + Namespace: glanceName.Namespace, + Name: fmt.Sprintf("%s-%s", glanceName.Name, "single-config-data"), + }, GlanceService: types.NamespacedName{ Namespace: glanceName.Namespace, Name: "image", }, // Also used to identify GlanceKeystoneService - GlanceInternalRoute: types.NamespacedName{ + GlanceInternalSvc: types.NamespacedName{ Namespace: glanceName.Namespace, Name: fmt.Sprintf("%s-internal", glanceName.Name), }, diff --git a/test/functional/glanceapi_controller_test.go b/test/functional/glanceapi_controller_test.go index b96a13042..7c81d9ff1 100644 --- a/test/functional/glanceapi_controller_test.go +++ b/test/functional/glanceapi_controller_test.go @@ -28,27 +28,25 @@ import ( var _ = Describe("Glanceapi controller", func() { When("GlanceAPI CR is created", func() { BeforeEach(func() { - DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceInternal, GetDefaultGlanceAPISpec(GlanceAPITypeInternal))) + DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceSingle, GetDefaultGlanceAPISpec(GlanceAPITypeSingle))) }) - It("is not Ready", func() { th.ExpectCondition( - glanceTest.GlanceInternal, + glanceTest.GlanceSingle, ConditionGetterFunc(GlanceAPIConditionGetter), condition.ReadyCondition, corev1.ConditionFalse, ) }) - It("has empty Status fields", func() { - instance := GetGlanceAPI(glanceTest.GlanceInternal) + instance := GetGlanceAPI(glanceTest.GlanceSingle) Expect(instance.Status.Hash).To(BeEmpty()) Expect(instance.Status.ReadyCount).To(Equal(int32(0))) }) }) When("an unrelated Secret is created the CR state does not change", func() { BeforeEach(func() { - DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceInternal, GetDefaultGlanceAPISpec(GlanceAPITypeInternal))) + DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceSingle, GetDefaultGlanceAPISpec(GlanceAPITypeSingle))) secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "not-relevant-secret", @@ -58,10 +56,9 @@ var _ = Describe("Glanceapi controller", func() { Expect(k8sClient.Create(ctx, secret)).Should(Succeed()) DeferCleanup(k8sClient.Delete, ctx, secret) }) - It("is not Ready", func() { th.ExpectCondition( - glanceTest.GlanceInternal, + glanceTest.GlanceSingle, ConditionGetterFunc(GlanceAPIConditionGetter), condition.ReadyCondition, corev1.ConditionFalse, @@ -71,30 +68,27 @@ var _ = Describe("Glanceapi controller", func() { When("the Secret is created with all the expected fields", func() { BeforeEach(func() { DeferCleanup(th.DeleteInstance, CreateDefaultGlance(glanceTest.Instance)) - spec := GetDefaultGlanceAPISpec(GlanceAPITypeInternal) + spec := GetDefaultGlanceAPISpec(GlanceAPITypeSingle) spec["customServiceConfig"] = "foo=bar" - DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceInternal, spec)) + DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceSingle, spec)) DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.Instance.Namespace)) - keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceInternalRoute) }) - It("reports that input is ready", func() { th.ExpectCondition( - glanceTest.GlanceInternal, + glanceTest.GlanceSingle, ConditionGetterFunc(GlanceAPIConditionGetter), condition.InputReadyCondition, corev1.ConditionTrue, ) }) - It("generated configs successfully", func() { th.ExpectCondition( - glanceTest.GlanceInternal, + glanceTest.GlanceSingle, ConditionGetterFunc(GlanceAPIConditionGetter), condition.ServiceConfigReadyCondition, corev1.ConditionTrue, ) - secretDataMap := th.GetSecret(glanceTest.GlanceInternalConfigMapData) + secretDataMap := th.GetSecret(glanceTest.GlanceSingleConfigMapData) Expect(secretDataMap).ShouldNot(BeNil()) // We apply customServiceConfig to the GlanceAPI Pod Expect(secretDataMap.Data).Should(HaveKey("02-config.conf")) @@ -102,10 +96,9 @@ var _ = Describe("Glanceapi controller", func() { configData := string(secretDataMap.Data["02-config.conf"]) Expect(configData).Should(ContainSubstring("foo=bar")) }) - It("stored the input hash in the Status", func() { Eventually(func(g Gomega) { - glanceAPI := GetGlanceAPI(glanceTest.GlanceInternal) + glanceAPI := GetGlanceAPI(glanceTest.GlanceSingle) g.Expect(glanceAPI.Status.Hash).Should(HaveKeyWithValue("input", Not(BeEmpty()))) }, timeout, interval).Should(Succeed()) }) @@ -129,10 +122,8 @@ var _ = Describe("Glanceapi controller", func() { corev1.ConditionTrue, ) }) - It("creates a Deployment for glance-api service - Internal", func() { th.SimulateDeploymentReplicaReady(glanceTest.GlanceInternalAPI) - ss := th.GetDeployment(glanceTest.GlanceInternalAPI) // Check the resulting deployment fields Expect(int(*ss.Spec.Replicas)).To(Equal(1)) @@ -145,10 +136,8 @@ var _ = Describe("Glanceapi controller", func() { Expect(container.LivenessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9292))) Expect(container.ReadinessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9292))) }) - It("creates a Deployment for glance-api service - External", func() { th.SimulateDeploymentReplicaReady(glanceTest.GlanceExternalAPI) - ss := th.GetDeployment(glanceTest.GlanceExternalAPI) // Check the resulting deployment fields Expect(int(*ss.Spec.Replicas)).To(Equal(1)) @@ -171,18 +160,42 @@ var _ = Describe("Glanceapi controller", func() { container = ss.Spec.Template.Spec.Containers[0] Expect(container.VolumeMounts).To(HaveLen(1)) Expect(container.Image).To(Equal(glanceTest.ContainerImage)) + }) + }) + When("GlanceAPI is generated by the top-level CR (single-api)", func() { + BeforeEach(func() { + DeferCleanup(th.DeleteInstance, CreateDefaultGlance(glanceTest.Instance)) + DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceSingle, GetDefaultGlanceAPISpec(GlanceAPITypeSingle))) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.Instance.Namespace)) + th.ExpectCondition( + glanceTest.GlanceSingle, + ConditionGetterFunc(GlanceAPIConditionGetter), + condition.ServiceConfigReadyCondition, + corev1.ConditionTrue, + ) + }) + It("creates a Deployment for glance-single-api service", func() { + th.SimulateDeploymentReplicaReady(glanceTest.GlanceSingleAPI) + ss := th.GetDeployment(glanceTest.GlanceSingleAPI) + // Check the resulting deployment fields + Expect(int(*ss.Spec.Replicas)).To(Equal(1)) + Expect(ss.Spec.Template.Spec.Volumes).To(HaveLen(4)) + Expect(ss.Spec.Template.Spec.Containers).To(HaveLen(3)) + container := ss.Spec.Template.Spec.Containers[2] + Expect(container.VolumeMounts).To(HaveLen(4)) + Expect(container.Image).To(Equal(glanceTest.ContainerImage)) + Expect(container.LivenessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9292))) + Expect(container.ReadinessProbe.HTTPGet.Port.IntVal).To(Equal(int32(9292))) }) }) When("the Deployment has at least one Replica ready - External", func() { BeforeEach(func() { - //DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceInternal, GetDefaultGlanceAPISpec(GlanceAPITypeInternal))) DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceExternal, GetDefaultGlanceAPISpec(GlanceAPITypeExternal))) DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.GlanceExternal.Namespace)) th.SimulateDeploymentReplicaReady(glanceTest.GlanceExternalAPI) keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceExternal) }) - It("reports that Deployment is ready", func() { th.ExpectCondition( glanceTest.GlanceExternal, @@ -194,12 +207,10 @@ var _ = Describe("Glanceapi controller", func() { glanceAPI := GetGlanceAPI(glanceTest.GlanceExternal) Expect(glanceAPI.Status.ReadyCount).To(BeNumerically(">", 0)) }) - It("exposes the service", func() { apiInstance := th.GetService(glanceTest.GlancePublicSvc) Expect(apiInstance.Labels["service"]).To(Equal("glance-external")) }) - It("creates KeystoneEndpoint", func() { keystoneEndpoint := keystone.GetKeystoneEndpoint(glanceTest.GlanceExternal) endpoints := keystoneEndpoint.Spec.Endpoints @@ -217,9 +228,8 @@ var _ = Describe("Glanceapi controller", func() { DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceInternal, GetDefaultGlanceAPISpec(GlanceAPITypeInternal))) DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.GlanceInternal.Namespace)) th.SimulateDeploymentReplicaReady(glanceTest.GlanceInternalAPI) - keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceInternalRoute) + keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceInternalSvc) }) - It("reports that Deployment is ready", func() { th.ExpectCondition( glanceTest.GlanceInternal, @@ -231,12 +241,10 @@ var _ = Describe("Glanceapi controller", func() { glanceAPI := GetGlanceAPI(glanceTest.GlanceInternal) Expect(glanceAPI.Status.ReadyCount).To(BeNumerically(">", 0)) }) - It("exposes the service", func() { - apiInstance := th.GetService(glanceTest.GlanceInternalRoute) + apiInstance := th.GetService(glanceTest.GlanceInternalSvc) Expect(apiInstance.Labels["service"]).To(Equal("glance-internal")) }) - It("creates KeystoneEndpoint", func() { keystoneEndpoint := keystone.GetKeystoneEndpoint(glanceTest.GlanceInternal) endpoints := keystoneEndpoint.Spec.Endpoints @@ -249,7 +257,40 @@ var _ = Describe("Glanceapi controller", func() { ) }) }) - + When("the Deployment has at least one Replica ready - Single", func() { + BeforeEach(func() { + DeferCleanup(th.DeleteInstance, CreateGlanceAPI(glanceTest.GlanceSingle, GetDefaultGlanceAPISpec(GlanceAPITypeSingle))) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.GlanceSingle.Namespace)) + th.SimulateDeploymentReplicaReady(glanceTest.GlanceSingleAPI) + keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceSingle) + }) + It("reports that Deployment is ready", func() { + th.ExpectCondition( + glanceTest.GlanceSingle, + ConditionGetterFunc(GlanceAPIConditionGetter), + condition.DeploymentReadyCondition, + corev1.ConditionTrue, + ) + // Deployment is Ready, check the actual ReadyCount is > 0 + glanceAPI := GetGlanceAPI(glanceTest.GlanceSingle) + Expect(glanceAPI.Status.ReadyCount).To(BeNumerically(">", 0)) + }) + It("exposes the service", func() { + apiInstance := th.GetService(glanceTest.GlanceInternalSvc) + Expect(apiInstance.Labels["service"]).To(Equal("glance-single")) + }) + It("creates KeystoneEndpoint", func() { + keystoneEndpoint := keystone.GetKeystoneEndpoint(glanceTest.GlanceSingle) + endpoints := keystoneEndpoint.Spec.Endpoints + Expect(endpoints).To(HaveKeyWithValue("internal", "http://glance-internal."+glanceTest.Instance.Namespace+".svc:9292")) + th.ExpectCondition( + glanceTest.GlanceSingle, + ConditionGetterFunc(GlanceAPIConditionGetter), + condition.KeystoneEndpointReadyCondition, + corev1.ConditionTrue, + ) + }) + }) When("A GlanceAPI is created with service override", func() { BeforeEach(func() { spec := GetDefaultGlanceAPISpec(GlanceAPITypeInternal) @@ -276,19 +317,16 @@ var _ = Describe("Glanceapi controller", func() { spec["override"] = map[string]interface{}{ "service": serviceOverride, } - glance := CreateGlanceAPI(glanceTest.GlanceInternal, spec) DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.GlanceInternal.Namespace)) th.SimulateDeploymentReplicaReady(glanceTest.GlanceInternalAPI) keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceInternal) DeferCleanup(th.DeleteInstance, glance) }) - It("creates KeystoneEndpoint", func() { keystoneEndpoint := keystone.GetKeystoneEndpoint(glanceTest.GlanceInternal) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("internal", "http://glance-internal."+glanceTest.GlanceInternal.Namespace+".svc:9292")) - th.ExpectCondition( glanceTest.GlanceInternal, ConditionGetterFunc(GlanceAPIConditionGetter), @@ -296,11 +334,10 @@ var _ = Describe("Glanceapi controller", func() { corev1.ConditionTrue, ) }) - It("creates LoadBalancer service", func() { // As the internal endpoint is configured in service overrides it // gets a LoadBalancer Service with annotations - service := th.GetService(glanceTest.GlanceInternalRoute) + service := th.GetService(glanceTest.GlanceInternalSvc) Expect(service.Annotations).To( HaveKeyWithValue("dnsmasq.network.openstack.org/hostname", "glance-internal.openstack.svc")) Expect(service.Annotations).To( @@ -318,7 +355,6 @@ var _ = Describe("Glanceapi controller", func() { ) }) }) - When("A GlanceAPI is created with service override endpointURL set", func() { BeforeEach(func() { spec := GetDefaultGlanceAPISpec(GlanceAPITypeExternal) @@ -327,18 +363,15 @@ var _ = Describe("Glanceapi controller", func() { "endpoint": "public", "endpointURL": "http://glance-openstack.apps-crc.testing", } - spec["override"] = map[string]interface{}{ "service": serviceOverride, } - glance := CreateGlanceAPI(glanceTest.GlanceExternal, spec) DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(glanceTest.GlanceExternal.Namespace)) th.SimulateDeploymentReplicaReady(glanceTest.GlanceExternalAPI) keystone.SimulateKeystoneEndpointReady(glanceTest.GlanceExternal) DeferCleanup(th.DeleteInstance, glance) }) - It("creates KeystoneEndpoint", func() { keystoneEndpoint := keystone.GetKeystoneEndpoint(glanceTest.GlanceExternal) endpoints := keystoneEndpoint.Spec.Endpoints