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>
This commit is contained in:
Mihai Parparita 2022-05-06 10:08:57 -07:00 committed by GitHub
parent 7966aed1e0
commit 025867fd07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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