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

chore: move connection limit test resources out of the base #3859

Merged
merged 2 commits into from
Jul 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
2 changes: 1 addition & 1 deletion examples/extension-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
Expand Down
1 change: 1 addition & 0 deletions examples/extension-server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
15 changes: 0 additions & 15 deletions test/e2e/base/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -673,21 +673,6 @@ metadata:
namespace: envoy-gateway-system
type: kubernetes.io/tls
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: connection-limit-gateway
namespace: gateway-conformance-infra
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Same
---
apiVersion: v1
data:
ca.crt: |
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/testdata/connection-limit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: connection-limit-gateway
namespace: gateway-conformance-infra
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
Expand Down
20 changes: 19 additions & 1 deletion test/e2e/tests/connection_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
package tests

import (
"context"
"fmt"
"net"
"testing"
"time"

"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/conformance/utils/http"
Expand Down Expand Up @@ -56,8 +58,24 @@ var ConnectionLimitTest = suite.ConformanceTest{

// we make the number of connections equal to the number of connectionLimit connections + 3
// avoid partial connection errors or interruptions
for i := 0; i < 6; i++ {
// Try to open a connection to the gateway, this will consume one connection
if err := wait.PollUntilContextTimeout(context.TODO(), time.Second, time.Minute, true,
func(_ context.Context) (done bool, err error) {
_, err = net.DialTimeout("tcp", gwAddr, 100*time.Millisecond)
if err != nil {
t.Logf("failed to open connection: %v", err)
return false, nil
}
t.Log("opened connection 1")
return true, nil
}); err != nil {
t.Errorf("failed to open connections: %v", err)
}

// Open the remaining 5 connections
for i := 1; i < 6; i++ {
conn, err := net.Dial("tcp", gwAddr)
t.Logf("opened connection %d", i+1)
if err != nil {
t.Errorf("failed to open connection: %v", err)
} else {
Expand Down
Loading