Add annotation to enable rewrite logs in a location
This commit is contained in:
parent
1086ec6c7e
commit
c995031ffd
7 changed files with 157 additions and 18 deletions
|
|
@ -62,7 +62,7 @@ func buildIngress() *extensions.Ingress {
|
|||
}
|
||||
}
|
||||
|
||||
func TestIngressLogConfig(t *testing.T) {
|
||||
func TestIngressAccessLogConfig(t *testing.T) {
|
||||
ing := buildIngress()
|
||||
|
||||
data := map[string]string{}
|
||||
|
|
@ -79,3 +79,21 @@ func TestIngressLogConfig(t *testing.T) {
|
|||
t.Errorf("expected access be disabled but is enabled")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIngressRewriteLogConfig(t *testing.T) {
|
||||
ing := buildIngress()
|
||||
|
||||
data := map[string]string{}
|
||||
data[parser.GetAnnotationWithPrefix("enable-rewrite-log")] = "true"
|
||||
ing.SetAnnotations(data)
|
||||
|
||||
log, _ := NewParser(&resolver.Mock{}).Parse(ing)
|
||||
nginxLogs, ok := log.(*Config)
|
||||
if !ok {
|
||||
t.Errorf("expected a Config type")
|
||||
}
|
||||
|
||||
if !nginxLogs.Rewrite {
|
||||
t.Errorf("expected rewrite log to be enabled but it is disabled")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue