fix: use defaultEntryPoints when no entryPoint is defined in a TCPRouter

This commit is contained in:
LandryBe 2021-05-11 16:46:14 +02:00 committed by GitHub
parent 40f21f41e1
commit 6ae194934d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 7 deletions

View file

@ -449,6 +449,35 @@ func Test_mergeConfiguration_tlsStore(t *testing.T) {
}
}
func Test_mergeConfiguration_defaultTCPEntryPoint(t *testing.T) {
given := dynamic.Configurations{
"provider-1": &dynamic.Configuration{
TCP: &dynamic.TCPConfiguration{
Routers: map[string]*dynamic.TCPRouter{
"router-1": {},
},
Services: map[string]*dynamic.TCPService{
"service-1": {},
},
},
},
}
expected := &dynamic.TCPConfiguration{
Routers: map[string]*dynamic.TCPRouter{
"router-1@provider-1": {
EntryPoints: []string{"defaultEP"},
},
},
Services: map[string]*dynamic.TCPService{
"service-1@provider-1": {},
},
}
actual := mergeConfiguration(given, []string{"defaultEP"})
assert.Equal(t, expected, actual.TCP)
}
func Test_applyModel(t *testing.T) {
testCases := []struct {
desc string