Skip to content
File

Blob: spec/mocks/rtt.go

go43 lines
1//go:build !no_mocks
2 
3package mocks
4 
5import (
6 "time"
7 
8 "go.miragespace.co/specter/spec/rtt"
9 
10 "github.com/stretchr/testify/mock"
11)
12 
13type Measurement struct {
14 mock.Mock
15}
16 
17func (m *Measurement) Snapshot(key string, past time.Duration) *rtt.Statistics {
18 args := m.Called(key, past)
19 s := args.Get(0)
20 if s == nil {
21 return nil
22 }
23 return s.(*rtt.Statistics)
24}
25 
26func (m *Measurement) RecordLatency(key string, latency float64) {
27 m.Called(key, latency)
28}
29 
30func (m *Measurement) RecordSent(key string) {
31 m.Called(key)
32}
33 
34func (m *Measurement) RecordLost(key string) {
35 m.Called(key)
36}
37 
38func (m *Measurement) Drop(key string) {
39 m.Called(key)
40}
41 
42var _ rtt.Recorder = (*Measurement)(nil)