From 7d48a1d88f6b111ffea5fe65ce75a820e3583044 Mon Sep 17 00:00:00 2001 From: Jason Gerlowski Date: Wed, 11 Dec 2024 10:35:42 -0500 Subject: [PATCH] Initial test assertions for service cleanup --- tests/e2e/solrcloud_scaling_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/e2e/solrcloud_scaling_test.go b/tests/e2e/solrcloud_scaling_test.go index 106dd4fb..4b41d59b 100644 --- a/tests/e2e/solrcloud_scaling_test.go +++ b/tests/e2e/solrcloud_scaling_test.go @@ -62,6 +62,17 @@ var _ = FDescribe("E2E - SolrCloud - Scale Down", func() { }) FContext("with replica migration", func() { + BeforeEach(func() { + solrCloud.Spec.SolrAddressability = solrv1beta1.SolrAddressabilityOptions{ + External: &solrv1beta1.ExternalAddressability{ + Method: solrv1beta1.Ingress, + UseExternalAddress: true, + HideNodes: false, + DomainName: "test.solr.org", + }, + } + }) + FIt("Scales Down", func(ctx context.Context) { originalSolrCloud := solrCloud.DeepCopy() solrCloud.Spec.Replicas = pointer.Int32(1) @@ -134,6 +145,11 @@ var _ = FDescribe("E2E - SolrCloud - Scale Down", func() { g.Expect(clusterOp).To(BeNil(), "StatefulSet should not have a ScaleDown lock after scaling is complete.") }) + // Once the scale-down occurs, services for the now-defunct pods should begone + Eventually(Expect(k8sClient.Get(ctx, resourceKey(solrCloud, solrCloud.GetSolrPodName(0)), &corev1.Service{})).To(Succeed())) + expectNoService(ctx, solrCloud, solrCloud.GetSolrPodName(2), "Pod-2 service still exists after scale-down") + expectNoService(ctx, solrCloud, solrCloud.GetSolrPodName(1), "Pod-1 service still exists after scale-down") + expectNoPod(ctx, solrCloud, solrCloud.GetSolrPodName(1)) queryCollection(ctx, solrCloud, solrCollection1, 0) queryCollection(ctx, solrCloud, solrCollection2, 0)