1
0
Fork 0

Merge branch v2.11 into v3.2

This commit is contained in:
kevinpollet 2024-11-12 16:24:22 +01:00
commit b7b4dd9554
No known key found for this signature in database
GPG key ID: 0C9A5DDD1B292453
43 changed files with 1094 additions and 789 deletions

View file

@ -67,8 +67,8 @@ type ProviderAggregator struct {
}
// NewProviderAggregator returns an aggregate of all the providers configured in the static configuration.
func NewProviderAggregator(conf static.Providers) ProviderAggregator {
p := ProviderAggregator{
func NewProviderAggregator(conf static.Providers) *ProviderAggregator {
p := &ProviderAggregator{
providersThrottleDuration: time.Duration(conf.ProvidersThrottleDuration),
}
@ -168,12 +168,12 @@ func (p *ProviderAggregator) AddProvider(provider provider.Provider) error {
}
// Init the provider.
func (p ProviderAggregator) Init() error {
func (p *ProviderAggregator) Init() error {
return nil
}
// Provide calls the provide method of every providers.
func (p ProviderAggregator) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {
func (p *ProviderAggregator) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {
if p.fileProvider != nil {
p.launchProvider(configurationChan, pool, p.fileProvider)
}
@ -193,7 +193,7 @@ func (p ProviderAggregator) Provide(configurationChan chan<- dynamic.Message, po
return nil
}
func (p ProviderAggregator) launchProvider(configurationChan chan<- dynamic.Message, pool *safe.Pool, prd provider.Provider) {
func (p *ProviderAggregator) launchProvider(configurationChan chan<- dynamic.Message, pool *safe.Pool, prd provider.Provider) {
jsonConf, err := redactor.RemoveCredentials(prd)
if err != nil {
log.Debug().Err(err).Msgf("Cannot marshal the provider configuration %T", prd)

View file

@ -15,8 +15,7 @@ import (
"github.com/traefik/traefik/v3/pkg/types"
)
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func pointer[T any](v T) *T { return &v }
func TestDefaultRule(t *testing.T) {
testCases := []struct {
@ -67,7 +66,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -125,7 +124,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -175,7 +174,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -225,7 +224,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -281,7 +280,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -375,7 +374,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -436,7 +435,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "https://127.0.0.1:443",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -530,7 +529,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "https://127.0.0.2:444",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -615,7 +614,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -628,7 +627,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -695,7 +694,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -759,7 +758,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -826,7 +825,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -882,7 +881,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -939,7 +938,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -988,7 +987,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1050,7 +1049,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1102,7 +1101,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1115,7 +1114,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1297,7 +1296,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1352,7 +1351,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1433,7 +1432,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1501,7 +1500,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1585,7 +1584,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1649,7 +1648,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1727,7 +1726,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1797,7 +1796,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1853,7 +1852,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1910,7 +1909,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "h2c://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1961,7 +1960,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1974,7 +1973,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2207,7 +2206,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2274,7 +2273,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2710,7 +2709,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2801,7 +2800,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3019,7 +3018,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "https://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3033,7 +3032,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "https://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3319,7 +3318,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3495,7 +3494,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3508,7 +3507,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:81",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3611,7 +3610,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:81",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3691,7 +3690,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3704,7 +3703,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:81",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3803,7 +3802,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3816,7 +3815,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:81",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3829,7 +3828,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:82",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3842,7 +3841,7 @@ func TestFilterHealthStatuses(t *testing.T) {
URL: "http://127.0.0.1:83",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},

View file

@ -74,7 +74,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -137,7 +137,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -202,7 +202,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -259,7 +259,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -316,7 +316,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -379,7 +379,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -613,7 +613,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -696,7 +696,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -709,7 +709,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -792,7 +792,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -856,7 +856,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -921,7 +921,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -978,7 +978,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1048,7 +1048,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1108,7 +1108,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1121,7 +1121,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1185,7 +1185,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1431,7 +1431,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1494,7 +1494,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1594,7 +1594,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1681,7 +1681,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1790,7 +1790,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1871,7 +1871,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1974,7 +1974,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2060,7 +2060,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2136,7 +2136,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2149,7 +2149,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2213,7 +2213,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2278,7 +2278,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "h2c://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2337,7 +2337,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2350,7 +2350,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2554,7 +2554,7 @@ func TestDynConfBuilder_build(t *testing.T) {
Services: map[string]*dynamic.Service{
"Test": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2819,7 +2819,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2894,7 +2894,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3368,7 +3368,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3549,7 +3549,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://192.168.0.1:8081",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3612,7 +3612,7 @@ func TestDynConfBuilder_build(t *testing.T) {
URL: "http://127.0.0.1:79",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -4031,6 +4031,4 @@ func TestDynConfBuilder_getIPAddress_swarm(t *testing.T) {
}
}
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func pointer[T any](v T) *T { return &v }

View file

@ -14,8 +14,7 @@ import (
"github.com/traefik/traefik/v3/pkg/types"
)
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func pointer[T any](v T) *T { return &v }
func TestDefaultRule(t *testing.T) {
testCases := []struct {
@ -69,7 +68,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://10.0.0.1:1337",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -127,7 +126,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -187,7 +186,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -239,7 +238,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -291,7 +290,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -349,7 +348,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -558,7 +557,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -631,7 +630,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -644,7 +643,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -717,7 +716,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -776,7 +775,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -836,7 +835,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -888,7 +887,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -953,7 +952,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1008,7 +1007,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1021,7 +1020,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1080,7 +1079,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1291,7 +1290,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1349,7 +1348,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1439,7 +1438,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1516,7 +1515,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1610,7 +1609,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1681,7 +1680,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1769,7 +1768,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1846,7 +1845,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1912,7 +1911,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1925,7 +1924,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1984,7 +1983,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2044,7 +2043,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "h2c://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2104,7 +2103,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "h2c://127.0.0.1:8040",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2172,7 +2171,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:32124",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2185,7 +2184,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:32123",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2239,7 +2238,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2252,7 +2251,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2542,7 +2541,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2612,7 +2611,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3046,7 +3045,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3206,7 +3205,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},

View file

@ -363,7 +363,7 @@ func (c configBuilder) buildServersLB(namespace string, svc traefikv1alpha1.Load
return &dynamic.Service{LoadBalancer: lb}, nil
}
func (c *configBuilder) makeServersTransportKey(parentNamespace string, serversTransportName string) (string, error) {
func (c configBuilder) makeServersTransportKey(parentNamespace string, serversTransportName string) (string, error) {
if serversTransportName == "" {
return "", nil
}

File diff suppressed because it is too large Load diff

View file

@ -126,8 +126,8 @@ func Test_parseServiceConfig(t *testing.T) {
},
ServersScheme: "protocol",
ServersTransport: "foobar@file",
PassHostHeader: Bool(true),
NativeLB: Bool(true),
PassHostHeader: pointer(true),
NativeLB: pointer(true),
},
},
},
@ -139,7 +139,7 @@ func Test_parseServiceConfig(t *testing.T) {
expected: &ServiceConfig{
Service: &ServiceIng{
Sticky: &dynamic.Sticky{Cookie: &dynamic.Cookie{}},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
},
},
},

View file

@ -22,7 +22,7 @@ import (
var _ provider.Provider = (*Provider)(nil)
func Bool(v bool) *bool { return &v }
func pointer[T any](v T) *T { return &v }
func TestLoadConfigurationFromIngresses(t *testing.T) {
testCases := []struct {
@ -67,7 +67,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -117,7 +117,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -161,7 +161,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -197,7 +197,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -233,7 +233,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -269,7 +269,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -301,7 +301,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -333,7 +333,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-example-com-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -366,7 +366,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -402,7 +402,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -438,7 +438,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -454,7 +454,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"testing-service2-8082": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -487,7 +487,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -523,7 +523,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"default-backend": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -555,7 +555,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -587,7 +587,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -619,7 +619,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -655,7 +655,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -671,7 +671,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"testing-service1-carotte": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -703,7 +703,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -739,7 +739,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -755,7 +755,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"toto-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -807,7 +807,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -837,7 +837,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-example-com-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -876,7 +876,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -908,7 +908,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -941,7 +941,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -975,7 +975,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"default-backend": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1007,7 +1007,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1079,7 +1079,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1114,7 +1114,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1144,7 +1144,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1173,7 +1173,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1202,7 +1202,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1231,7 +1231,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1260,7 +1260,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1289,7 +1289,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1321,7 +1321,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1353,7 +1353,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1382,7 +1382,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1437,7 +1437,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-foobar": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1478,7 +1478,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"default-backend": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1545,7 +1545,7 @@ func TestLoadConfigurationFromIngressesWithExternalNameServices(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1579,7 +1579,7 @@ func TestLoadConfigurationFromIngressesWithExternalNameServices(t *testing.T) {
URL: "http://[2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b]:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1609,7 +1609,7 @@ func TestLoadConfigurationFromIngressesWithExternalNameServices(t *testing.T) {
URL: "http://[2001:0db8:3c4d:0015:0000:0000:1a2f:2a3b]:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1657,7 +1657,7 @@ func TestLoadConfigurationFromIngressesWithNativeLB(t *testing.T) {
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: dynamic.DefaultFlushInterval},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
Servers: []dynamic.Server{
{
URL: "http://10.0.0.1:8080",
@ -1706,7 +1706,7 @@ func TestLoadConfigurationFromIngressesWithNodePortLB(t *testing.T) {
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: dynamic.DefaultFlushInterval},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
Servers: []dynamic.Server{
{
URL: "http://172.16.4.4:32456",
@ -1943,7 +1943,7 @@ func TestLoadConfigurationFromIngressesWithNativeLBByDefault(t *testing.T) {
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: dynamic.DefaultFlushInterval},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
Servers: []dynamic.Server{
{
URL: "http://10.0.0.1:8080",
@ -1970,7 +1970,7 @@ func TestLoadConfigurationFromIngressesWithNativeLBByDefault(t *testing.T) {
"default-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: dynamic.DefaultFlushInterval},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
Servers: []dynamic.Server{
{
URL: "http://10.0.0.1:8080",

View file

@ -15,8 +15,7 @@ import (
"github.com/traefik/traefik/v3/pkg/types"
)
func Bool(v bool) *bool { return &v }
func String(v string) *string { return &v }
func pointer[T any](v T) *T { return &v }
func Test_buildConfiguration(t *testing.T) {
provider := newProviderMock(mapToPairs(map[string]string{
@ -385,7 +384,7 @@ func Test_buildConfiguration(t *testing.T) {
"foobar",
"foobar",
},
ForceSlash: Bool(true),
ForceSlash: pointer(true),
},
},
"Middleware00": {
@ -428,7 +427,7 @@ func Test_buildConfiguration(t *testing.T) {
Cert: "foobar",
Key: "foobar",
InsecureSkipVerify: true,
CAOptional: Bool(true),
CAOptional: pointer(true),
},
TrustForwardHeader: true,
AuthResponseHeaders: []string{
@ -601,14 +600,14 @@ func Test_buildConfiguration(t *testing.T) {
"foobar",
"foobar",
},
SSLRedirect: Bool(true),
SSLTemporaryRedirect: Bool(true),
SSLHost: String("foobar"),
SSLRedirect: pointer(true),
SSLTemporaryRedirect: pointer(true),
SSLHost: pointer("foobar"),
SSLProxyHeaders: map[string]string{
"name1": "foobar",
"name0": "foobar",
},
SSLForceHost: Bool(true),
SSLForceHost: pointer(true),
STSSeconds: 42,
STSIncludeSubdomains: true,
STSPreload: true,
@ -622,7 +621,7 @@ func Test_buildConfiguration(t *testing.T) {
ContentSecurityPolicyReportOnly: "foobar",
PublicKey: "foobar",
ReferrerPolicy: "foobar",
FeaturePolicy: String("foobar"),
FeaturePolicy: pointer("foobar"),
PermissionsPolicy: "foobar",
IsDevelopment: true,
},
@ -662,13 +661,13 @@ func Test_buildConfiguration(t *testing.T) {
Interval: ptypes.Duration(time.Second),
Timeout: ptypes.Duration(time.Second),
Hostname: "foobar",
FollowRedirects: func(v bool) *bool { return &v }(true),
FollowRedirects: pointer(true),
Headers: map[string]string{
"name0": "foobar",
"name1": "foobar",
},
},
PassHostHeader: func(v bool) *bool { return &v }(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(time.Second),
},
@ -677,8 +676,8 @@ func Test_buildConfiguration(t *testing.T) {
"Service02": {
Mirroring: &dynamic.Mirroring{
Service: "foobar",
MirrorBody: func(v bool) *bool { return &v }(true),
MaxBodySize: func(v int64) *int64 { return &v }(42),
MirrorBody: pointer(true),
MaxBodySize: pointer[int64](42),
Mirrors: []dynamic.MirrorService{
{
Name: "foobar",
@ -696,11 +695,11 @@ func Test_buildConfiguration(t *testing.T) {
Services: []dynamic.WRRService{
{
Name: "foobar",
Weight: func(v int) *int { return &v }(42),
Weight: pointer(42),
},
{
Name: "foobar",
Weight: func(v int) *int { return &v }(42),
Weight: pointer(42),
},
},
Sticky: &dynamic.Sticky{
@ -784,7 +783,7 @@ func Test_buildConfiguration(t *testing.T) {
Services: map[string]*dynamic.TCPService{
"TCPService01": {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
TerminationDelay: func(v int) *int { return &v }(42),
TerminationDelay: pointer(42),
Servers: []dynamic.TCPServer{
{Address: "foobar"},
{Address: "foobar"},
@ -796,11 +795,11 @@ func Test_buildConfiguration(t *testing.T) {
Services: []dynamic.TCPWRRService{
{
Name: "foobar",
Weight: func(v int) *int { return &v }(42),
Weight: pointer(42),
},
{
Name: "foobar",
Weight: func(v int) *int { return &v }(43),
Weight: pointer(43),
},
},
},

View file

@ -61,7 +61,7 @@ func Test_defaultRule(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -119,7 +119,7 @@ func Test_defaultRule(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -168,7 +168,7 @@ func Test_defaultRule(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -223,7 +223,7 @@ func Test_defaultRule(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -301,7 +301,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -368,7 +368,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://192.168.1.101:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -381,7 +381,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://192.168.1.102:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -448,7 +448,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -512,7 +512,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -579,7 +579,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -635,7 +635,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -692,7 +692,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -777,7 +777,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -839,7 +839,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -891,7 +891,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -904,7 +904,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1087,7 +1087,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1142,7 +1142,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1224,7 +1224,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1293,7 +1293,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1356,7 +1356,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1424,7 +1424,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1480,7 +1480,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1537,7 +1537,7 @@ func Test_buildConfig(t *testing.T) {
URL: "h2c://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1588,7 +1588,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1601,7 +1601,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:8080",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1800,7 +1800,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -1867,7 +1867,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2279,7 +2279,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2370,7 +2370,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2587,7 +2587,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2600,7 +2600,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2819,7 +2819,7 @@ func Test_buildConfig(t *testing.T) {
URL: "http://127.0.0.1:9999",
},
},
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -2906,7 +2906,7 @@ func Test_buildConfigAllowEmptyServicesTrue(t *testing.T) {
"Test": {
LoadBalancer: &dynamic.ServersLoadBalancer{
Servers: nil,
PassHostHeader: Bool(true),
PassHostHeader: pointer(true),
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: ptypes.Duration(100 * time.Millisecond),
},
@ -3254,5 +3254,4 @@ func extractNamespacesFromProvider(providers []*Provider) []string {
return res
}
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func pointer[T any](v T) *T { return &v }

View file

@ -32,7 +32,7 @@ func New(staticCfg static.Configuration) *Provider {
}
// ThrottleDuration returns the throttle duration.
func (i Provider) ThrottleDuration() time.Duration {
func (i *Provider) ThrottleDuration() time.Duration {
return 0
}