Add 'use regex' annotation to toggle nginx regex location modifier

This commit is contained in:
Zenara Daley 2018-10-01 13:54:11 -04:00
parent f56e839134
commit f29bdc3e8d
10 changed files with 325 additions and 39 deletions

View file

@ -178,3 +178,20 @@ func TestAppRoot(t *testing.T) {
t.Errorf("Unexpected value got in AppRoot")
}
}
func TestUseRegex(t *testing.T) {
ing := buildIngress()
data := map[string]string{}
data[parser.GetAnnotationWithPrefix("use-regex")] = "true"
ing.SetAnnotations(data)
i, _ := NewParser(mockBackend{redirect: true}).Parse(ing)
redirect, ok := i.(*Config)
if !ok {
t.Errorf("expected a App Context")
}
if redirect.UseRegex != true {
t.Errorf("Unexpected value got in UseRegex")
}
}