Redirection: permanent move option.

This commit is contained in:
Ludovic Fernandez 2018-01-31 19:10:04 +01:00 committed by Traefiker
parent c944d203fb
commit 58d6681824
83 changed files with 622 additions and 8611 deletions

View file

@ -122,6 +122,7 @@ func TestDockerBuildConfiguration(t *testing.T) {
label.TraefikFrontendRedirectEntryPoint: "https",
label.TraefikFrontendRedirectRegex: "nope",
label.TraefikFrontendRedirectReplacement: "nope",
label.TraefikFrontendRedirectPermanent: "true",
label.TraefikFrontendRule: "Host:traefik.io",
label.TraefikFrontendWhitelistSourceRange: "10.10.10.10",
@ -259,6 +260,7 @@ func TestDockerBuildConfiguration(t *testing.T) {
EntryPoint: "https",
Regex: "",
Replacement: "",
Permanent: true,
},
},
},
@ -1221,6 +1223,20 @@ func TestDockerGetRedirect(t *testing.T) {
EntryPoint: "https",
},
},
{
desc: "should return a struct when entry point redirect label (permanent)",
container: containerJSON(
name("test1"),
labels(map[string]string{
label.TraefikFrontendRedirectEntryPoint: "https",
label.TraefikFrontendRedirectPermanent: "true",
}),
),
expected: &types.Redirect{
EntryPoint: "https",
Permanent: true,
},
},
{
desc: "should return a struct when regex redirect labels",
container: containerJSON(
@ -1235,6 +1251,22 @@ func TestDockerGetRedirect(t *testing.T) {
Replacement: "$1",
},
},
{
desc: "should return a struct when regex redirect tags (permanent)",
container: containerJSON(
name("test1"),
labels(map[string]string{
label.TraefikFrontendRedirectRegex: "(.*)",
label.TraefikFrontendRedirectReplacement: "$1",
label.TraefikFrontendRedirectPermanent: "true",
}),
),
expected: &types.Redirect{
Regex: "(.*)",
Replacement: "$1",
Permanent: true,
},
},
}
for _, test := range testCases {