MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestPoolStats_RecordGet

Function TestPoolStats_RecordGet

pkg/metrics/pool_stats_test.go:51–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestPoolStats_RecordGet(t *testing.T) {
52 metrics.ResetPoolStats()
53
54 _ = metrics.RecordNamedPoolGet("tokenizer")
55 _ = metrics.RecordNamedPoolPut("tokenizer")
56
57 stats := metrics.GetPoolStats()
58 ts, ok := stats["tokenizer"]
59 if !ok {
60 t.Fatal("missing tokenizer key after reset+record")
61 }
62 if ts.Gets < 1 {
63 t.Errorf("expected Gets >= 1 after RecordNamedPoolGet, got %d", ts.Gets)
64 }
65 if ts.Puts < 1 {
66 t.Errorf("expected Puts >= 1 after RecordNamedPoolPut, got %d", ts.Puts)
67 }
68}
69
70func TestPoolStats_ActiveCalculation(t *testing.T) {
71 metrics.ResetPoolStats()

Callers

nothing calls this directly

Calls 5

ResetPoolStatsFunction · 0.92
RecordNamedPoolGetFunction · 0.92
RecordNamedPoolPutFunction · 0.92
GetPoolStatsFunction · 0.92
ErrorfMethod · 0.65

Tested by

no test coverage detected