(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestPoolStats_ActiveCalculation(t *testing.T) { |
| 71 | metrics.ResetPoolStats() |
| 72 | |
| 73 | metrics.RecordNamedPoolGet("parser") |
| 74 | metrics.RecordNamedPoolGet("parser") |
| 75 | metrics.RecordNamedPoolPut("parser") |
| 76 | |
| 77 | stats := metrics.GetPoolStats() |
| 78 | ps := stats["parser"] |
| 79 | if ps.Gets != 2 { |
| 80 | t.Errorf("expected Gets=2, got %d", ps.Gets) |
| 81 | } |
| 82 | if ps.Puts != 1 { |
| 83 | t.Errorf("expected Puts=1, got %d", ps.Puts) |
| 84 | } |
| 85 | if ps.Active() != 1 { |
| 86 | t.Errorf("expected Active()=1, got %d", ps.Active()) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | func TestPoolStats_ResetClearsCounters(t *testing.T) { |
| 91 | metrics.RecordNamedPoolGet("ast") |
nothing calls this directly
no test coverage detected