@@ -3,17 +3,15 @@ package system_tests
33import (
44 "context"
55 "fmt"
6- corev1 "k8s.io/api/core/v1"
7-
86 "github.com/google/uuid"
7+ . "github.com/onsi/ginkgo"
8+ . "github.com/onsi/gomega"
99 rabbitmqv1beta1 "github.com/rabbitmq/cluster-operator/api/v1beta1"
1010 topology "github.com/rabbitmq/messaging-topology-operator/api/v1beta1"
11+ corev1 "k8s.io/api/core/v1"
1112 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1213 "k8s.io/apimachinery/pkg/runtime"
1314 "k8s.io/apimachinery/pkg/types"
14-
15- . "github.com/onsi/ginkgo"
16- . "github.com/onsi/gomega"
1715)
1816
1917var _ = Describe ("RabbitmqCluster with TLS" , func () {
@@ -27,9 +25,6 @@ var _ = Describe("RabbitmqCluster with TLS", func() {
2725 )
2826
2927 BeforeEach (func () {
30- targetCluster = basicTestRabbitmqCluster ("tls-cluster" , namespace )
31- setupTestRabbitmqCluster (k8sClient , targetCluster )
32-
3328 secretName = fmt .Sprintf ("rmq-test-cert-%v" , uuid .New ())
3429 _ , _ , _ = createTLSSecret (secretName , namespace , "tls-cluster.rabbitmq-system.svc" )
3530
@@ -45,11 +40,10 @@ var _ = Describe("RabbitmqCluster with TLS", func() {
4540 )
4641 Expect (err ).NotTo (HaveOccurred ())
4742
48- Expect ( k8sClient . Get ( context . Background (), types. NamespacedName { Name : targetCluster . Name , Namespace : targetCluster . Namespace }, targetCluster )). To ( Succeed () )
43+ targetCluster = basicTestRabbitmqCluster ( "tls-cluster" , namespace )
4944 targetCluster .Spec .TLS .SecretName = secretName
5045 targetCluster .Spec .TLS .DisableNonTLSListeners = true
51- updateTestRabbitmqCluster (k8sClient , targetCluster )
52-
46+ setupTestRabbitmqCluster (k8sClient , targetCluster )
5347 targetClusterRef = topology.RabbitmqClusterReference {Name : targetCluster .Name }
5448 })
5549
@@ -97,5 +91,16 @@ var _ = Describe("RabbitmqCluster with TLS", func() {
9791 },
9892 }
9993 Expect (k8sClient .Create (ctx , & policy )).To (Succeed ())
94+
95+ var fetchedPolicy topology.Policy
96+ Eventually (func () []topology.Condition {
97+ Expect (k8sClient .Get (ctx , types.NamespacedName {Name : policy .Name , Namespace : policy .Namespace }, & fetchedPolicy )).To (Succeed ())
98+ return fetchedPolicy .Status .Conditions
99+ }, 10 , 2 ).Should (HaveLen (1 ))
100+
101+ readyCondition := fetchedPolicy .Status .Conditions [0 ]
102+ Expect (string (readyCondition .Type )).To (Equal ("Ready" ))
103+ Expect (readyCondition .Status ).To (Equal (corev1 .ConditionTrue ))
104+ Expect (readyCondition .Reason ).To (Equal ("SuccessfulCreateOrUpdate" ))
100105 })
101106})
0 commit comments