Fixed edited regex in audit_test unit test

Signed-off-by: Johnny Bieren <jbieren@redhat.com>
pull/6/head
Johnny Bieren 2016-09-14 14:08:41 -04:00
parent 6194bfb81d
commit df6299d110
1 changed files with 2 additions and 2 deletions

View File

@ -95,14 +95,14 @@ func TestAudit(t *testing.T) {
if len(line) != 2 { if len(line) != 2 {
t.Fatalf("Unexpected amount of lines in audit log: %d", len(line)) t.Fatalf("Unexpected amount of lines in audit log: %d", len(line))
} }
match, err := regexp.MatchString(`[\d\:\-\.\+,T,Z]+ AUDIT: id="[\w-]+" ip="127.0.0.1" method="GET" user="admin" as="<self>" namespace="default" uri="/api/v1/namespaces/default/pods"`, line[0]) match, err := regexp.MatchString(`[\d\:\-\.\+TZ]+ AUDIT: id="[\w-]+" ip="127.0.0.1" method="GET" user="admin" as="<self>" namespace="default" uri="/api/v1/namespaces/default/pods"`, line[0])
if err != nil { if err != nil {
t.Errorf("Unexpected error matching first line: %v", err) t.Errorf("Unexpected error matching first line: %v", err)
} }
if !match { if !match {
t.Errorf("Unexpected first line of audit: %s", line[0]) t.Errorf("Unexpected first line of audit: %s", line[0])
} }
match, err = regexp.MatchString(`[\d\:\-\.\+,T,Z]+ AUDIT: id="[\w-]+" response="200"`, line[1]) match, err = regexp.MatchString(`[\d\:\-\.\+TZ]+ AUDIT: id="[\w-]+" response="200"`, line[1])
if err != nil { if err != nil {
t.Errorf("Unexpected error matching second line: %v", err) t.Errorf("Unexpected error matching second line: %v", err)
} }