(b *testing.B)
| 67 | } |
| 68 | |
| 69 | func BenchmarkTemplate(b *testing.B) { |
| 70 | runtime.GOMAXPROCS(4) |
| 71 | |
| 72 | wafInstance, err := waf.Template() |
| 73 | if err != nil { |
| 74 | b.Fatal(err) |
| 75 | } |
| 76 | |
| 77 | b.ResetTimer() |
| 78 | |
| 79 | b.RunParallel(func(pb *testing.PB) { |
| 80 | for pb.Next() { |
| 81 | req, err := http.NewRequest(http.MethodGet, "https://example.com/index.php?id=123"+types.String(rand.Int()%10000), nil) |
| 82 | if err != nil { |
| 83 | b.Fatal(err) |
| 84 | } |
| 85 | req.Header.Set("User-Agent", testUserAgent) |
| 86 | |
| 87 | _, _ = wafInstance.MatchRequest(requests.NewTestRequest(req), nil, firewallconfigs.ServerCaptchaTypeNone) |
| 88 | } |
| 89 | }) |
| 90 | } |
| 91 | |
| 92 | func testTemplate1010(a *assert.Assertion, t *testing.T, template *waf.WAF) { |
| 93 | for _, id := range []string{ |
nothing calls this directly
no test coverage detected