Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[envtest]Use infra helpers from infra-operator #551

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions test/functional/nova_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
})

Expand Down
46 changes: 23 additions & 23 deletions test/functional/nova_multicell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions test/functional/nova_reconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions test/functional/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading