util/clientmetric: switch to TestHooks struct for test-only functions (#4632)

Followup to 7966aed1e0 to pick up
review feedback that was accidentally left out.

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
bradfitz/tcp_flows
Mihai Parparita 3 years ago committed by GitHub
parent 7966aed1e0
commit 025867fd07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -255,10 +255,6 @@ func EncodeLogTailMetricsDelta() string {
return enc.buf.String() return enc.buf.String()
} }
func ResetLastDeltaForTest() {
lastDelta = time.Time{}
}
var deltaPool = &sync.Pool{ var deltaPool = &sync.Pool{
New: func() any { New: func() any {
return new(deltaEncBuf) return new(deltaEncBuf)
@ -308,3 +304,11 @@ func (b *deltaEncBuf) writeHexVarint(v int64) {
hex.Encode(hexBuf, b.scratch[:n]) hex.Encode(hexBuf, b.scratch[:n])
b.buf.Write(hexBuf) b.buf.Write(hexBuf)
} }
var TestHooks testHooks
type testHooks struct{}
func (testHooks) ResetLastDelta() {
lastDelta = time.Time{}
}

Loading…
Cancel
Save