/
mock_metric_repository_provider.go
153 lines (123 loc) · 5.27 KB
/
mock_metric_repository_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Code generated by mockery v2.34.0. DO NOT EDIT.
package repositories
import (
context "context"
gorm "gorm.io/gorm"
mock "github.com/stretchr/testify/mock"
models "github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models"
request "github.com/G-Research/fasttrackml/pkg/api/mlflow/api/request"
sql "database/sql"
)
// MockMetricRepositoryProvider is an autogenerated mock type for the MetricRepositoryProvider type
type MockMetricRepositoryProvider struct {
mock.Mock
}
// CreateBatch provides a mock function with given fields: ctx, run, batchSize, params
func (_m *MockMetricRepositoryProvider) CreateBatch(ctx context.Context, run *models.Run, batchSize int, params []models.Metric) error {
ret := _m.Called(ctx, run, batchSize, params)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *models.Run, int, []models.Metric) error); ok {
r0 = rf(ctx, run, batchSize, params)
} else {
r0 = ret.Error(0)
}
return r0
}
// GetDB provides a mock function with given fields:
func (_m *MockMetricRepositoryProvider) GetDB() *gorm.DB {
ret := _m.Called()
var r0 *gorm.DB
if rf, ok := ret.Get(0).(func() *gorm.DB); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*gorm.DB)
}
}
return r0
}
// GetMetricHistories provides a mock function with given fields: ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap
func (_m *MockMetricRepositoryProvider) GetMetricHistories(ctx context.Context, namespaceID uint, experimentIDs []string, runIDs []string, metricKeys []string, viewType request.ViewType, limit int32, jsonPathValueMap map[string]string) (*sql.Rows, func(*sql.Rows, interface{}) error, error) {
ret := _m.Called(ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap)
var r0 *sql.Rows
var r1 func(*sql.Rows, interface{}) error
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, uint, []string, []string, []string, request.ViewType, int32, map[string]string) (*sql.Rows, func(*sql.Rows, interface{}) error, error)); ok {
return rf(ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap)
}
if rf, ok := ret.Get(0).(func(context.Context, uint, []string, []string, []string, request.ViewType, int32, map[string]string) *sql.Rows); ok {
r0 = rf(ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*sql.Rows)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint, []string, []string, []string, request.ViewType, int32, map[string]string) func(*sql.Rows, interface{}) error); ok {
r1 = rf(ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(func(*sql.Rows, interface{}) error)
}
}
if rf, ok := ret.Get(2).(func(context.Context, uint, []string, []string, []string, request.ViewType, int32, map[string]string) error); ok {
r2 = rf(ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetMetricHistoryBulk provides a mock function with given fields: ctx, namespaceID, runIDs, key, limit
func (_m *MockMetricRepositoryProvider) GetMetricHistoryBulk(ctx context.Context, namespaceID uint, runIDs []string, key string, limit int) ([]models.Metric, error) {
ret := _m.Called(ctx, namespaceID, runIDs, key, limit)
var r0 []models.Metric
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint, []string, string, int) ([]models.Metric, error)); ok {
return rf(ctx, namespaceID, runIDs, key, limit)
}
if rf, ok := ret.Get(0).(func(context.Context, uint, []string, string, int) []models.Metric); ok {
r0 = rf(ctx, namespaceID, runIDs, key, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]models.Metric)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint, []string, string, int) error); ok {
r1 = rf(ctx, namespaceID, runIDs, key, limit)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetMetricHistoryByRunIDAndKey provides a mock function with given fields: ctx, runID, key
func (_m *MockMetricRepositoryProvider) GetMetricHistoryByRunIDAndKey(ctx context.Context, runID string, key string) ([]models.Metric, error) {
ret := _m.Called(ctx, runID, key)
var r0 []models.Metric
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) ([]models.Metric, error)); ok {
return rf(ctx, runID, key)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) []models.Metric); ok {
r0 = rf(ctx, runID, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]models.Metric)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, runID, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewMockMetricRepositoryProvider creates a new instance of MockMetricRepositoryProvider. 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 NewMockMetricRepositoryProvider(t interface {
mock.TestingT
Cleanup(func())
}) *MockMetricRepositoryProvider {
mock := &MockMetricRepositoryProvider{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}