Merge branch v2.11 into v3.0

This commit is contained in:
Fernandez Ludovic 2024-04-03 17:44:16 +02:00
commit 9f145dbc28
130 changed files with 245 additions and 322 deletions

View file

@ -3,6 +3,7 @@ package tcp
import (
"context"
"crypto/tls"
"math"
"net/http"
"net/http/httptest"
"testing"
@ -265,11 +266,45 @@ func TestRuntimeConfiguration(t *testing.T) {
EntryPoints: []string{"web"},
Service: "foo-service",
Rule: "HostSNI(`foo.bar`)",
TLS: &dynamic.RouterTCPTLSConfig{},
},
},
},
expectedError: 2,
},
{
desc: "Router with priority exceeding the max user-defined priority",
tcpServiceConfig: map[string]*runtime.TCPServiceInfo{
"foo-service": {
TCPService: &dynamic.TCPService{
LoadBalancer: &dynamic.TCPServersLoadBalancer{
Servers: []dynamic.TCPServer{
{
Port: "8085",
Address: "127.0.0.1:8085",
},
{
Address: "127.0.0.1:8086",
Port: "8086",
},
},
},
},
},
},
tcpRouterConfig: map[string]*runtime.TCPRouterInfo{
"bar": {
TCPRouter: &dynamic.TCPRouter{
EntryPoints: []string{"web"},
Service: "foo-service",
Rule: "HostSNI(`foo.bar`)",
TLS: &dynamic.RouterTCPTLSConfig{},
Priority: math.MaxInt,
},
},
},
expectedError: 1,
},
{
desc: "Router with HostSNI but no TLS",
tcpServiceConfig: map[string]*runtime.TCPServiceInfo{
@ -299,8 +334,6 @@ func TestRuntimeConfiguration(t *testing.T) {
}
for _, test := range testCases {
test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()