From 6ec7f0d937670aec78ddfb535f3fef08d4dcfd81 Mon Sep 17 00:00:00 2001 From: Saloni Date: Wed, 24 Jul 2024 11:41:04 -0600 Subject: [PATCH] remove warp --- .github/workflows/functional.yml | 5 +--- tests/suite/ip_family_test.go | 41 +++++++++++++++++--------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/functional.yml b/.github/workflows/functional.yml index b65ea36039..9c27ee5fd9 100644 --- a/.github/workflows/functional.yml +++ b/.github/workflows/functional.yml @@ -34,9 +34,6 @@ jobs: with: go-version: stable - - name: Setup WARP - uses: fscarmen/warp-on-actions@v1.1 - - name: Set GOPATH run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -114,7 +111,7 @@ jobs: - name: Deploy Kubernetes id: k8s run: | - kind create cluster --name ${{ github.run_id }} --image=kindest/node:${{ inputs.k8s-version }} --config ../../config/cluster/kind-cluster.yaml + kind create cluster --name ${{ github.run_id }} --image=kindest/node:${{ inputs.k8s-version }} --config ./config/cluster/kind-cluster.yaml kind load docker-image ${{ join(fromJSON(steps.ngf-meta.outputs.json).tags, ' ') }} ${{ join(fromJSON(steps.nginx-meta.outputs.json).tags, ' ') }} --name ${{ github.run_id }} - name: Run functional telemetry tests diff --git a/tests/suite/ip_family_test.go b/tests/suite/ip_family_test.go index f289005815..e028449ebd 100644 --- a/tests/suite/ip_family_test.go +++ b/tests/suite/ip_family_test.go @@ -54,8 +54,8 @@ var _ = Describe("IPFamily", Ordered, Label("functional", "ip-family"), func() { } Expect(resourceManager.Apply([]client.Object{&ns})).To(Succeed()) - Expect(resourceManager.ApplyFromFiles(files, ns.Name)).To(Succeed()) Expect(resourceManager.ApplyFromFiles([]string{nginxProxyFile}, ns.Name)).To(Succeed()) + Expect(resourceManager.ApplyFromFiles(files, ns.Name)).To(Succeed()) Expect(resourceManager.WaitForAppsToBeReady(ns.Name)).To(Succeed()) }) @@ -128,7 +128,6 @@ var _ = Describe("IPFamily", Ordered, Label("functional", "ip-family"), func() { }) It("Successfully configures coffee route(IPv4), "+ "tea route(IPv6) has accepted condition set to InvalidIPFamily", func() { - Expect(resourceManager.ApplyFromFiles([]string{nginxProxyFile}, ns.Name)).To(Succeed()) Expect(updateGatewayClass()).Should(Succeed()) Expect(updateNginxProxy(ngfAPI.IPv4)).Should(Succeed()) @@ -157,23 +156,25 @@ var _ = Describe("IPFamily", Ordered, Label("functional", "ip-family"), func() { "coffee route(IPv4) has accepted condition set to InvalidIPFamily", func() { Expect(updateGatewayClass()).Should(Succeed()) Expect(updateNginxProxy(ngfAPI.IPv6)).Should(Succeed()) + Eventually( func() error { - return verifyRequestFailureAndRouteConditionToBeInvalidIPFamily( - coffeeURL, - address, - "coffee", - ns.Name, - "Service configured with IPv4 family but NginxProxy is configured with IPv6") + return checkWorkingTraffic(teaURL, address, true) }). WithTimeout(timeoutConfig.RequestTimeout). + WithPolling(2 * time.Second). Should(Succeed()) Eventually( func() error { - return checkWorkingTraffic(teaURL, address, true) + return verifyRequestFailureAndRouteConditionToBeInvalidIPFamily( + coffeeURL, + address, + "coffee", + ns.Name, + "Service configured with IPv4 family but NginxProxy is configured with IPv6") }). - WithTimeout(timeoutConfig.RequestTimeout). + WithTimeout(timeoutConfig.RequestTimeout * 2). WithPolling(2 * time.Second). Should(Succeed()) }) @@ -191,12 +192,12 @@ func verifyRequestFailureAndRouteConditionToBeInvalidIPFamily( namespace, expectedErrMessage string, ) error { - err := expectRequestFailureInternalError(appURL, address) + err := verifyHTTPRouteConditionToBeInvalidIPFamily(routeName, namespace, expectedErrMessage) if err != nil { return err } - err = verifyHTTPRouteConditionToBeInvalidIPFamily(routeName, namespace, expectedErrMessage) + err = expectRequestFailureInternalError(appURL, address) if err != nil { return err } @@ -206,6 +207,10 @@ func verifyRequestFailureAndRouteConditionToBeInvalidIPFamily( func expectRequestFailureInternalError(appURL, address string) error { status, body, err := framework.Get(appURL, address, timeoutConfig.RequestTimeout) + if err != nil { + return fmt.Errorf("error while sending request: %s", err.Error()) + } + if status != http.StatusInternalServerError { return errors.New("expected http status to be 500") } @@ -213,23 +218,20 @@ func expectRequestFailureInternalError(appURL, address string) error { if body != "" && !strings.Contains(body, "500 Internal Server Error") { return fmt.Errorf("expected response body to have Internal Server Error, instead received: %s", body) } - if err != nil { - return fmt.Errorf("error while sending request: %s", err.Error()) - } return nil } func checkWorkingTraffic(url, address string, ipv6Expected bool) error { status, body, err := framework.Get(url, address, timeoutConfig.RequestTimeout) - if status != http.StatusOK { - return errors.New("http response status is not 200") - } - if err != nil { return err } + if status != http.StatusOK { + return errors.New("http response status is not 200") + } + err = verifyIPType(body, ipv6Expected) return err } @@ -295,6 +297,7 @@ func verifyHTTPRouteConditionToBeInvalidIPFamily(httpRouteName, namespace, expec for _, parent := range route.Status.Parents { for _, condition := range parent.Conditions { + fmt.Println("condition.Type: ", condition.Type, condition.Message, condition.Status) if condition.Type == string(v1.RouteConditionResolvedRefs) && condition.Status == metav1.ConditionFalse && condition.Message == expectedErrMessage {