From 2e753c5d2c0cc9fbc634a604ba8d521d4f9ac437 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Fri, 22 Sep 2023 15:46:10 +0200 Subject: [PATCH] [envtest]Use keystone helpers from keystone-operator This was necessary to remove a dependency cycle from lib-common --- go.mod | 4 ++ go.sum | 8 +-- test/functional/nova_controller_test.go | 62 ++++++++++---------- test/functional/nova_multicell_test.go | 32 +++++----- test/functional/nova_reconfiguration_test.go | 6 +- test/functional/novaapi_controller_test.go | 28 ++++----- test/functional/suite_test.go | 11 +++- 7 files changed, 80 insertions(+), 71 deletions(-) diff --git a/go.mod b/go.mod index 0cdf3cd4e..fd9341c5e 100644 --- a/go.mod +++ b/go.mod @@ -95,3 +95,7 @@ replace github.com/openshift/api => github.com/openshift/api v0.0.0-202304141430 // needed to to cert-manager v1.11.4 see https://github.com/cert-manager/cert-manager/blob/v1.11.4/go.mod#L263C1-L264C104 // remove this once we bump to cert-manager v1.12.x replace github.com/Venafi/vcert/v4 => github.com/jetstack/vcert/v4 v4.9.6-0.20230519122548-219f317ae107 //allow-merging + +replace github.com/openstack-k8s-operators/lib-common/modules/test => github.com/gibizer/lib-common/modules/test v0.0.0-20230922123428-e1f4a23e8389 + +replace github.com/openstack-k8s-operators/keystone-operator/api => github.com/gibizer/keystone-operator/api v0.0.0-20230922130836-e7371b163540 diff --git a/go.sum b/go.sum index 11aa41626..484be62ae 100644 --- a/go.sum +++ b/go.sum @@ -82,6 +82,10 @@ github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gibizer/keystone-operator/api v0.0.0-20230922130836-e7371b163540 h1:Bk0Ip54Mb0Joldz68hzgUj07X2KKPT9dwN+uvyxq17g= +github.com/gibizer/keystone-operator/api v0.0.0-20230922130836-e7371b163540/go.mod h1:OvhT5VeVCQMVhTJP1nB3WF+4BTVepc51TvSvtei7a4s= +github.com/gibizer/lib-common/modules/test v0.0.0-20230922123428-e1f4a23e8389 h1:sJzsPbrw4Tv9T9o+xe9eJAuBJz4Mn3hw9q6T7cn1tX8= +github.com/gibizer/lib-common/modules/test v0.0.0-20230922123428-e1f4a23e8389/go.mod h1:3k/VsVeacu4iQJcr9XnDOK1+tau81fdxuUDkI6I0kHg= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -238,16 +242,12 @@ github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7 h1:rncLxJBpFGqBztyxC github.com/openshift/api v0.0.0-20230414143018-3367bc7e6ac7/go.mod h1:ctXNyWanKEjGj8sss1KjjHQ3ENKFm33FFnS5BKaIPh4= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875 h1:DUlCjbi3XxH66oL97MFZF5wgL28HdU+r8TkBZVw7WIc= github.com/openstack-k8s-operators/infra-operator/apis v0.1.1-0.20230914145253-116f307c7875/go.mod h1:NgrvT3CKMu6fE8Nt1H79qHx11L3I7Bb2eItniM7c9ow= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230920085319-92ae0260bbf3 h1:6VCz/ZBTJEQJTx4+z8UxLv3WITa4Bgx5CSP237wJ5xM= -github.com/openstack-k8s-operators/keystone-operator/api v0.1.1-0.20230920085319-92ae0260bbf3/go.mod h1:ta6w/29i4WuWkQp6I4cOLwMGQ5/vJI0y8Em7u+M34jo= github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230919113507-d74c2f31d216 h1:arYbQA6bLyXJkHm+6M6gPc4YpWMFjs5qkG16Yii4UDo= github.com/openstack-k8s-operators/lib-common/modules/common v0.1.1-0.20230919113507-d74c2f31d216/go.mod h1:Ge7Yf6AUmjEvJK9AIW2bT5udLzBIcK59b1QxqymncaQ= github.com/openstack-k8s-operators/lib-common/modules/database v0.1.1-0.20230919113507-d74c2f31d216 h1:PykqfrahtBUbhIuM0IDRyrtVCOzy7jdEZz3yVEnwpp0= github.com/openstack-k8s-operators/lib-common/modules/database v0.1.1-0.20230919113507-d74c2f31d216/go.mod h1:gdmDHoWrDtq8gfJHl20rQwe9vfzJJkY+KnvM6aD9+08= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230919113507-d74c2f31d216 h1:h76faqi4WAXBs3D2B0GLUdlCjS0dh78wRL0d5RZUwhk= github.com/openstack-k8s-operators/lib-common/modules/openstack v0.1.1-0.20230919113507-d74c2f31d216/go.mod h1:GHi64tgyC75/vuT8Crda0yN5iCIYiSyS4bpzYJjX7MA= -github.com/openstack-k8s-operators/lib-common/modules/test v0.1.2-0.20230919113507-d74c2f31d216 h1:QyzzvG8iaDFwx6Lo44dCyf2tRtgk0sqniXjgJpiW32g= -github.com/openstack-k8s-operators/lib-common/modules/test v0.1.2-0.20230919113507-d74c2f31d216/go.mod h1:RfLOPJbmPzPZ4XHwwDc2tFbbw5zxZL15JFGwb5c6VaU= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5 h1:dQcSQuXfgzgOhc4v+zD0jE6WWhn6FHr5nALOjJBPxyI= github.com/openstack-k8s-operators/mariadb-operator/api v0.1.1-0.20230913081601-9e4fc8aadad5/go.mod h1:mJyhm/YiQZaYhLvOuLng/ITpwx8HvsYVht+VotS1Ed8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/test/functional/nova_controller_test.go b/test/functional/nova_controller_test.go index 949a66f26..70cfd6efa 100644 --- a/test/functional/nova_controller_test.go +++ b/test/functional/nova_controller_test.go @@ -50,7 +50,7 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) DeferCleanup(th.DeleteInstance, CreateNovaWithCell0(novaNames.NovaName)) }) @@ -90,7 +90,7 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) DeferCleanup(th.DeleteInstance, CreateNovaWithCell0(novaNames.NovaName)) }) @@ -138,11 +138,11 @@ var _ = Describe("Nova controller", func() { It("registers nova service to keystone", func() { // assert that the KeystoneService for nova is created - th.GetKeystoneService(novaNames.KeystoneServiceName) + keystone.GetKeystoneService(novaNames.KeystoneServiceName) // and simulate that it becomes ready i.e. the keystone-operator // did its job and registered the nova service - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) - keystone := th.GetKeystoneService(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone := keystone.GetKeystoneService(novaNames.KeystoneServiceName) Expect(keystone.Status.Conditions).ToNot(BeNil()) th.ExpectCondition( @@ -154,7 +154,7 @@ var _ = Describe("Nova controller", func() { }) It("creates nova_api DB", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -173,7 +173,7 @@ var _ = Describe("Nova controller", func() { }) It("creates nova-api MQ", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -192,7 +192,7 @@ var _ = Describe("Nova controller", func() { }) It("creates nova_cell0 DB", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -211,7 +211,7 @@ var _ = Describe("Nova controller", func() { }) It("creates cell0 NovaCell", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -312,7 +312,7 @@ var _ = Describe("Nova controller", func() { }) It("creates an internal Secret for the top level services", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -339,7 +339,7 @@ var _ = Describe("Nova controller", func() { }) It("creates NovaAPI", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -355,7 +355,7 @@ var _ = Describe("Nova controller", func() { Expect(api.Spec.Secret).To(Equal(novaNames.InternalTopLevelSecretName.Name)) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.APIName, ConditionGetterFunc(NovaAPIConditionGetter), @@ -378,7 +378,7 @@ var _ = Describe("Nova controller", func() { }) It("creates NovaScheduler", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -386,7 +386,7 @@ var _ = Describe("Nova controller", func() { th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateStatefulSetReplicaReady(novaNames.MetadataStatefulSetName) scheduler := GetNovaScheduler(novaNames.SchedulerName) @@ -417,7 +417,7 @@ var _ = Describe("Nova controller", func() { }) It("creates NovaMetadata", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -425,7 +425,7 @@ var _ = Describe("Nova controller", func() { th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateStatefulSetReplicaReady(novaNames.SchedulerStatefulSetName) metadata := GetNovaMetadata(novaNames.MetadataName) @@ -472,11 +472,11 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) DeferCleanup(th.DeleteInstance, CreateNovaWithCell0(novaNames.NovaName)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -538,11 +538,11 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) DeferCleanup(th.DeleteInstance, CreateNovaWithCell0(novaNames.NovaName)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -596,7 +596,7 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) spec := GetDefaultNovaSpec() cell0template := GetDefaultNovaCellTemplate() @@ -608,7 +608,7 @@ var _ = Describe("Nova controller", func() { }) It("uses the correct hostnames to access the different DB services", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -673,7 +673,7 @@ var _ = Describe("Nova controller", func() { Expect(configData).To(ContainSubstring("password = service-password")) th.SimulateStatefulSetReplicaReady(novaNames.APIName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( cell0.ConductorName, @@ -730,13 +730,13 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) DeferCleanup(th.DeleteInstance, CreateNovaWithCell0(novaNames.NovaName)) }) It("removes the finalizer from KeystoneService", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -744,16 +744,16 @@ var _ = Describe("Nova controller", func() { corev1.ConditionTrue, ) - service := th.GetKeystoneService(novaNames.KeystoneServiceName) + service := keystone.GetKeystoneService(novaNames.KeystoneServiceName) Expect(service.Finalizers).To(ContainElement("Nova")) th.DeleteInstance(GetNova(novaNames.NovaName)) - service = th.GetKeystoneService(novaNames.KeystoneServiceName) + service = keystone.GetKeystoneService(novaNames.KeystoneServiceName) Expect(service.Finalizers).NotTo(ContainElement("Nova")) }) It("removes the finalizers from the nova dbs", func() { - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) apiDB := th.GetMariaDBDatabase(novaNames.APIMariaDBDatabaseName) Expect(apiDB.Finalizers).To(ContainElement("Nova")) @@ -785,7 +785,7 @@ var _ = Describe("Nova controller", func() { }, ), ) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) nad := th.CreateNetworkAttachmentDefinition(novaNames.InternalAPINetworkNADName) DeferCleanup(th.DeleteInstance, nad) @@ -823,7 +823,7 @@ var _ = Describe("Nova controller", func() { } DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, rawSpec)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) th.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateTransportURLReady(cell0.TransportURLName) @@ -849,7 +849,7 @@ var _ = Describe("Nova controller", func() { novaNames.MetadataStatefulSetName, map[string][]string{novaNames.NovaName.Namespace + "/internalapi": {"10.0.0.1"}}, ) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.NovaName, diff --git a/test/functional/nova_multicell_test.go b/test/functional/nova_multicell_test.go index 59e44f160..40c92fbd2 100644 --- a/test/functional/nova_multicell_test.go +++ b/test/functional/nova_multicell_test.go @@ -75,8 +75,8 @@ var _ = Describe("Nova multicell", func() { spec["apiMessageBusInstance"] = cell0.TransportURLName.Name DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) }) It("creates cell0 NovaCell", func() { @@ -181,7 +181,7 @@ var _ = Describe("Nova multicell", func() { corev1.ConditionTrue, ) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -198,7 +198,7 @@ var _ = Describe("Nova multicell", func() { th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) th.ExpectCondition( @@ -244,7 +244,7 @@ var _ = Describe("Nova multicell", func() { th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) th.SimulateTransportURLReady(cell1.TransportURLName) @@ -321,7 +321,7 @@ var _ = Describe("Nova multicell", func() { th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateStatefulSetReplicaReady(novaNames.SchedulerStatefulSetName) th.SimulateStatefulSetReplicaReady(novaNames.MetadataStatefulSetName) th.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) @@ -486,7 +486,7 @@ var _ = Describe("Nova multicell", func() { // NovaAPI is still created GetNovaAPI(novaNames.APIName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -554,8 +554,8 @@ var _ = Describe("Nova multicell", func() { spec["apiMessageBusInstance"] = cell0.TransportURLName.Name DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) }) It("cell0 becomes ready with 0 conductor replicas and the rest of nova is deployed", func() { th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) @@ -603,7 +603,7 @@ var _ = Describe("Nova multicell", func() { th.SimulateStatefulSetReplicaReady(novaNames.MetadataStatefulSetName) // As cell0 is ready API is deployed th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -665,8 +665,8 @@ var _ = Describe("Nova multicell", func() { spec["apiMessageBusInstance"] = cell0.TransportURLName.Name DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.Namespace)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.Namespace)) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) }) It("waits for cell0 DB to be created", func(ctx SpecContext) { @@ -717,13 +717,13 @@ var _ = Describe("Nova multicell", func() { spec["apiMessageBusInstance"] = cell0.TransportURLName.Name DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec)) - keystoneAPIName := th.CreateKeystoneAPI(novaNames.NovaName.Namespace) - DeferCleanup(th.DeleteKeystoneAPI, keystoneAPIName) - keystoneAPI := th.GetKeystoneAPI(keystoneAPIName) + keystoneAPIName := keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace) + DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName) + keystoneAPI := keystone.GetKeystoneAPI(keystoneAPIName) Eventually(func(g Gomega) { g.Expect(k8sClient.Status().Update(ctx, keystoneAPI.DeepCopy())).Should(Succeed()) }, timeout, interval).Should(Succeed()) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) }) It("cell0 becomes ready without metadata and the rest of nova is deployed", func() { th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) diff --git a/test/functional/nova_reconfiguration_test.go b/test/functional/nova_reconfiguration_test.go index 2d6773b86..a6033f304 100644 --- a/test/functional/nova_reconfiguration_test.go +++ b/test/functional/nova_reconfiguration_test.go @@ -73,8 +73,8 @@ func CreateNovaWith3CellsAndEnsureReady(novaNames NovaNames) { spec["apiMessageBusInstance"] = cell0.TransportURLName.Name DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(novaNames.NovaName.Namespace)) - th.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(novaNames.NovaName.Namespace)) + keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) // END of common logic with Nova multicell test th.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) @@ -91,7 +91,7 @@ func CreateNovaWith3CellsAndEnsureReady(novaNames NovaNames) { th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.SimulateStatefulSetReplicaReady(cell1.NoVNCProxyStatefulSetName) th.SimulateJobSuccess(cell1.DBSyncJobName) diff --git a/test/functional/novaapi_controller_test.go b/test/functional/novaapi_controller_test.go index 8ec75a794..a07a8b8f3 100644 --- a/test/functional/novaapi_controller_test.go +++ b/test/functional/novaapi_controller_test.go @@ -296,9 +296,9 @@ var _ = Describe("NovaAPI controller", func() { It("creates KeystoneEndpoint", func() { th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystone.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) - keystoneEndpoint := th.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystoneEndpoint := keystone.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("public", "http://nova-public."+novaNames.APIName.Namespace+".svc:8774/v2.1")) Expect(endpoints).To(HaveKeyWithValue("internal", "http://nova-internal."+novaNames.APIName.Namespace+".svc:8774/v2.1")) @@ -313,7 +313,7 @@ var _ = Describe("NovaAPI controller", func() { It("is Ready", func() { th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystone.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) th.ExpectCondition( novaNames.APIName, @@ -332,7 +332,7 @@ var _ = Describe("NovaAPI controller", func() { It("removes the finalizer from KeystoneEndpoint", func() { th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.APIName, ConditionGetterFunc(NovaAPIConditionGetter), @@ -340,11 +340,11 @@ var _ = Describe("NovaAPI controller", func() { corev1.ConditionTrue, ) - endpoint := th.GetKeystoneEndpoint(novaNames.APIKeystoneEndpointName) + endpoint := keystone.GetKeystoneEndpoint(novaNames.APIKeystoneEndpointName) Expect(endpoint.Finalizers).To(ContainElement("NovaAPI")) th.DeleteInstance(GetNovaAPI(novaNames.APIName)) - endpoint = th.GetKeystoneEndpoint(novaNames.APIKeystoneEndpointName) + endpoint = keystone.GetKeystoneEndpoint(novaNames.APIKeystoneEndpointName) Expect(endpoint.Finalizers).NotTo(ContainElement("NovaAPI")) }) }) @@ -467,7 +467,7 @@ var _ = Describe("NovaAPI controller", func() { }, timeout, interval).Should(Succeed()) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.APIName, @@ -520,7 +520,7 @@ var _ = Describe("NovaAPI controller", func() { It("creates LoadBalancer services", func() { th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) // As the internal endpoint has service override configured it // gets a LoadBalancer Service with MetalLB annotations @@ -547,11 +547,11 @@ var _ = Describe("NovaAPI controller", func() { Expect(service.Spec.Type).To(Equal(corev1.ServiceTypeClusterIP)) th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystone.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) // it registers the endpointURL as the public endpoint and svc // for the internal - keystoneEndpoint := th.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystoneEndpoint := keystone.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("public", "http://nova-api-"+novaNames.APIName.Namespace+".apps-crc.testing/v2.1")) Expect(endpoints).To(HaveKeyWithValue("internal", "http://nova-internal."+novaNames.APIName.Namespace+".svc:8774/v2.1")) @@ -615,7 +615,7 @@ var _ = Describe("NovaAPI controller", func() { It("creates LoadBalancer services", func() { th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) // As the internal endpoint has service override configured it // gets a LoadBalancer Service with MetalLB annotations @@ -645,11 +645,11 @@ var _ = Describe("NovaAPI controller", func() { Expect(service.Spec.Type).To(Equal(corev1.ServiceTypeLoadBalancer)) th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystone.SimulateKeystoneEndpointReady(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) // it registers the endpointURL as the public endpoint and svc // for the internal - keystoneEndpoint := th.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) + keystoneEndpoint := keystone.GetKeystoneEndpoint(types.NamespacedName{Namespace: novaNames.APIName.Namespace, Name: "nova"}) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("public", "http://nova-public."+novaNames.APIName.Namespace+".svc:8774/v2.1")) Expect(endpoints).To(HaveKeyWithValue("internal", "http://nova-internal."+novaNames.APIName.Namespace+".svc:8774/v2.1")) @@ -677,7 +677,7 @@ var _ = Describe("NovaAPI controller", func() { ) th.SimulateStatefulSetReplicaReady(novaNames.APIStatefulSetName) - th.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) th.ExpectCondition( novaNames.APIName, ConditionGetterFunc(NovaAPIConditionGetter), diff --git a/test/functional/suite_test.go b/test/functional/suite_test.go index 493ff2ac4..0abae64f4 100644 --- a/test/functional/suite_test.go +++ b/test/functional/suite_test.go @@ -54,7 +54,8 @@ import ( novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" "github.com/openstack-k8s-operators/nova-operator/controllers" - . "github.com/openstack-k8s-operators/lib-common/modules/test/helpers" + keystone_test "github.com/openstack-k8s-operators/keystone-operator/api/test/helpers" + common_test "github.com/openstack-k8s-operators/lib-common/modules/test/helpers" //+kubebuilder:scaffold:imports ) @@ -68,7 +69,8 @@ var ( ctx context.Context cancel context.CancelFunc logger logr.Logger - th *TestHelper + th *common_test.TestHelper + keystone *keystone_test.TestHelper novaNames NovaNames cell0 CellNames cell1 CellNames @@ -164,7 +166,10 @@ var _ = BeforeSuite(func() { k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) Expect(err).NotTo(HaveOccurred()) Expect(k8sClient).NotTo(BeNil()) - th = NewTestHelper(ctx, k8sClient, timeout, interval, logger) + + th = common_test.NewTestHelper(ctx, k8sClient, timeout, interval, logger) + Expect(th).NotTo(BeNil()) + keystone = keystone_test.NewTestHelper(ctx, k8sClient, timeout, interval, logger) Expect(th).NotTo(BeNil()) // Start the controller-manager in a goroutine