diff --git a/go.mod b/go.mod index 9b895e80..76933ceb 100644 --- a/go.mod +++ b/go.mod @@ -98,3 +98,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/keystone-operator/api => github.com/gibizer/keystone-operator/api v0.0.0-20230922162537-627d01ed8ed1 + +replace github.com/openstack-k8s-operators/lib-common/modules/test => github.com/gibizer/lib-common/modules/test v0.0.0-20230922161820-e6fe1f3e921b diff --git a/go.sum b/go.sum index 11aa4162..31a5f362 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-20230922162537-627d01ed8ed1 h1:0KdwO41r5gYiYQofs7vsfniQGCU7BwVmXSybCbGy8IQ= +github.com/gibizer/keystone-operator/api v0.0.0-20230922162537-627d01ed8ed1/go.mod h1:4SRoiJqhsTimSgWaBxqFPQdx5MQt5Co0MFxumOkkeN0= +github.com/gibizer/lib-common/modules/test v0.0.0-20230922161820-e6fe1f3e921b h1:qLe+5mU9kAL+gQM1y1CLNg7QlL40rA7+rYRCUyS0QSA= +github.com/gibizer/lib-common/modules/test v0.0.0-20230922161820-e6fe1f3e921b/go.mod h1:RfLOPJbmPzPZ4XHwwDc2tFbbw5zxZL15JFGwb5c6VaU= 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/tests/functional/placementapi_controller_test.go b/tests/functional/placementapi_controller_test.go index f6339dbc..56568fec 100644 --- a/tests/functional/placementapi_controller_test.go +++ b/tests/functional/placementapi_controller_test.go @@ -178,9 +178,9 @@ var _ = Describe("PlacementAPI controller", func() { DeferCleanup(th.DeleteInstance, CreatePlacementAPI(names.PlacementAPIName, GetDefaultPlacementAPISpec())) DeferCleanup( k8sClient.Delete, ctx, CreatePlacementAPISecret(namespace, SecretName)) - keystoneAPIName := th.CreateKeystoneAPI(namespace) - keystoneAPI = th.GetKeystoneAPI(keystoneAPIName) - DeferCleanup(th.DeleteKeystoneAPI, keystoneAPIName) + keystoneAPIName := keystone.CreateKeystoneAPI(namespace) + keystoneAPI = keystone.GetKeystoneAPI(keystoneAPIName) + DeferCleanup(keystone.DeleteKeystoneAPI, keystoneAPIName) }) It("should have config ready", func() { @@ -277,7 +277,7 @@ var _ = Describe("PlacementAPI controller", func() { ) th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) - th.SimulateKeystoneServiceReady(names.KeystoneServiceName) + keystone.SimulateKeystoneServiceReady(names.KeystoneServiceName) th.ExpectCondition( names.PlacementAPIName, @@ -301,7 +301,7 @@ var _ = Describe("PlacementAPI controller", func() { ) th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) - th.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) + keystone.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) th.ExpectCondition( names.PlacementAPIName, @@ -435,8 +435,8 @@ var _ = Describe("PlacementAPI controller", func() { th.CreateDBService(namespace, "openstack", serviceSpec), ) th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) - th.SimulateKeystoneServiceReady(names.KeystoneServiceName) - th.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) + keystone.SimulateKeystoneServiceReady(names.KeystoneServiceName) + keystone.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) th.SimulateJobSuccess(names.DBSyncJobName) th.SimulateDeploymentReplicaReady(names.DeploymentName) @@ -452,7 +452,7 @@ var _ = Describe("PlacementAPI controller", func() { When("A PlacementAPI is created with service override", func() { BeforeEach(func() { DeferCleanup(k8sClient.Delete, ctx, CreatePlacementAPISecret(namespace, SecretName)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(namespace)) spec := GetDefaultPlacementAPISpec() serviceOverride := map[string]interface{}{} @@ -493,13 +493,13 @@ var _ = Describe("PlacementAPI controller", func() { th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) th.SimulateJobSuccess(names.DBSyncJobName) th.SimulateDeploymentReplicaReady(names.DeploymentName) - th.SimulateKeystoneServiceReady(names.KeystoneServiceName) - th.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) + keystone.SimulateKeystoneServiceReady(names.KeystoneServiceName) + keystone.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) DeferCleanup(th.DeleteInstance, placementAPI) }) It("creates KeystoneEndpoint", func() { - keystoneEndpoint := th.GetKeystoneEndpoint(names.KeystoneEndpointName) + keystoneEndpoint := keystone.GetKeystoneEndpoint(names.KeystoneEndpointName) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("public", "http://placement-public."+namespace+".svc:8778")) Expect(endpoints).To(HaveKeyWithValue("internal", "http://placement-internal."+namespace+".svc:8778")) @@ -537,7 +537,7 @@ var _ = Describe("PlacementAPI controller", func() { When("A PlacementAPI is created with service override endpointURL set", func() { BeforeEach(func() { DeferCleanup(k8sClient.Delete, ctx, CreatePlacementAPISecret(namespace, SecretName)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(namespace)) spec := GetDefaultPlacementAPISpec() serviceOverride := map[string]interface{}{} @@ -564,13 +564,13 @@ var _ = Describe("PlacementAPI controller", func() { th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) th.SimulateJobSuccess(names.DBSyncJobName) th.SimulateDeploymentReplicaReady(names.DeploymentName) - th.SimulateKeystoneServiceReady(names.KeystoneServiceName) - th.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) + keystone.SimulateKeystoneServiceReady(names.KeystoneServiceName) + keystone.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) DeferCleanup(th.DeleteInstance, placementAPI) }) It("creates KeystoneEndpoint", func() { - keystoneEndpoint := th.GetKeystoneEndpoint(names.KeystoneEndpointName) + keystoneEndpoint := keystone.GetKeystoneEndpoint(names.KeystoneEndpointName) endpoints := keystoneEndpoint.Spec.Endpoints Expect(endpoints).To(HaveKeyWithValue("public", "http://placement-openstack.apps-crc.testing")) Expect(endpoints).To(HaveKeyWithValue("internal", "http://placement-internal."+namespace+".svc:8778")) @@ -589,7 +589,7 @@ var _ = Describe("PlacementAPI controller", func() { DeferCleanup(th.DeleteInstance, CreatePlacementAPI(names.PlacementAPIName, GetDefaultPlacementAPISpec())) DeferCleanup( k8sClient.Delete, ctx, CreatePlacementAPISecret(namespace, SecretName)) - DeferCleanup(th.DeleteKeystoneAPI, th.CreateKeystoneAPI(namespace)) + DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(namespace)) serviceSpec := corev1.ServiceSpec{Ports: []corev1.ServicePort{{Port: 3306}}} DeferCleanup( @@ -597,8 +597,8 @@ var _ = Describe("PlacementAPI controller", func() { th.CreateDBService(namespace, "openstack", serviceSpec), ) th.SimulateMariaDBDatabaseCompleted(names.MariaDBDatabaseName) - th.SimulateKeystoneServiceReady(names.KeystoneServiceName) - th.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) + keystone.SimulateKeystoneServiceReady(names.KeystoneServiceName) + keystone.SimulateKeystoneEndpointReady(names.KeystoneEndpointName) th.SimulateJobSuccess(names.DBSyncJobName) th.SimulateDeploymentReplicaReady(names.DeploymentName) @@ -613,18 +613,18 @@ var _ = Describe("PlacementAPI controller", func() { It("removes the finalizers when deleted", func() { placement := GetPlacementAPI(names.PlacementAPIName) Expect(placement.Finalizers).To(ContainElement("PlacementAPI")) - keystoneService := th.GetKeystoneService(names.KeystoneServiceName) + keystoneService := keystone.GetKeystoneService(names.KeystoneServiceName) Expect(keystoneService.Finalizers).To(ContainElement("PlacementAPI")) - keystoneEndpoint := th.GetKeystoneService(names.KeystoneEndpointName) + keystoneEndpoint := keystone.GetKeystoneService(names.KeystoneEndpointName) Expect(keystoneEndpoint.Finalizers).To(ContainElement("PlacementAPI")) db := th.GetMariaDBDatabase(names.MariaDBDatabaseName) Expect(db.Finalizers).To(ContainElement("PlacementAPI")) th.DeleteInstance(GetPlacementAPI(names.PlacementAPIName)) - keystoneService = th.GetKeystoneService(names.KeystoneServiceName) + keystoneService = keystone.GetKeystoneService(names.KeystoneServiceName) Expect(keystoneService.Finalizers).NotTo(ContainElement("PlacementAPI")) - keystoneEndpoint = th.GetKeystoneService(names.KeystoneEndpointName) + keystoneEndpoint = keystone.GetKeystoneService(names.KeystoneEndpointName) Expect(keystoneEndpoint.Finalizers).NotTo(ContainElement("PlacementAPI")) db = th.GetMariaDBDatabase(names.MariaDBDatabaseName) Expect(db.Finalizers).NotTo(ContainElement("PlacementAPI")) diff --git a/tests/functional/suite_test.go b/tests/functional/suite_test.go index 3a7dbee2..80663a16 100644 --- a/tests/functional/suite_test.go +++ b/tests/functional/suite_test.go @@ -45,7 +45,8 @@ import ( placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1" "github.com/openstack-k8s-operators/placement-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 ) @@ -59,7 +60,8 @@ var ( ctx context.Context cancel context.CancelFunc logger logr.Logger - th *TestHelper + th *common_test.TestHelper + keystone *keystone_test.TestHelper namespace string names Names ) @@ -130,7 +132,9 @@ 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 if goroutine