From 3a9629c357b0298e13340af1ed08aa8056e592fc Mon Sep 17 00:00:00 2001 From: Saan <94980910+sbin64@users.noreply.github.com> Date: Sun, 9 Mar 2025 20:08:19 +0000 Subject: [PATCH 1/3] fix: apply validation to check the conversion --- test/e2e/v4/plugin_cluster_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index f39c9cf4a7f..a27fe6cf87a 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -412,8 +412,23 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart, _, err = kbc.Kubectl.Apply(true, "-f", conversionCRPath) Expect(err).NotTo(HaveOccurred(), "failed to apply modified ConversionTest CR") - // TODO: Add validation to check the conversion + // Apply validation to check the conversion // the v2 should have spec.replicas == 3 + By("validating that v2 spec.replicas is set to 3 via conversion") + Eventually(func(g Gomega) { + output, err := kbc.Kubectl.Get( + true, + "-n", "test-ns", + "conversiontest.v2."+kbc.Group, + "conversion-test", + "-o", "jsonpath={.spec.replicas}", + ) + g.Expect(err).NotTo(HaveOccurred(), "failed to fetch v2 conversiontest") + + replicas, err := strconv.Atoi(output) + g.Expect(err).NotTo(HaveOccurred(), "invalid replicas value") + g.Expect(replicas).To(Equal(3), "expected v2.spec.replicas == 3") + }, time.Minute, time.Second).Should(Succeed()) if hasMetrics { By("validating conversion metrics to confirm conversion operations") From 25332cdc9c35660fb7c4401837a1477a5e3924a0 Mon Sep 17 00:00:00 2001 From: Saan <94980910+sbin64@users.noreply.github.com> Date: Tue, 11 Mar 2025 23:43:05 +0530 Subject: [PATCH 2/3] fetch from cluster-scoped resources --- test/e2e/v4/plugin_cluster_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index a27fe6cf87a..9cf8e8d679c 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -417,8 +417,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart, By("validating that v2 spec.replicas is set to 3 via conversion") Eventually(func(g Gomega) { output, err := kbc.Kubectl.Get( - true, - "-n", "test-ns", + false, "conversiontest.v2."+kbc.Group, "conversion-test", "-o", "jsonpath={.spec.replicas}", From 7a5861d43487f9b0d81cc6ac18568d32f43bff1a Mon Sep 17 00:00:00 2001 From: Saan <94980910+sbin64@users.noreply.github.com> Date: Thu, 13 Mar 2025 01:04:33 +0530 Subject: [PATCH 3/3] modify to true --- test/e2e/v4/plugin_cluster_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index 9cf8e8d679c..c181dd2c5b3 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -417,7 +417,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart, By("validating that v2 spec.replicas is set to 3 via conversion") Eventually(func(g Gomega) { output, err := kbc.Kubectl.Get( - false, + true, "conversiontest.v2."+kbc.Group, "conversion-test", "-o", "jsonpath={.spec.replicas}",