/
instance_mock.go
234 lines (190 loc) · 9.37 KB
/
instance_mock.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// Code generated by mockery v2.12.2. DO NOT EDIT.
package instance
import (
context "context"
pkginstance "github.com/kobsio/kobs/plugins/plugin-prometheus/pkg/instance"
mock "github.com/stretchr/testify/mock"
testing "testing"
)
// MockInstance is an autogenerated mock type for the Instance type
type MockInstance struct {
mock.Mock
}
// GetMetrics provides a mock function with given fields: ctx, namespaces, application, label, groupBy, reporter, timeStart, timeEnd
func (_m *MockInstance) GetMetrics(ctx context.Context, namespaces []string, application string, label string, groupBy string, reporter string, timeStart int64, timeEnd int64) (map[string]map[string]string, error) {
ret := _m.Called(ctx, namespaces, application, label, groupBy, reporter, timeStart, timeEnd)
var r0 map[string]map[string]string
if rf, ok := ret.Get(0).(func(context.Context, []string, string, string, string, string, int64, int64) map[string]map[string]string); ok {
r0 = rf(ctx, namespaces, application, label, groupBy, reporter, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]map[string]string)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, []string, string, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, namespaces, application, label, groupBy, reporter, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetMetricsDetails provides a mock function with given fields: ctx, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod, timeStart, timeEnd
func (_m *MockInstance) GetMetricsDetails(ctx context.Context, metric string, reporter string, destinationWorkload string, destinationWorkloadNamespace string, destinationVersion string, destinationService string, sourceWorkload string, sourceWorkloadNamespace string, pod string, timeStart int64, timeEnd int64) (*pkginstance.Metrics, error) {
ret := _m.Called(ctx, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod, timeStart, timeEnd)
var r0 *pkginstance.Metrics
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, string, string, string, string, int64, int64) *pkginstance.Metrics); ok {
r0 = rf(ctx, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*pkginstance.Metrics)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string, string, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, metric, reporter, destinationWorkload, destinationWorkloadNamespace, destinationVersion, destinationService, sourceWorkload, sourceWorkloadNamespace, pod, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetMetricsPod provides a mock function with given fields: ctx, metric, namespace, pod, timeStart, timeEnd
func (_m *MockInstance) GetMetricsPod(ctx context.Context, metric string, namespace string, pod string, timeStart int64, timeEnd int64) (*pkginstance.Metrics, error) {
ret := _m.Called(ctx, metric, namespace, pod, timeStart, timeEnd)
var r0 *pkginstance.Metrics
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, int64, int64) *pkginstance.Metrics); ok {
r0 = rf(ctx, metric, namespace, pod, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*pkginstance.Metrics)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, metric, namespace, pod, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetName provides a mock function with given fields:
func (_m *MockInstance) GetName() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetNamespaces provides a mock function with given fields: ctx, timeStart, timeEnd
func (_m *MockInstance) GetNamespaces(ctx context.Context, timeStart int64, timeEnd int64) ([]string, error) {
ret := _m.Called(ctx, timeStart, timeEnd)
var r0 []string
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) []string); ok {
r0 = rf(ctx, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, int64, int64) error); ok {
r1 = rf(ctx, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTopology provides a mock function with given fields: ctx, namespace, application, timeStart, timeEnd
func (_m *MockInstance) GetTopology(ctx context.Context, namespace string, application string, timeStart int64, timeEnd int64) ([]Edge, []Node, error) {
ret := _m.Called(ctx, namespace, application, timeStart, timeEnd)
var r0 []Edge
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, int64) []Edge); ok {
r0 = rf(ctx, namespace, application, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]Edge)
}
}
var r1 []Node
if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, int64) []Node); ok {
r1 = rf(ctx, namespace, application, timeStart, timeEnd)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]Node)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string, string, int64, int64) error); ok {
r2 = rf(ctx, namespace, application, timeStart, timeEnd)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Tap provides a mock function with given fields: ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, timeStart, timeEnd
func (_m *MockInstance) Tap(ctx context.Context, namespace string, application string, filterUpstreamCluster string, filterMethod string, filterPath string, timeStart int64, timeEnd int64) ([]map[string]interface{}, error) {
ret := _m.Called(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, timeStart, timeEnd)
var r0 []map[string]interface{}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, int64, int64) []map[string]interface{}); ok {
r0 = rf(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]map[string]interface{})
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Top provides a mock function with given fields: ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection, timeStart, timeEnd
func (_m *MockInstance) Top(ctx context.Context, namespace string, application string, filterUpstreamCluster string, filterMethod string, filterPath string, sortBy string, sortDirection string, timeStart int64, timeEnd int64) ([][]interface{}, error) {
ret := _m.Called(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection, timeStart, timeEnd)
var r0 [][]interface{}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, string, string, int64, int64) [][]interface{}); ok {
r0 = rf(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([][]interface{})
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, namespace, application, filterUpstreamCluster, filterMethod, filterPath, sortBy, sortDirection, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TopDetails provides a mock function with given fields: ctx, namespace, application, upstreamCluster, method, path, timeStart, timeEnd
func (_m *MockInstance) TopDetails(ctx context.Context, namespace string, application string, upstreamCluster string, method string, path string, timeStart int64, timeEnd int64) ([][]interface{}, error) {
ret := _m.Called(ctx, namespace, application, upstreamCluster, method, path, timeStart, timeEnd)
var r0 [][]interface{}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, string, int64, int64) [][]interface{}); ok {
r0 = rf(ctx, namespace, application, upstreamCluster, method, path, timeStart, timeEnd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([][]interface{})
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string, string, int64, int64) error); ok {
r1 = rf(ctx, namespace, application, upstreamCluster, method, path, timeStart, timeEnd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewMockInstance creates a new instance of MockInstance. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
func NewMockInstance(t testing.TB) *MockInstance {
mock := &MockInstance{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}