@@ -993,6 +993,92 @@ var _ = Describe("Designate controller", func() {
993993 }, timeout , interval ).Should (Succeed ())
994994 })
995995 })
996+
997+ // Quorum Queues Tests
998+ When ("Designate is created with quorum queues enabled from start" , func () {
999+ BeforeEach (func () {
1000+ createAndSimulateKeystone (designateName )
1001+ createAndSimulateRedis (designateRedisName )
1002+ createAndSimulateDesignateSecrets (designateName )
1003+ DeferCleanup (k8sClient .Delete , ctx , CreateTransportURL (transportURLName ))
1004+ DeferCleanup (k8sClient .Delete , ctx , infra .CreateTransportURLSecret (designateName .Namespace , transportURLSecretName .Name , true ))
1005+ infra .SimulateTransportURLReady (transportURLName )
1006+ createAndSimulateDB (spec )
1007+ DeferCleanup (k8sClient .Delete , ctx , CreateNAD (types.NamespacedName {
1008+ Name : spec ["designateNetworkAttachment" ].(string ),
1009+ Namespace : namespace ,
1010+ }))
1011+ DeferCleanup (th .DeleteInstance , CreateDesignate (designateName , spec ))
1012+ th .SimulateJobSuccess (designateDBSyncName )
1013+ })
1014+
1015+ It ("should configure quorum queues settings in designate.conf" , func () {
1016+ configData := th .GetSecret (
1017+ types.NamespacedName {
1018+ Namespace : designateName .Namespace ,
1019+ Name : fmt .Sprintf ("%s-config-data" , designateName .Name )})
1020+ Expect (configData ).ShouldNot (BeNil ())
1021+ conf := string (configData .Data ["designate.conf" ])
1022+
1023+ Expect (conf ).Should (ContainSubstring ("rabbit_quorum_queue=true" ))
1024+ Expect (conf ).Should (ContainSubstring ("rabbit_transient_quorum_queue=true" ))
1025+ Expect (conf ).Should (ContainSubstring ("amqp_durable_queues=true" ))
1026+ })
1027+ })
1028+
1029+ When ("Designate starts with quorum queues disabled then enables them" , func () {
1030+ BeforeEach (func () {
1031+ createAndSimulateKeystone (designateName )
1032+ createAndSimulateRedis (designateRedisName )
1033+ createAndSimulateDesignateSecrets (designateName )
1034+ DeferCleanup (k8sClient .Delete , ctx , CreateTransportURL (transportURLName ))
1035+ DeferCleanup (k8sClient .Delete , ctx , infra .CreateTransportURLSecret (designateName .Namespace , transportURLSecretName .Name , false ))
1036+ infra .SimulateTransportURLReady (transportURLName )
1037+ createAndSimulateDB (spec )
1038+ DeferCleanup (k8sClient .Delete , ctx , CreateNAD (types.NamespacedName {
1039+ Name : spec ["designateNetworkAttachment" ].(string ),
1040+ Namespace : namespace ,
1041+ }))
1042+ DeferCleanup (th .DeleteInstance , CreateDesignate (designateName , spec ))
1043+ th .SimulateJobSuccess (designateDBSyncName )
1044+ })
1045+
1046+ It ("should update config when quorum queues are enabled" , func () {
1047+ // Initially, quorum queues should be disabled
1048+ configData := th .GetSecret (
1049+ types.NamespacedName {
1050+ Namespace : designateName .Namespace ,
1051+ Name : fmt .Sprintf ("%s-config-data" , designateName .Name )})
1052+ Expect (configData ).ShouldNot (BeNil ())
1053+ conf := string (configData .Data ["designate.conf" ])
1054+
1055+ Expect (conf ).ShouldNot (ContainSubstring ("rabbit_quorum_queue=true" ))
1056+ Expect (conf ).ShouldNot (ContainSubstring ("rabbit_transient_quorum_queue=true" ))
1057+ Expect (conf ).ShouldNot (ContainSubstring ("amqp_durable_queues=true" ))
1058+
1059+ // Update the secret to enable quorum queues
1060+ Eventually (func (g Gomega ) {
1061+ secret := & corev1.Secret {}
1062+ g .Expect (k8sClient .Get (ctx , transportURLSecretName , secret )).Should (Succeed ())
1063+ secret .Data ["quorumqueues" ] = []byte ("true" )
1064+ g .Expect (k8sClient .Update (ctx , secret )).Should (Succeed ())
1065+ }, timeout , interval ).Should (Succeed ())
1066+
1067+ // Verify the configuration is updated with quorum queue settings
1068+ Eventually (func (g Gomega ) {
1069+ configData := th .GetSecret (
1070+ types.NamespacedName {
1071+ Namespace : designateName .Namespace ,
1072+ Name : fmt .Sprintf ("%s-config-data" , designateName .Name )})
1073+ g .Expect (configData ).ShouldNot (BeNil ())
1074+ conf := string (configData .Data ["designate.conf" ])
1075+
1076+ g .Expect (conf ).Should (ContainSubstring ("rabbit_quorum_queue=true" ))
1077+ g .Expect (conf ).Should (ContainSubstring ("rabbit_transient_quorum_queue=true" ))
1078+ g .Expect (conf ).Should (ContainSubstring ("amqp_durable_queues=true" ))
1079+ }, timeout , interval ).Should (Succeed ())
1080+ })
1081+ })
9961082})
9971083
9981084var _ = Describe ("Designate webhook validation" , func () {
0 commit comments