mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Fix audit_test regex for iso8601 timestamps
Signed-off-by: Johnny Bieren <jbieren@redhat.com>
This commit is contained in:
parent
0d3799b8e2
commit
6194bfb81d
@ -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\:\-\.\+]+ 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\:\-\.\+,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])
|
||||||
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\:\-\.\+]+ AUDIT: id="[\w-]+" response="200"`, line[1])
|
match, err = regexp.MatchString(`[\d\:\-\.\+,T,Z]+ 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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user