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 router
import (
"context"
"io"
"math"
"net/http"
"net/http/httptest"
"strings"
@ -698,6 +699,32 @@ func TestRuntimeConfiguration(t *testing.T) {
},
expectedError: 2,
},
{
desc: "Router priority exceeding max user-defined priority",
serviceConfig: map[string]*dynamic.Service{
"foo-service": {
LoadBalancer: &dynamic.ServersLoadBalancer{
Servers: []dynamic.Server{
{
URL: "http://127.0.0.1",
},
},
},
},
},
middlewareConfig: map[string]*dynamic.Middleware{},
routerConfig: map[string]*dynamic.Router{
"bar": {
EntryPoints: []string{"web"},
Service: "foo-service",
Rule: "Host(`foo.bar`)",
Priority: math.MaxInt,
TLS: &dynamic.RouterTLSConfig{},
},
},
tlsOptions: map[string]tls.Options{},
expectedError: 1,
},
{
desc: "Router with broken tlsOption",
serviceConfig: map[string]*dynamic.Service{