Skip to content

Commit aa8d783

Browse files
authored
Merge pull request #249 from rabbitmq/tls-sys-test
Verify successful create of the policy object in TLS system tests
2 parents e17b696 + f5c54f6 commit aa8d783

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

system_tests/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ package system_tests
1212
import (
1313
"context"
1414
"embed"
15-
"testing"
16-
1715
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16+
"testing"
1817

1918
rabbithole "github.com/michaelklishin/rabbit-hole/v2"
2019
topology "github.com/rabbitmq/messaging-topology-operator/api/v1beta1"

system_tests/tls_system_test.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ package system_tests
33
import (
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

1917
var _ = 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

Comments
 (0)