mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-06 15:46:53 +00:00
util/clientmetric: switch to TestHooks struct for test-only functions (#4632)
Followup to 7966aed1e008936ea0fad6c63bd72461cdc55648 to pick up review feedback that was accidentally left out. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
parent
7966aed1e0
commit
025867fd07
@ -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…
x
Reference in New Issue
Block a user