From e8ecc5a36cb59aef3f4823c4bbf07882faf07eb6 Mon Sep 17 00:00:00 2001 From: valeriiashapoval Date: Mon, 10 Jun 2024 11:50:05 +0100 Subject: [PATCH 1/2] automate ingress component route changes - 72868 --- tests/e2e/test_rosacli_ingress.go | 80 +++++++++++++++++++++ tests/utils/exec/rosacli/ingress_service.go | 1 + 2 files changed, 81 insertions(+) diff --git a/tests/e2e/test_rosacli_ingress.go b/tests/e2e/test_rosacli_ingress.go index 91beff3763..32ff982501 100644 --- a/tests/e2e/test_rosacli_ingress.go +++ b/tests/e2e/test_rosacli_ingress.go @@ -8,6 +8,7 @@ import ( "github.com/openshift/rosa/tests/ci/labels" "github.com/openshift/rosa/tests/utils/common" + "github.com/openshift/rosa/tests/utils/config" "github.com/openshift/rosa/tests/utils/exec/rosacli" ) @@ -284,4 +285,83 @@ var _ = Describe("Edit default ingress", Expect(expectLabel).To(BeElementOf(ingressRouteSelectors)) } }) + It("can update ingress components (oauth, downloads, console) - [id:72868]", + labels.Medium, + labels.Runtime.Day2, + func() { + + By("Record ingress default value") + output, err := rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + ingressList, err := rosaClient.Ingress.ReflectIngressList(output) + Expect(err).ToNot(HaveOccurred()) + defaultIngress := ingressList.Ingresses[0] + + By("Check edit ingress help message") + output, err = rosaClient.Ingress.EditIngress(clusterID, "-h") + Expect(err).ToNot(HaveOccurred()) + Expect(output.String()).Should(ContainSubstring("--component-routes")) + + By("Edit ingress with --component-routes") + componentRoutes := "oauth: hostname=oauth.hostname.com;tlsSecretRef=oauth-secret,downloads: hostname=downloads.hostname.com;tlsSecretRef=downloads-secret,console: hostname=console.hostname.com;tlsSecretRef=console-secret" + output, err = rosaClient.Ingress.EditIngress(clusterID, + defaultIngress.ID, + "--component-routes", componentRoutes, + ) + Expect(err).ToNot(HaveOccurred()) + defer rosaClient.Ingress.EditIngress(clusterID, + defaultIngress.ID, + "--component-routes", "oauth: hostname=oauth.hostname.com;tlsSecretRef=oauth-secret,downloads: hostname=downloads.hostname.com;tlsSecretRef=downloads-secret,console: hostname=console.hostname.com;tlsSecretRef=console-secret", + ) + + By("List ingress to check") + output, err = rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + }) + It("cannot update ingress components with incorrect syntax - [id:72868]", + labels.Medium, + labels.Runtime.Day2, + func() { + By("Record ingress default value") + output, err := rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + ingressList, err := rosaClient.Ingress.ReflectIngressList(output) + Expect(err).ToNot(HaveOccurred()) + defaultIngress := ingressList.Ingresses[0] + + By("Edit ingress with --component-routes") + componentRoutes := "oauth: hostname:custom1;tlsSecretRef=custom1,downloads: hostname=custom2;tlsSecretRef=custom2,console: hostname=custom3;tlsSecretRef=custom3" + output, err = rosaClient.Ingress.EditIngress(clusterID, + defaultIngress.ID, + "--component-routes", componentRoutes, + ) + Expect(err).To(HaveOccurred()) + Expect(output.String()).Should(ContainSubstring("An error occurred whilst parsing the supplied component routes: only the name of the component should be followed by ':'")) + By("List ingress to check") + output, err = rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + }) + It("cannot update ingress components with incorrect number of components - [id:72868]", + labels.Medium, + labels.Runtime.Day2, + func() { + By("Record ingress default value") + output, err := rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + ingressList, err := rosaClient.Ingress.ReflectIngressList(output) + Expect(err).ToNot(HaveOccurred()) + defaultIngress := ingressList.Ingresses[0] + + By("Edit ingress with --component-routes") + componentRoutes := "oauth: hostname=custom1;tlsSecretRef=custom1" + output, err = rosaClient.Ingress.EditIngress(clusterID, + defaultIngress.ID, + "--component-routes", componentRoutes, + ) + Expect(err).To(HaveOccurred()) + Expect(output.String()).Should(ContainSubstring("An error occurred whilst parsing the supplied component routes: the expected amount of component routes is 3, but 1 have been supplied")) + By("List ingress to check") + _, err = rosaClient.Ingress.ListIngress(clusterID) + Expect(err).ToNot(HaveOccurred()) + }) }) diff --git a/tests/utils/exec/rosacli/ingress_service.go b/tests/utils/exec/rosacli/ingress_service.go index e8f2539f1e..dcd9022364 100644 --- a/tests/utils/exec/rosacli/ingress_service.go +++ b/tests/utils/exec/rosacli/ingress_service.go @@ -60,6 +60,7 @@ type Ingress struct { ExcludeNamespace string `yaml:"Exclude Namespce,omitempty" json:"EXCLUDED NAMESPACE,omitempty"` WildcardPolicy string `yaml:"Wildcard Policy,omitempty" json:"WILDCARD POLICY,omitempty"` NamespaceOwnershipPolicy string `yaml:"Namespace Ownership Policy,omitempty" json:"NAMESPACE OWNERSHIP,omitempty"` + ComponentRoutes string `yaml:"Component Routes,omitempty" json:"COMPONENT ROUTES,omitempty"` } // Get specified ingress by ingress id From d603e691b4be505624318d35f58b3a7c77e836b9 Mon Sep 17 00:00:00 2001 From: valeriiashapoval Date: Wed, 17 Jul 2024 18:07:41 +0100 Subject: [PATCH 2/2] OCM-8679 | test: automated case id:72868 Separate the component route options when updating ingress --- tests/e2e/test_rosacli_ingress.go | 38 ++++++++----------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/tests/e2e/test_rosacli_ingress.go b/tests/e2e/test_rosacli_ingress.go index ad5ac6d593..3a50ad7df4 100644 --- a/tests/e2e/test_rosacli_ingress.go +++ b/tests/e2e/test_rosacli_ingress.go @@ -428,57 +428,39 @@ var _ = Describe("Edit default ingress", "--component-routes", componentRoutes, ) Expect(err).ToNot(HaveOccurred()) - defer rosaClient.Ingress.EditIngress(clusterID, + + _, err = rosaClient.Ingress.EditIngress(clusterID, defaultIngress.ID, - "--component-routes", "oauth: hostname=oauth.hostname.com;tlsSecretRef=oauth-secret,downloads: hostname=downloads.hostname.com;tlsSecretRef=downloads-secret,console: hostname=console.hostname.com;tlsSecretRef=console-secret", + "--component-routes", componentRoutes, ) + Expect(err).ToNot(HaveOccurred()) By("List ingress to check") output, err = rosaClient.Ingress.ListIngress(clusterID) Expect(err).ToNot(HaveOccurred()) - }) - It("cannot update ingress components with incorrect syntax - [id:72868]", - labels.Medium, - labels.Runtime.Day2, - func() { - By("Record ingress default value") - output, err := rosaClient.Ingress.ListIngress(clusterID) - Expect(err).ToNot(HaveOccurred()) - ingressList, err := rosaClient.Ingress.ReflectIngressList(output) - Expect(err).ToNot(HaveOccurred()) - defaultIngress := ingressList.Ingresses[0] - By("Edit ingress with --component-routes") - componentRoutes := "oauth: hostname:custom1;tlsSecretRef=custom1,downloads: hostname=custom2;tlsSecretRef=custom2,console: hostname=custom3;tlsSecretRef=custom3" + By("Edit ingress with --component-routes with incorrect syntax") + componentRoutes = "oauth: hostname:custom1;tlsSecretRef=custom1,downloads: hostname=custom2;tlsSecretRef=custom2,console: hostname=custom3;tlsSecretRef=custom3" output, err = rosaClient.Ingress.EditIngress(clusterID, defaultIngress.ID, "--component-routes", componentRoutes, ) Expect(err).To(HaveOccurred()) Expect(output.String()).Should(ContainSubstring("An error occurred whilst parsing the supplied component routes: only the name of the component should be followed by ':'")) + By("List ingress to check") output, err = rosaClient.Ingress.ListIngress(clusterID) Expect(err).ToNot(HaveOccurred()) - }) - It("cannot update ingress components with incorrect number of components - [id:72868]", - labels.Medium, - labels.Runtime.Day2, - func() { - By("Record ingress default value") - output, err := rosaClient.Ingress.ListIngress(clusterID) - Expect(err).ToNot(HaveOccurred()) - ingressList, err := rosaClient.Ingress.ReflectIngressList(output) - Expect(err).ToNot(HaveOccurred()) - defaultIngress := ingressList.Ingresses[0] - By("Edit ingress with --component-routes") - componentRoutes := "oauth: hostname=custom1;tlsSecretRef=custom1" + By("Edit ingress with --component-routes with incorrect number of components") + componentRoutes = "oauth: hostname=custom1;tlsSecretRef=custom1" output, err = rosaClient.Ingress.EditIngress(clusterID, defaultIngress.ID, "--component-routes", componentRoutes, ) Expect(err).To(HaveOccurred()) Expect(output.String()).Should(ContainSubstring("An error occurred whilst parsing the supplied component routes: the expected amount of component routes is 3, but 1 have been supplied")) + By("List ingress to check") _, err = rosaClient.Ingress.ListIngress(clusterID) Expect(err).ToNot(HaveOccurred())