MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestNewUserAgentParser_GC

Function TestNewUserAgentParser_GC

internal/stats/user_agent_parser_test.go:51–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestNewUserAgentParser_GC(t *testing.T) {
52 if !testutils.IsSingleTesting() {
53 return
54 }
55
56 var parser = stats.NewUserAgentParser()
57
58 for i := 0; i < 1_000_000; i++ {
59 parser.Parse("Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Test/" + types.String(rands.Int(0, 100_000)))
60 }
61
62 time.Sleep(60 * time.Second) // wait to gc
63 t.Log(parser.Len(), "cache items")
64}
65
66func TestNewUserAgentParser_Mobile(t *testing.T) {
67 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 6

IsSingleTestingFunction · 0.92
NewUserAgentParserFunction · 0.92
ParseMethod · 0.80
LogMethod · 0.80
StringMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected