Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuweizzz committed Jul 17, 2024
1 parent 5d5f625 commit 1170258
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
20 changes: 20 additions & 0 deletions pkg/event_processor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,35 @@ func TestEventProcessor_Serve(t *testing.T) {

lines = strings.Split(string(bufString), "\n")
ok := true
h2Req := 0
h2Resq := 0
for _, line := range lines {
if strings.Contains(strings.ToLower(line), "dump") {
t.Log(line)
ok = false
}
// http2 parse error log
if strings.Contains(line, "[http2 re") {
t.Log(line)
ok = false
}
// http2 parse count
if strings.Contains(line, "HTTP2Response") {
h2Resq += 1
}
if strings.Contains(line, "HTTP2Request") {
h2Req += 1
}
}
if err != nil {
t.Fatalf("close error: %s", err.Error())
}
if h2Resq != 3 {
t.Fatalf("some errors occurred: HTTP2Response lack")
}
if h2Req != 2 {
t.Fatalf("some errors occurred: HTTP2Request lack")
}
if !ok {
t.Fatalf("some errors occurred")
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/event_processor/testdata/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{"DataType":1,"Timestamp":952293599178141,"Pid":469960,"Tid":469960,"DataLen":77,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":0,"Timestamp":952293616935735,"Pid":469960,"Tid":469960,"DataLen":1179,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":0,"Timestamp":952293617095621,"Pid":469960,"Tid":469960,"DataLen":1664,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":2,"Timestamp":952293616935736,"Pid":469961,"Tid":469961,"DataLen":130,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":2,"Timestamp":952293616935738,"Pid":469962,"Tid":469962,"DataLen":182,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":3,"Timestamp":952293616935737,"Pid":469963,"Tid":469963,"DataLen":406,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":3,"Timestamp":952293616935739,"Pid":469964,"Tid":469964,"DataLen":545,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":3,"Timestamp":952293616935740,"Pid":469965,"Tid":469965,"DataLen":384,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":1,"Timestamp":952293616935736,"Pid":469961,"Tid":469961,"DataLen":130,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":1,"Timestamp":952293616935738,"Pid":469962,"Tid":469962,"DataLen":182,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":0,"Timestamp":952293616935737,"Pid":469963,"Tid":469963,"DataLen":406,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":0,"Timestamp":952293616935739,"Pid":469964,"Tid":469964,"DataLen":545,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}
{"DataType":0,"Timestamp":952293616935740,"Pid":469965,"Tid":469965,"DataLen":384,"Comm":[99,117,114,108,0,0,0,0,0,0,0,0,0,0,0,0],"Fd":5,"Version":771}

0 comments on commit 1170258

Please sign in to comment.