@@ -652,55 +652,65 @@ var _ = Describe("Nova multicell", func() {
652652 })
653653 When ("cell1 DB and MQ create finishes before cell0 DB create" , func () {
654654 BeforeEach (func () {
655- DeferCleanup (k8sClient .Delete , ctx , CreateNovaSecret (namespace , SecretName ))
655+ DeferCleanup (k8sClient .Delete , ctx , CreateNovaSecret (novaNames . Namespace , SecretName ))
656656 DeferCleanup (
657657 k8sClient .Delete ,
658658 ctx ,
659- CreateNovaMessageBusSecret (namespace , "mq-for-cell1- secret" ),
659+ CreateNovaMessageBusSecret (cell0 . CellName . Namespace , fmt . Sprintf ( "%s- secret", cell0 . TransportURLName . Name ) ),
660660 )
661661 serviceSpec := corev1.ServiceSpec {Ports : []corev1.ServicePort {{Port : 3306 }}}
662- DeferCleanup (th .DeleteDBService , th .CreateDBService (namespace , "db-for-api" , serviceSpec ))
663- DeferCleanup (th .DeleteDBService , th .CreateDBService (namespace , "db-for-cell1" , serviceSpec ))
662+ DeferCleanup (
663+ th .DeleteDBService ,
664+ th .CreateDBService (
665+ novaNames .APIMariaDBDatabaseName .Namespace ,
666+ novaNames .APIMariaDBDatabaseName .Name ,
667+ serviceSpec ))
668+ DeferCleanup (
669+ th .DeleteDBService ,
670+ th .CreateDBService (
671+ cell1 .MariaDBDatabaseName .Namespace ,
672+ cell1 .MariaDBDatabaseName .Name ,
673+ serviceSpec ))
664674
665675 spec := GetDefaultNovaSpec ()
666- cell0 := GetDefaultNovaCellTemplate ()
667- cell0 ["cellName" ] = "cell0"
668- cell0 ["cellDatabaseInstance" ] = "db-for-api"
669- cell0 ["cellDatabaseUser" ] = "nova_cell0"
676+ cell0Template := GetDefaultNovaCellTemplate ()
677+ cell0Template ["cellDatabaseInstance" ] = cell0 .MariaDBDatabaseName .Name
678+ cell0Template ["cellDatabaseUser" ] = "nova_cell0"
670679
671- cell1 := GetDefaultNovaCellTemplate ()
672- cell1 ["cellName" ] = "cell1"
673- cell1 ["cellDatabaseInstance" ] = "db-for-cell1"
674- cell1 ["cellDatabaseUser" ] = "nova_cell1"
675- cell1 ["cellMessageBusInstance" ] = "mq-for-cell1"
680+ cell1Template := GetDefaultNovaCellTemplate ()
681+ cell1Template ["cellDatabaseInstance" ] = cell1 .MariaDBDatabaseName .Name
682+ cell1Template ["cellDatabaseUser" ] = "nova_cell1"
683+ cell1Template ["cellMessageBusInstance" ] = cell1 .TransportURLName .Name
676684
677685 spec ["cellTemplates" ] = map [string ]interface {}{
678- "cell0" : cell0 ,
679- "cell1" : cell1 ,
686+ "cell0" : cell0Template ,
687+ "cell1" : cell1Template ,
680688 }
681- spec ["apiDatabaseInstance" ] = "db-for-api"
682- spec ["apiMessageBusInstance" ] = "mq-for-api"
689+ spec ["apiDatabaseInstance" ] = novaNames . APIMariaDBDatabaseName . Name
690+ spec ["apiMessageBusInstance" ] = cell0 . TransportURLName . Name
683691
684- DeferCleanup (DeleteInstance , CreateNova (novaName , spec ))
685- keystoneAPIName := th .CreateKeystoneAPI (namespace )
692+ DeferCleanup (th . DeleteInstance , CreateNova (novaNames . NovaName , spec ))
693+ keystoneAPIName := th .CreateKeystoneAPI (novaNames . Namespace )
686694 DeferCleanup (th .DeleteKeystoneAPI , keystoneAPIName )
687695 keystoneAPI := th .GetKeystoneAPI (keystoneAPIName )
688696 keystoneAPI .Status .APIEndpoints ["internal" ] = "http://keystone-internal-openstack.testing"
689697 Eventually (func (g Gomega ) {
690698 g .Expect (k8sClient .Status ().Update (ctx , keystoneAPI .DeepCopy ())).Should (Succeed ())
691699 }, timeout , interval ).Should (Succeed ())
692- th .SimulateKeystoneServiceReady (novaKeystoneServiceName )
700+ th .SimulateKeystoneServiceReady (novaNames . KeystoneServiceName )
693701 })
694702
695- // We cannot merge this test as is because if the tests run
696- // in parallel then this test hangs forever (not even the global
697- // ginkgo --timeout stops it). If you run it with --procs 1 locally
698- // then it shows the panic and terminates
699- // It("panics", func(ctx SpecContext) {
700- // th.SimulateMariaDBDatabaseCompleted(cell1.MariaDBDatabaseName)
701- // th.SimulateTransportURLReady(cell1.TransportURLName)
702-
703- // // BUG: the nova-controller-manager panics but it should not
704- // })
703+ It ("waits for cell0 DB to be created" , func (ctx SpecContext ) {
704+ th .SimulateMariaDBDatabaseCompleted (cell1 .MariaDBDatabaseName )
705+ th .SimulateTransportURLReady (cell1 .TransportURLName )
706+ // NOTE(gibi): before the fix https://github.com/openstack-k8s-operators/nova-operator/pull/356
707+ // nova-controller panic at this point and test would hang
708+ th .ExpectCondition (
709+ novaNames .NovaName ,
710+ ConditionGetterFunc (NovaConditionGetter ),
711+ novav1 .NovaAllCellsReadyCondition ,
712+ corev1 .ConditionFalse ,
713+ )
714+ })
705715 })
706716})
0 commit comments