Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: skip some test on IPv6/non-dual #4726

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ func TestE2E(t *testing.T) {
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug)
}

skipTests := []string{
tests.GatewayInfraResourceTest.ShortName, // https://github.com/envoyproxy/gateway/issues/3191
}

// Skip test only work on DualStack cluster
if tests.IPFamily != "dual" {
skipTests = append(skipTests,
tests.BackendDualStackTest.ShortName,
tests.HTTPRouteDualStackTest.ShortName,
)
}

cSuite, err := suite.NewConformanceTestSuite(suite.ConformanceOptions{
Client: c,
RestConfig: cfg,
Expand All @@ -50,9 +62,7 @@ func TestE2E(t *testing.T) {
// SupportedFeatures cannot be empty, so we set it to SupportGateway
// All e2e tests should leave Features empty.
SupportedFeatures: sets.New[features.FeatureName](features.SupportGateway),
SkipTests: []string{
tests.GatewayInfraResourceTest.ShortName, // https://github.com/envoyproxy/gateway/issues/3191
},
SkipTests: skipTests,
AllowCRDsMismatch: *flags.AllowCRDsMismatch,
})
if err != nil {
Expand Down
15 changes: 1 addition & 14 deletions test/e2e/tests/backend_dualstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package tests

import (
"os"
"testing"

"k8s.io/apimachinery/pkg/types"
Expand All @@ -20,11 +19,7 @@ import (

// If the environment is not dual, the IPv6 manifest cannot be applied, so the test will be skipped.
func init() {
if os.Getenv("IP_FAMILY") == "dual" {
ConformanceTests = append(ConformanceTests, BackendDualStackTest)
} else {
ConformanceTests = append(ConformanceTests, SkipBackendDualStackTest)
}
ConformanceTests = append(ConformanceTests, BackendDualStackTest)
}

var BackendDualStackTest = suite.ConformanceTest{
Expand Down Expand Up @@ -63,11 +58,3 @@ func runBackendDualStackTest(t *testing.T, suite *suite.ConformanceTestSuite, ns

http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse)
}

var SkipBackendDualStackTest = suite.ConformanceTest{
ShortName: "BackendDualStack",
Description: "Skipping BackendDualStack test as IP_FAMILY is not dual",
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Skip("Skipping BackendDualStack test as IP_FAMILY is not dual")
},
}
16 changes: 1 addition & 15 deletions test/e2e/tests/httproute_dualstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package tests

import (
"os"
"testing"

"k8s.io/apimachinery/pkg/types"
Expand All @@ -18,13 +17,8 @@ import (
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)

// If the environment is not dual, the IPv6 manifest cannot be applied, so the test will be skipped.
func init() {
if os.Getenv("IP_FAMILY") == "dual" {
ConformanceTests = append(ConformanceTests, HTTPRouteDualStackTest)
} else {
ConformanceTests = append(ConformanceTests, SkipHTTPRouteDualStackTest)
}
ConformanceTests = append(ConformanceTests, HTTPRouteDualStackTest)
}

var HTTPRouteDualStackTest = suite.ConformanceTest{
Expand Down Expand Up @@ -63,11 +57,3 @@ func runHTTPRouteTest(t *testing.T, suite *suite.ConformanceTestSuite, ns string

http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse)
}

var SkipHTTPRouteDualStackTest = suite.ConformanceTest{
ShortName: "HTTPRouteDualStack",
Description: "Skipping HTTPRouteDualStack test as IP_FAMILY is not dual",
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Skip("Skipping HTTPRouteDualStack test as IP_FAMILY is not dual")
},
}
12 changes: 12 additions & 0 deletions test/e2e/tests/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ var RateLimitCIDRMatchTest = suite.ConformanceTest{
Description: "Limit all requests that match CIDR",
Manifests: []string{"testdata/ratelimit-cidr-match.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
if IPFamily == "ipv6" {
t.Skip("Skipping test as IP_FAMILY is IPv6")
}

t.Run("block all ips", func(t *testing.T) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "cidr-ratelimit", Namespace: ns}
Expand Down Expand Up @@ -484,6 +488,10 @@ var RateLimitMultipleListenersTest = suite.ConformanceTest{
Description: "Limit requests on multiple listeners",
Manifests: []string{"testdata/ratelimit-multiple-listeners.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
if IPFamily == "ipv6" {
t.Skip("Skipping test as IP_FAMILY is IPv6")
}

t.Run("block all ips on listener 80 and 8080", func(t *testing.T) {
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "cidr-ratelimit", Namespace: ns}
Expand Down Expand Up @@ -549,6 +557,10 @@ var RateLimitHeadersAndCIDRMatchTest = suite.ConformanceTest{
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)

t.Run("all matched both headers and cidr can got limited", func(t *testing.T) {
if IPFamily == "ipv6" {
t.Skip("Skipping test as IP_FAMILY is IPv6")
}

requestHeaders := map[string]string{
"x-user-id": "one",
"x-user-org": "acme",
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"net"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -44,6 +45,8 @@ import (
tb "github.com/envoyproxy/gateway/internal/troubleshoot"
)

var IPFamily = os.Getenv("IP_FAMILY")

const defaultServiceStartupTimeout = 5 * time.Minute

var PodReady = corev1.PodCondition{Type: corev1.PodReady, Status: corev1.ConditionTrue}
Expand Down