-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_logSink_test.go
298 lines (247 loc) · 8.36 KB
/
mock_logSink_test.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
// Code generated by mockery v2.20.0. DO NOT EDIT.
package main
import (
logr "github.com/go-logr/logr"
mock "github.com/stretchr/testify/mock"
)
// mockLogSink is an autogenerated mock type for the logSink type
type mockLogSink struct {
mock.Mock
}
type mockLogSink_Expecter struct {
mock *mock.Mock
}
func (_m *mockLogSink) EXPECT() *mockLogSink_Expecter {
return &mockLogSink_Expecter{mock: &_m.Mock}
}
// Enabled provides a mock function with given fields: level
func (_m *mockLogSink) Enabled(level int) bool {
ret := _m.Called(level)
var r0 bool
if rf, ok := ret.Get(0).(func(int) bool); ok {
r0 = rf(level)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// mockLogSink_Enabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Enabled'
type mockLogSink_Enabled_Call struct {
*mock.Call
}
// Enabled is a helper method to define mock.On call
// - level int
func (_e *mockLogSink_Expecter) Enabled(level interface{}) *mockLogSink_Enabled_Call {
return &mockLogSink_Enabled_Call{Call: _e.mock.On("Enabled", level)}
}
func (_c *mockLogSink_Enabled_Call) Run(run func(level int)) *mockLogSink_Enabled_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int))
})
return _c
}
func (_c *mockLogSink_Enabled_Call) Return(_a0 bool) *mockLogSink_Enabled_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *mockLogSink_Enabled_Call) RunAndReturn(run func(int) bool) *mockLogSink_Enabled_Call {
_c.Call.Return(run)
return _c
}
// Error provides a mock function with given fields: err, msg, keysAndValues
func (_m *mockLogSink) Error(err error, msg string, keysAndValues ...interface{}) {
var _ca []interface{}
_ca = append(_ca, err, msg)
_ca = append(_ca, keysAndValues...)
_m.Called(_ca...)
}
// mockLogSink_Error_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Error'
type mockLogSink_Error_Call struct {
*mock.Call
}
// Error is a helper method to define mock.On call
// - err error
// - msg string
// - keysAndValues ...interface{}
func (_e *mockLogSink_Expecter) Error(err interface{}, msg interface{}, keysAndValues ...interface{}) *mockLogSink_Error_Call {
return &mockLogSink_Error_Call{Call: _e.mock.On("Error",
append([]interface{}{err, msg}, keysAndValues...)...)}
}
func (_c *mockLogSink_Error_Call) Run(run func(err error, msg string, keysAndValues ...interface{})) *mockLogSink_Error_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]interface{}, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(interface{})
}
}
run(args[0].(error), args[1].(string), variadicArgs...)
})
return _c
}
func (_c *mockLogSink_Error_Call) Return() *mockLogSink_Error_Call {
_c.Call.Return()
return _c
}
func (_c *mockLogSink_Error_Call) RunAndReturn(run func(error, string, ...interface{})) *mockLogSink_Error_Call {
_c.Call.Return(run)
return _c
}
// Info provides a mock function with given fields: level, msg, keysAndValues
func (_m *mockLogSink) Info(level int, msg string, keysAndValues ...interface{}) {
var _ca []interface{}
_ca = append(_ca, level, msg)
_ca = append(_ca, keysAndValues...)
_m.Called(_ca...)
}
// mockLogSink_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'
type mockLogSink_Info_Call struct {
*mock.Call
}
// Info is a helper method to define mock.On call
// - level int
// - msg string
// - keysAndValues ...interface{}
func (_e *mockLogSink_Expecter) Info(level interface{}, msg interface{}, keysAndValues ...interface{}) *mockLogSink_Info_Call {
return &mockLogSink_Info_Call{Call: _e.mock.On("Info",
append([]interface{}{level, msg}, keysAndValues...)...)}
}
func (_c *mockLogSink_Info_Call) Run(run func(level int, msg string, keysAndValues ...interface{})) *mockLogSink_Info_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]interface{}, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(interface{})
}
}
run(args[0].(int), args[1].(string), variadicArgs...)
})
return _c
}
func (_c *mockLogSink_Info_Call) Return() *mockLogSink_Info_Call {
_c.Call.Return()
return _c
}
func (_c *mockLogSink_Info_Call) RunAndReturn(run func(int, string, ...interface{})) *mockLogSink_Info_Call {
_c.Call.Return(run)
return _c
}
// Init provides a mock function with given fields: info
func (_m *mockLogSink) Init(info logr.RuntimeInfo) {
_m.Called(info)
}
// mockLogSink_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
type mockLogSink_Init_Call struct {
*mock.Call
}
// Init is a helper method to define mock.On call
// - info logr.RuntimeInfo
func (_e *mockLogSink_Expecter) Init(info interface{}) *mockLogSink_Init_Call {
return &mockLogSink_Init_Call{Call: _e.mock.On("Init", info)}
}
func (_c *mockLogSink_Init_Call) Run(run func(info logr.RuntimeInfo)) *mockLogSink_Init_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(logr.RuntimeInfo))
})
return _c
}
func (_c *mockLogSink_Init_Call) Return() *mockLogSink_Init_Call {
_c.Call.Return()
return _c
}
func (_c *mockLogSink_Init_Call) RunAndReturn(run func(logr.RuntimeInfo)) *mockLogSink_Init_Call {
_c.Call.Return(run)
return _c
}
// WithName provides a mock function with given fields: name
func (_m *mockLogSink) WithName(name string) logr.LogSink {
ret := _m.Called(name)
var r0 logr.LogSink
if rf, ok := ret.Get(0).(func(string) logr.LogSink); ok {
r0 = rf(name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(logr.LogSink)
}
}
return r0
}
// mockLogSink_WithName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithName'
type mockLogSink_WithName_Call struct {
*mock.Call
}
// WithName is a helper method to define mock.On call
// - name string
func (_e *mockLogSink_Expecter) WithName(name interface{}) *mockLogSink_WithName_Call {
return &mockLogSink_WithName_Call{Call: _e.mock.On("WithName", name)}
}
func (_c *mockLogSink_WithName_Call) Run(run func(name string)) *mockLogSink_WithName_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *mockLogSink_WithName_Call) Return(_a0 logr.LogSink) *mockLogSink_WithName_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *mockLogSink_WithName_Call) RunAndReturn(run func(string) logr.LogSink) *mockLogSink_WithName_Call {
_c.Call.Return(run)
return _c
}
// WithValues provides a mock function with given fields: keysAndValues
func (_m *mockLogSink) WithValues(keysAndValues ...interface{}) logr.LogSink {
var _ca []interface{}
_ca = append(_ca, keysAndValues...)
ret := _m.Called(_ca...)
var r0 logr.LogSink
if rf, ok := ret.Get(0).(func(...interface{}) logr.LogSink); ok {
r0 = rf(keysAndValues...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(logr.LogSink)
}
}
return r0
}
// mockLogSink_WithValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithValues'
type mockLogSink_WithValues_Call struct {
*mock.Call
}
// WithValues is a helper method to define mock.On call
// - keysAndValues ...interface{}
func (_e *mockLogSink_Expecter) WithValues(keysAndValues ...interface{}) *mockLogSink_WithValues_Call {
return &mockLogSink_WithValues_Call{Call: _e.mock.On("WithValues",
append([]interface{}{}, keysAndValues...)...)}
}
func (_c *mockLogSink_WithValues_Call) Run(run func(keysAndValues ...interface{})) *mockLogSink_WithValues_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]interface{}, len(args)-0)
for i, a := range args[0:] {
if a != nil {
variadicArgs[i] = a.(interface{})
}
}
run(variadicArgs...)
})
return _c
}
func (_c *mockLogSink_WithValues_Call) Return(_a0 logr.LogSink) *mockLogSink_WithValues_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *mockLogSink_WithValues_Call) RunAndReturn(run func(...interface{}) logr.LogSink) *mockLogSink_WithValues_Call {
_c.Call.Return(run)
return _c
}
type mockConstructorTestingTnewMockLogSink interface {
mock.TestingT
Cleanup(func())
}
// newMockLogSink creates a new instance of mockLogSink. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func newMockLogSink(t mockConstructorTestingTnewMockLogSink) *mockLogSink {
mock := &mockLogSink{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}