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

@ -150,6 +150,7 @@ func TestBuildConfiguration(t *testing.T) {
label.TraefikFrontendRedirectEntryPoint: aws.String("https"),
label.TraefikFrontendRedirectRegex: aws.String("nope"),
label.TraefikFrontendRedirectReplacement: aws.String("nope"),
label.TraefikFrontendRedirectPermanent: aws.String("true"),
label.TraefikFrontendRule: aws.String("Host:traefik.io"),
label.TraefikFrontendWhitelistSourceRange: aws.String("10.10.10.10"),
@ -333,6 +334,7 @@ func TestBuildConfiguration(t *testing.T) {
EntryPoint: "https",
Regex: "",
Replacement: "",
Permanent: true,
},
},
},
@ -1152,6 +1154,20 @@ func TestGetRedirect(t *testing.T) {
EntryPoint: "https",
},
},
{
desc: "should return a struct when entry point redirect label (permanent)",
instance: ecsInstance{
containerDefinition: &ecs.ContainerDefinition{
DockerLabels: map[string]*string{
label.TraefikFrontendRedirectEntryPoint: aws.String("https"),
label.TraefikFrontendRedirectPermanent: aws.String("true"),
}},
},
expected: &types.Redirect{
EntryPoint: "https",
Permanent: true,
},
},
{
desc: "should return a struct when regex redirect labels",
instance: ecsInstance{
@ -1166,6 +1182,22 @@ func TestGetRedirect(t *testing.T) {
Replacement: "$1",
},
},
{
desc: "should return a struct when regex redirect tags (permanent)",
instance: ecsInstance{
containerDefinition: &ecs.ContainerDefinition{
DockerLabels: map[string]*string{
label.TraefikFrontendRedirectRegex: aws.String("(.*)"),
label.TraefikFrontendRedirectReplacement: aws.String("$1"),
label.TraefikFrontendRedirectPermanent: aws.String("true"),
}},
},
expected: &types.Redirect{
Regex: "(.*)",
Replacement: "$1",
Permanent: true,
},
},
}
for _, test := range testCases {