diff --git a/test/functional/nova_controller_test.go b/test/functional/nova_controller_test.go index e03343e8c..2d6bf1830 100644 --- a/test/functional/nova_controller_test.go +++ b/test/functional/nova_controller_test.go @@ -180,9 +180,9 @@ var _ = Describe("Nova controller", func() { novav1.NovaAPIMQReadyCondition, corev1.ConditionFalse, ) - th.GetTransportURL(cell0.TransportURLName) + infra.GetTransportURL(cell0.TransportURLName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -214,7 +214,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) // assert that cell related CRs are created cell := GetNovaCell(cell0.CellCRName) Expect(cell.Spec.ServiceUser).To(Equal("nova")) @@ -319,7 +319,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -346,7 +346,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -385,7 +385,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -424,7 +424,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -483,7 +483,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) GetNovaCell(cell0.CellCRName) GetNovaConductor(cell0.ConductorName) @@ -549,7 +549,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) @@ -615,7 +615,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) cell0DBSync := th.GetJob(cell0.DBSyncJobName) Expect(len(cell0DBSync.Spec.Template.Spec.InitContainers)).To(Equal(0)) @@ -830,7 +830,7 @@ var _ = Describe("Nova controller", func() { keystone.SimulateKeystoneServiceReady(novaNames.KeystoneServiceName) mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) }) diff --git a/test/functional/nova_multicell_test.go b/test/functional/nova_multicell_test.go index 2a30d7e66..85d99c9d8 100644 --- a/test/functional/nova_multicell_test.go +++ b/test/functional/nova_multicell_test.go @@ -82,7 +82,7 @@ var _ = Describe("Nova multicell", func() { It("creates cell0 NovaCell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.ExpectCondition( cell0.ConductorName, @@ -144,7 +144,7 @@ var _ = Describe("Nova multicell", func() { It("creates NovaAPI", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -192,7 +192,7 @@ var _ = Describe("Nova multicell", func() { It("creates all cell DBs", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) @@ -218,15 +218,15 @@ var _ = Describe("Nova multicell", func() { }) It("creates all cell MQs", func() { - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), novav1.NovaAllCellsMQReadyCondition, corev1.ConditionFalse, ) - th.SimulateTransportURLReady(cell2.TransportURLName) + infra.SimulateTransportURLReady(cell2.TransportURLName) th.ExpectCondition( novaNames.NovaName, ConditionGetterFunc(NovaConditionGetter), @@ -239,14 +239,14 @@ var _ = Describe("Nova multicell", func() { It("creates cell1 NovaCell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) th.SimulateStatefulSetReplicaReady(novaNames.APIDeploymentName) keystone.SimulateKeystoneEndpointReady(novaNames.APIKeystoneEndpointName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.ExpectCondition( cell1.ConductorName, @@ -316,7 +316,7 @@ var _ = Describe("Nova multicell", func() { It("creates cell2 NovaCell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -325,14 +325,14 @@ var _ = Describe("Nova multicell", func() { th.SimulateStatefulSetReplicaReady(novaNames.SchedulerStatefulSetName) th.SimulateStatefulSetReplicaReady(novaNames.MetadataStatefulSetName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.SimulateStatefulSetReplicaReady(cell1.NoVNCProxyStatefulSetName) th.SimulateJobSuccess(cell1.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell1.ConductorStatefulSetName) th.SimulateJobSuccess(cell1.CellMappingJobName) mariadb.SimulateMariaDBDatabaseCompleted(cell2.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell2.TransportURLName) + infra.SimulateTransportURLReady(cell2.TransportURLName) th.ExpectCondition( cell2.ConductorName, @@ -435,7 +435,7 @@ var _ = Describe("Nova multicell", func() { // Don't simulate any success for any other DBs MQs or Cells // just for cell2 mariadb.SimulateMariaDBDatabaseCompleted(cell2.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell2.TransportURLName) + infra.SimulateTransportURLReady(cell2.TransportURLName) // assert that cell related CRs are created GetNovaCell(cell2.CellCRName) @@ -473,14 +473,14 @@ var _ = Describe("Nova multicell", func() { It("creates Nova API even if cell1 and cell2 fails", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) // Simulate that cell1 DB sync failed and do not simulate // cell2 DB creation success so that will be in Creating state. mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.SimulateJobFailure(cell1.DBSyncJobName) // NovaAPI is still created @@ -504,8 +504,8 @@ var _ = Describe("Nova multicell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.SimulateJobFailure(cell0.DBSyncJobName) @@ -561,8 +561,8 @@ var _ = Describe("Nova multicell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) // We requested 0 replicas from the cell0 conductor so the // conductor is ready even if 0 replicas is running but all @@ -671,7 +671,7 @@ var _ = Describe("Nova multicell", func() { It("waits for cell0 DB to be created", func(ctx SpecContext) { mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) // NOTE(gibi): before the fix https://github.com/openstack-k8s-operators/nova-operator/pull/356 // nova-controller panic at this point and test would hang th.ExpectCondition( @@ -729,8 +729,8 @@ var _ = Describe("Nova multicell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) @@ -757,8 +757,8 @@ var _ = Describe("Nova multicell", func() { mariadb.SimulateMariaDBDatabaseCompleted(novaNames.APIMariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell0.MariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) th.SimulateJobSuccess(cell0.CellMappingJobName) diff --git a/test/functional/nova_reconfiguration_test.go b/test/functional/nova_reconfiguration_test.go index 6ddcc71a6..fb5d01d40 100644 --- a/test/functional/nova_reconfiguration_test.go +++ b/test/functional/nova_reconfiguration_test.go @@ -82,9 +82,9 @@ func CreateNovaWith3CellsAndEnsureReady(novaNames NovaNames) { mariadb.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName) mariadb.SimulateMariaDBDatabaseCompleted(cell2.MariaDBDatabaseName) - th.SimulateTransportURLReady(cell0.TransportURLName) - th.SimulateTransportURLReady(cell1.TransportURLName) - th.SimulateTransportURLReady(cell2.TransportURLName) + infra.SimulateTransportURLReady(cell0.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell2.TransportURLName) th.SimulateJobSuccess(cell0.DBSyncJobName) th.SimulateStatefulSetReplicaReady(cell0.ConductorStatefulSetName) @@ -391,11 +391,11 @@ var _ = Describe("Nova reconfiguration", func() { // Expect that nova controller updates the TransportURL to point to // the new rabbit cluster Eventually(func(g Gomega) { - transport := th.GetTransportURL(cell1.TransportURLName) + transport := infra.GetTransportURL(cell1.TransportURLName) g.Expect(transport.Spec.RabbitmqClusterName).To(Equal("alternate-mq-for-cell1")) }, timeout, interval).Should(Succeed()) - th.SimulateTransportURLReady(cell1.TransportURLName) + infra.SimulateTransportURLReady(cell1.TransportURLName) // Expect that the NovaConductor config is updated with the new transport URL Eventually(func(g Gomega) { diff --git a/test/functional/suite_test.go b/test/functional/suite_test.go index 99953366c..a75745fc3 100644 --- a/test/functional/suite_test.go +++ b/test/functional/suite_test.go @@ -54,6 +54,7 @@ import ( novav1 "github.com/openstack-k8s-operators/nova-operator/api/v1beta1" "github.com/openstack-k8s-operators/nova-operator/controllers" + infra_test "github.com/openstack-k8s-operators/infra-operator/apis/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" mariadb_test "github.com/openstack-k8s-operators/mariadb-operator/api/test/helpers" @@ -73,6 +74,7 @@ var ( th *common_test.TestHelper keystone *keystone_test.TestHelper mariadb *mariadb_test.TestHelper + infra *infra_test.TestHelper novaNames NovaNames cell0 CellNames cell1 CellNames @@ -175,6 +177,8 @@ var _ = BeforeSuite(func() { Expect(keystone).NotTo(BeNil()) mariadb = mariadb_test.NewTestHelper(ctx, k8sClient, timeout, interval, logger) Expect(mariadb).NotTo(BeNil()) + infra = infra_test.NewTestHelper(ctx, k8sClient, timeout, interval, logger) + Expect(infra).NotTo(BeNil()) // Start the controller-manager in a goroutine webhookInstallOptions := &testEnv.WebhookInstallOptions