Private
Public Access
1
0

Add tracing

This commit is contained in:
2023-10-14 04:01:43 -07:00
parent 42dccd28a7
commit f9b521664d
13 changed files with 407 additions and 241 deletions

105
mocks/Querier.go Normal file
View File

@@ -0,0 +1,105 @@
// Code generated by mockery v2.35.4. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
ntpdb "go.ntppool.org/data-api/ntpdb"
)
// Querier is an autogenerated mock type for the Querier type
type Querier struct {
mock.Mock
}
// GetServerNetspeed provides a mock function with given fields: ctx, ip
func (_m *Querier) GetServerNetspeed(ctx context.Context, ip string) (uint32, error) {
ret := _m.Called(ctx, ip)
var r0 uint32
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (uint32, error)); ok {
return rf(ctx, ip)
}
if rf, ok := ret.Get(0).(func(context.Context, string) uint32); ok {
r0 = rf(ctx, ip)
} else {
r0 = ret.Get(0).(uint32)
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, ip)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetZoneStatsData provides a mock function with given fields: ctx
func (_m *Querier) GetZoneStatsData(ctx context.Context) ([]ntpdb.GetZoneStatsDataRow, error) {
ret := _m.Called(ctx)
var r0 []ntpdb.GetZoneStatsDataRow
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]ntpdb.GetZoneStatsDataRow, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) []ntpdb.GetZoneStatsDataRow); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]ntpdb.GetZoneStatsDataRow)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetZoneStatsV2 provides a mock function with given fields: ctx, ip
func (_m *Querier) GetZoneStatsV2(ctx context.Context, ip string) ([]ntpdb.GetZoneStatsV2Row, error) {
ret := _m.Called(ctx, ip)
var r0 []ntpdb.GetZoneStatsV2Row
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) ([]ntpdb.GetZoneStatsV2Row, error)); ok {
return rf(ctx, ip)
}
if rf, ok := ret.Get(0).(func(context.Context, string) []ntpdb.GetZoneStatsV2Row); ok {
r0 = rf(ctx, ip)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]ntpdb.GetZoneStatsV2Row)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, ip)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewQuerier creates a new instance of Querier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewQuerier(t interface {
mock.TestingT
Cleanup(func())
}) *Querier {
mock := &Querier{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}