Skip to content

Commit

Permalink
remove warp
Browse files Browse the repository at this point in the history
  • Loading branch information
salonichf5 committed Jul 25, 2024
1 parent 9073a57 commit 6ec7f0d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
with:
go-version: stable

- name: Setup WARP
uses: fscarmen/[email protected]

- name: Set GOPATH
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

Expand Down Expand Up @@ -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
Expand Down
41 changes: 22 additions & 19 deletions tests/suite/ip_family_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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())
})
Expand All @@ -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
}
Expand All @@ -206,30 +207,31 @@ 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")
}

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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6ec7f0d

Please sign in to comment.