Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
inelpandzic committed Oct 13, 2023
1 parent 24f9d6d commit 11bf35d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions percona/controller/pgcluster/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,17 @@ var _ = Describe("Services with LoadBalancerSourceRanges", Ordered, func() {
})

It("should create PerconaPGCluster with service exposed with loadBalancerSourceRanges", func() {
cr.Spec.Expose.LoadBalancerSourceRanges = []string{"10.10.10.10/16"}
cr.Spec.PgBouncer.Expose.LoadBalancerSourceRanges = []string{"10.10.11.11./16"}
cr.Spec.Expose = &v2.ServiceExpose{
LoadBalancerSourceRanges: []string{"10.10.10.10/16"},
}
cr.Spec.Proxy = &v2.PGProxySpec{
PGBouncer: &v2.PGBouncerSpec{
Image: "perconalab/percona-postgresql-operator:main-ppg15-pgbouncer",
ServiceExpose: &v2.ServiceExpose{
LoadBalancerSourceRanges: []string{"10.10.11.11./16"},
},
},
}
Expect(k8sClient.Create(ctx, cr)).Should(Succeed())
})

Expand All @@ -847,11 +856,11 @@ var _ = Describe("Services with LoadBalancerSourceRanges", Ordered, func() {
haService := &corev1.Service{}
err := k8sClient.Get(ctx, types.NamespacedName{Namespace: cr.Namespace, Name: cr.Name + "-ha"}, haService)
Expect(err).NotTo(HaveOccurred())
Expect(haServiceSpec.LoadBalancerSourceRanges).To(Equal(cr.Spec.Expose.LoadBalancerSourceRanges))
Expect(haService.Spec.LoadBalancerSourceRanges).To(Equal(cr.Spec.Expose.LoadBalancerSourceRanges))

pgbService := &corev1.Service{}
err := k8sClient.Get(ctx, types.NamespacedName{Namespace: cr.Namespace, Name: cr.Name + "-pgbouncer"}, pgbService)
err = k8sClient.Get(ctx, types.NamespacedName{Namespace: cr.Namespace, Name: cr.Name + "-pgbouncer"}, pgbService)
Expect(err).NotTo(HaveOccurred())
Expect(pgbService.Spec.LoadBalancerSourceRanges).To(Equal(cr.Spec.PgBouncer.Expose.LoadBalancerSourceRanges))
Expect(pgbService.Spec.LoadBalancerSourceRanges).To(Equal(cr.Spec.Proxy.PGBouncer.ServiceExpose.LoadBalancerSourceRanges))
})
})

0 comments on commit 11bf35d

Please sign in to comment.