Reserve priority range for internal routers

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Baptiste Mayelle 2024-04-02 17:04:05 +02:00 committed by GitHub
parent c31f5df854
commit 2bc3fa7b4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 116 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package tcp
import (
"context"
"crypto/tls"
"math"
"net/http"
"net/http/httptest"
"testing"
@ -270,6 +271,39 @@ func TestRuntimeConfiguration(t *testing.T) {
},
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{