fix: default passHostHeader for file provider.

This commit is contained in:
Ludovic Fernandez 2019-09-30 18:12:04 +02:00 committed by Traefiker Bot
parent 230cd28ac9
commit 48f11900d3
22 changed files with 193 additions and 161 deletions

View file

@ -13,7 +13,8 @@ import (
"github.com/stretchr/testify/require"
)
func Int(v int) *int { return &v }
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func TestDefaultRule(t *testing.T) {
testCases := []struct {
@ -64,7 +65,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -113,7 +114,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -164,7 +165,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -208,7 +209,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -252,7 +253,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -301,7 +302,7 @@ func TestDefaultRule(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -384,7 +385,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -452,7 +453,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Test2": {
@ -462,7 +463,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -531,7 +532,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -581,7 +582,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -633,7 +634,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -677,7 +678,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -734,7 +735,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -781,7 +782,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Service2": {
@ -791,7 +792,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -842,7 +843,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1052,7 +1053,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1101,7 +1102,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1193,7 +1194,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1266,7 +1267,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1361,7 +1362,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1429,7 +1430,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1519,7 +1520,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.3:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1592,7 +1593,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1655,7 +1656,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Test2": {
@ -1665,7 +1666,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1715,7 +1716,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1766,7 +1767,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "h2c://127.0.0.1:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1812,7 +1813,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Service2": {
@ -1822,7 +1823,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -2037,7 +2038,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -2098,7 +2099,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -2348,7 +2349,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},

View file

@ -164,8 +164,11 @@ func createLoadBalancerServerHTTP(client Client, namespace string, service v1alp
lb.SetDefaults()
lb.Servers = servers
if service.PassHostHeader != nil {
lb.PassHostHeader = *service.PassHostHeader
lb.PassHostHeader = service.PassHostHeader
if lb.PassHostHeader == nil {
passHostHeader := true
lb.PassHostHeader = &passHostHeader
}
lb.ResponseForwarding = service.ResponseForwarding

View file

@ -12,7 +12,8 @@ import (
var _ provider.Provider = (*Provider)(nil)
func Int(v int) *int { return &v }
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func TestLoadIngressRouteTCPs(t *testing.T) {
testCases := []struct {
@ -737,7 +738,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -786,7 +787,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -836,7 +837,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -878,7 +879,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"default-test.route-77c62dfe9517144aeeaa": {
@ -891,7 +892,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -943,7 +944,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"default-test.route-77c62dfe9517144aeeaa-whoami2-8080": {
@ -956,7 +957,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.4:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1007,7 +1008,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"default-test.route-77c62dfe9517144aeeaa-whoami2-8080": {
@ -1020,7 +1021,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.4:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1132,7 +1133,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1190,7 +1191,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1248,7 +1249,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1305,7 +1306,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1351,7 +1352,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1397,7 +1398,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1435,7 +1436,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1472,7 +1473,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "https://10.10.0.6:8443",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1509,7 +1510,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "https://10.10.0.8:8443",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1584,7 +1585,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1620,7 +1621,7 @@ func TestLoadIngressRoutes(t *testing.T) {
URL: "http://10.10.0.2:80",
},
},
PassHostHeader: false,
PassHostHeader: Bool(false),
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: "10s"},
},
},

View file

@ -248,7 +248,7 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend
return &dynamic.Service{
LoadBalancer: &dynamic.ServersLoadBalancer{
Servers: servers,
PassHostHeader: true,
PassHostHeader: func(v bool) *bool { return &v }(true),
},
}, nil
}

View file

@ -19,6 +19,8 @@ import (
var _ provider.Provider = (*Provider)(nil)
func Bool(v bool) *bool { return &v }
func TestLoadConfigurationFromIngresses(t *testing.T) {
testCases := []struct {
desc string
@ -51,7 +53,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -85,7 +87,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -119,7 +121,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -149,7 +151,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -178,7 +180,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-example-com-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.11.0.1:80",
@ -209,7 +211,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -243,7 +245,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -277,7 +279,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -318,7 +320,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -363,7 +365,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -376,7 +378,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"testing-service2-8082": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.2:8080",
@ -429,7 +431,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"default-backend": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",
@ -459,7 +461,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8089",
@ -489,7 +491,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8089",
@ -519,7 +521,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8089",
@ -553,7 +555,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8089",
@ -566,7 +568,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"testing-service1-carotte": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8090",
@ -600,7 +602,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8089",
@ -613,7 +615,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
},
"toto-service1-tchouk": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.11.0.1:8089",
@ -665,7 +667,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8080": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://traefik.wtf:8080",
@ -697,7 +699,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-example-com-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.11.0.1:80",
@ -734,7 +736,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "https://10.10.0.1:8443",
@ -764,7 +766,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "https://10.10.0.1:8443",
@ -795,7 +797,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-8443": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "https://10.10.0.1:8443",
@ -826,7 +828,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"default-backend": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.30.0.1:8080",
@ -856,7 +858,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
Services: map[string]*dynamic.Service{
"testing-service1-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
PassHostHeader: true,
PassHostHeader: Bool(true),
Servers: []dynamic.Server{
{
URL: "http://10.10.0.1:8080",

View file

@ -11,7 +11,8 @@ import (
"github.com/stretchr/testify/require"
)
func Int(v int) *int { return &v }
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func TestGetConfigurationAPIErrors(t *testing.T) {
fakeClient := newFakeClient(true, marathon.Applications{})
@ -64,7 +65,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -118,7 +119,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -164,7 +165,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -211,7 +212,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:8081",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -266,7 +267,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:8083",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -308,7 +309,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
"bar": {LoadBalancer: &dynamic.ServersLoadBalancer{
Servers: []dynamic.Server{
@ -316,7 +317,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:8081",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -354,7 +355,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:81",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -390,7 +391,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
}},
},
},
@ -428,7 +429,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -459,7 +460,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -503,7 +504,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -537,7 +538,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Service2": {
@ -547,7 +548,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -639,7 +640,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"app2": {
@ -649,7 +650,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -696,7 +697,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"app2": {
@ -706,7 +707,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -744,7 +745,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"app2": {
@ -754,7 +755,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -802,7 +803,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -840,7 +841,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"app2": {
@ -850,7 +851,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -887,7 +888,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -925,7 +926,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "h2c://localhost:90",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -958,7 +959,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Service2": {
@ -968,7 +969,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:8080",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1133,7 +1134,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1171,7 +1172,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1208,7 +1209,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -1417,7 +1418,7 @@ func TestBuildConfiguration(t *testing.T) {
URL: "http://localhost:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},

View file

@ -9,7 +9,8 @@ import (
"github.com/stretchr/testify/require"
)
func Int(v int) *int { return &v }
func Int(v int) *int { return &v }
func Bool(v bool) *bool { return &v }
func Test_buildConfiguration(t *testing.T) {
testCases := []struct {
@ -51,7 +52,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -103,7 +104,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Test2": {
@ -113,7 +114,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -168,7 +169,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
"Test2": {
@ -178,7 +179,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://128.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -222,7 +223,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -310,7 +311,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -380,7 +381,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -433,7 +434,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -475,7 +476,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.1:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},
@ -667,7 +668,7 @@ func Test_buildConfiguration(t *testing.T) {
URL: "http://127.0.0.2:80",
},
},
PassHostHeader: true,
PassHostHeader: Bool(true),
},
},
},