@@ -828,6 +828,7 @@ var _ = Describe("OpenStackOperator controller", func() {
828828 BeforeEach (func () {
829829 // create cert secrets for rabbitmq instances
830830 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
831+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
831832 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
832833 // create cert secrets for memcached instance
833834 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
@@ -1141,6 +1142,7 @@ var _ = Describe("OpenStackOperator controller", func() {
11411142 BeforeEach (func () {
11421143 // create cert secrets for rabbitmq instances
11431144 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
1145+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
11441146 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
11451147 // create cert secrets for memcached instance
11461148 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
@@ -1268,6 +1270,7 @@ var _ = Describe("OpenStackOperator controller", func() {
12681270 BeforeEach (func () {
12691271 // create cert secrets for rabbitmq instances
12701272 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
1273+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
12711274 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
12721275 // create cert secrets for memcached instance
12731276 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
@@ -1807,6 +1810,76 @@ var _ = Describe("OpenStackOperator controller", func() {
18071810 })
18081811 })
18091812
1813+ When ("A OpenStackControlplane instance is created with top-scope notifications config pushed down" , func () {
1814+ BeforeEach (func () {
1815+ spec := GetDefaultOpenStackControlPlaneSpec ()
1816+ spec ["notificationsBus" ] = map [string ]interface {}{
1817+ "rabbitMqClusterName" : ptr .To ("rabbitmq-notifications" ),
1818+ }
1819+ spec ["nova" ] = map [string ]interface {}{
1820+ "enabled" : false ,
1821+ "template" : map [string ]interface {}{},
1822+ }
1823+ DeferCleanup (
1824+ th .DeleteInstance ,
1825+ CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1826+ )
1827+ })
1828+
1829+ It ("should have Nova notifications bus instance configured by inheritance" , func () {
1830+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1831+ Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (ContainSubstring ("rabbitmq-notifications" ))
1832+ })
1833+ })
1834+
1835+ When ("A OpenStackControlplane instance is created with notifications config override" , func () {
1836+ BeforeEach (func () {
1837+ spec := GetDefaultOpenStackControlPlaneSpec ()
1838+ spec ["notificationsBus" ] = map [string ]interface {}{
1839+ "rabbitMqClusterName" : ptr .To ("rabbitmq-notifications-top-scope" ),
1840+ }
1841+ spec ["nova" ] = map [string ]interface {}{
1842+ "enabled" : false ,
1843+ "template" : map [string ]interface {}{
1844+ "notificationsBusInstance" : ptr .To ("rabbitmq-custom" ),
1845+ },
1846+ }
1847+ DeferCleanup (
1848+ th .DeleteInstance ,
1849+ CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1850+ )
1851+ })
1852+
1853+ It ("should have Nova notifications bus instance configured from local templates" , func () {
1854+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1855+ Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("rabbitmq-custom" ))
1856+ })
1857+ })
1858+
1859+ When ("A OpenStackControlplane instance is created with notifications config force-disabled" , func () {
1860+ BeforeEach (func () {
1861+ spec := GetDefaultOpenStackControlPlaneSpec ()
1862+ spec ["notificationsBus" ] = map [string ]interface {}{
1863+ "rabbitMqClusterName" : ptr .To ("" ),
1864+ }
1865+ spec ["nova" ] = map [string ]interface {}{
1866+ "enabled" : false ,
1867+ "template" : map [string ]interface {}{
1868+ "notificationsBusInstance" : ptr .To ("rabbitmq-maybe" ),
1869+ },
1870+ }
1871+ DeferCleanup (
1872+ th .DeleteInstance ,
1873+ CreateOpenStackControlPlane (names .OpenStackControlplaneName , spec ),
1874+ )
1875+ })
1876+
1877+ It ("should have Nova enabled and its notifications bus instance configured for a special empty value" , func () {
1878+ OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
1879+ Expect (* OSCtlplane .Spec .Nova .Template .NotificationsBusInstance ).Should (Equal ("" ))
1880+ })
1881+ })
1882+
18101883 When ("OpenStackControlplane instance is deleted" , func () {
18111884 BeforeEach (func () {
18121885 DeferCleanup (
@@ -2089,6 +2162,7 @@ var _ = Describe("OpenStackOperator controller", func() {
20892162
20902163 // create cert secrets for rabbitmq instances
20912164 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCertName ))
2165+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQNotificationsCertName ))
20922166 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .RabbitMQCell1CertName ))
20932167 // create cert secrets for memcached instance
20942168 DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (names .MemcachedCertName ))
@@ -2929,6 +3003,7 @@ var _ = Describe("OpenStackOperator controller galera and rabbitmq", func() {
29293003
29303004 // create cert secrets for rabbitmq instances
29313005 th .CreateCertSecret (names .RabbitMQCertName )
3006+ th .CreateCertSecret (names .RabbitMQNotificationsCertName )
29323007 th .CreateCertSecret (names .RabbitMQCell1CertName )
29333008
29343009 extGalera := CreateGaleraConfig (namespace , GetDefaultGaleraSpec ())
@@ -3064,17 +3139,17 @@ var _ = Describe("OpenStackOperator controller galera and rabbitmq", func() {
30643139 Eventually (func (g Gomega ) {
30653140 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
30663141 rabbitTemplates := * (OSCtlplane .Spec .Rabbitmq .Templates )
3067- g .Expect (rabbitTemplates ).Should (HaveLen (2 ))
3142+ g .Expect (rabbitTemplates ).Should (HaveLen (3 ))
30683143 delete (rabbitTemplates , names .RabbitMQCell1Name .Name )
30693144 OSCtlplane .Spec .Rabbitmq .Templates = & rabbitTemplates
30703145 g .Expect (k8sClient .Update (ctx , OSCtlplane )).Should (Succeed ())
30713146 }, timeout , interval ).Should (Succeed ())
30723147
3073- // Only 1 cell in rabbitmq template
3148+ // Only 1 cell and notifications bus in rabbitmq template
30743149 Eventually (func (g Gomega ) {
30753150 OSCtlplane := GetOpenStackControlPlane (names .OpenStackControlplaneName )
30763151 rabbitTemplates := * (OSCtlplane .Spec .Rabbitmq .Templates )
3077- g .Expect (rabbitTemplates ).Should (HaveLen (1 ))
3152+ g .Expect (rabbitTemplates ).Should (HaveLen (2 ))
30783153 }, timeout , interval ).Should (Succeed ())
30793154
30803155 // cell1.rabbitmq should not exists in db
0 commit comments