github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/store/etcdv3/meta/mocks/ETCDClientV3.go (about) 1 // Code generated by mockery v2.31.4. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 context "context" 7 8 clientv3 "go.etcd.io/etcd/client/v3" 9 10 mock "github.com/stretchr/testify/mock" 11 ) 12 13 // ETCDClientV3 is an autogenerated mock type for the ETCDClientV3 type 14 type ETCDClientV3 struct { 15 mock.Mock 16 } 17 18 // Close provides a mock function with given fields: 19 func (_m *ETCDClientV3) Close() error { 20 ret := _m.Called() 21 22 var r0 error 23 if rf, ok := ret.Get(0).(func() error); ok { 24 r0 = rf() 25 } else { 26 r0 = ret.Error(0) 27 } 28 29 return r0 30 } 31 32 // Compact provides a mock function with given fields: ctx, rev, opts 33 func (_m *ETCDClientV3) Compact(ctx context.Context, rev int64, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error) { 34 _va := make([]interface{}, len(opts)) 35 for _i := range opts { 36 _va[_i] = opts[_i] 37 } 38 var _ca []interface{} 39 _ca = append(_ca, ctx, rev) 40 _ca = append(_ca, _va...) 41 ret := _m.Called(_ca...) 42 43 var r0 *clientv3.CompactResponse 44 var r1 error 45 if rf, ok := ret.Get(0).(func(context.Context, int64, ...clientv3.CompactOption) (*clientv3.CompactResponse, error)); ok { 46 return rf(ctx, rev, opts...) 47 } 48 if rf, ok := ret.Get(0).(func(context.Context, int64, ...clientv3.CompactOption) *clientv3.CompactResponse); ok { 49 r0 = rf(ctx, rev, opts...) 50 } else { 51 if ret.Get(0) != nil { 52 r0 = ret.Get(0).(*clientv3.CompactResponse) 53 } 54 } 55 56 if rf, ok := ret.Get(1).(func(context.Context, int64, ...clientv3.CompactOption) error); ok { 57 r1 = rf(ctx, rev, opts...) 58 } else { 59 r1 = ret.Error(1) 60 } 61 62 return r0, r1 63 } 64 65 // Delete provides a mock function with given fields: ctx, key, opts 66 func (_m *ETCDClientV3) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error) { 67 _va := make([]interface{}, len(opts)) 68 for _i := range opts { 69 _va[_i] = opts[_i] 70 } 71 var _ca []interface{} 72 _ca = append(_ca, ctx, key) 73 _ca = append(_ca, _va...) 74 ret := _m.Called(_ca...) 75 76 var r0 *clientv3.DeleteResponse 77 var r1 error 78 if rf, ok := ret.Get(0).(func(context.Context, string, ...clientv3.OpOption) (*clientv3.DeleteResponse, error)); ok { 79 return rf(ctx, key, opts...) 80 } 81 if rf, ok := ret.Get(0).(func(context.Context, string, ...clientv3.OpOption) *clientv3.DeleteResponse); ok { 82 r0 = rf(ctx, key, opts...) 83 } else { 84 if ret.Get(0) != nil { 85 r0 = ret.Get(0).(*clientv3.DeleteResponse) 86 } 87 } 88 89 if rf, ok := ret.Get(1).(func(context.Context, string, ...clientv3.OpOption) error); ok { 90 r1 = rf(ctx, key, opts...) 91 } else { 92 r1 = ret.Error(1) 93 } 94 95 return r0, r1 96 } 97 98 // Do provides a mock function with given fields: ctx, op 99 func (_m *ETCDClientV3) Do(ctx context.Context, op clientv3.Op) (clientv3.OpResponse, error) { 100 ret := _m.Called(ctx, op) 101 102 var r0 clientv3.OpResponse 103 var r1 error 104 if rf, ok := ret.Get(0).(func(context.Context, clientv3.Op) (clientv3.OpResponse, error)); ok { 105 return rf(ctx, op) 106 } 107 if rf, ok := ret.Get(0).(func(context.Context, clientv3.Op) clientv3.OpResponse); ok { 108 r0 = rf(ctx, op) 109 } else { 110 r0 = ret.Get(0).(clientv3.OpResponse) 111 } 112 113 if rf, ok := ret.Get(1).(func(context.Context, clientv3.Op) error); ok { 114 r1 = rf(ctx, op) 115 } else { 116 r1 = ret.Error(1) 117 } 118 119 return r0, r1 120 } 121 122 // Get provides a mock function with given fields: ctx, key, opts 123 func (_m *ETCDClientV3) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) { 124 _va := make([]interface{}, len(opts)) 125 for _i := range opts { 126 _va[_i] = opts[_i] 127 } 128 var _ca []interface{} 129 _ca = append(_ca, ctx, key) 130 _ca = append(_ca, _va...) 131 ret := _m.Called(_ca...) 132 133 var r0 *clientv3.GetResponse 134 var r1 error 135 if rf, ok := ret.Get(0).(func(context.Context, string, ...clientv3.OpOption) (*clientv3.GetResponse, error)); ok { 136 return rf(ctx, key, opts...) 137 } 138 if rf, ok := ret.Get(0).(func(context.Context, string, ...clientv3.OpOption) *clientv3.GetResponse); ok { 139 r0 = rf(ctx, key, opts...) 140 } else { 141 if ret.Get(0) != nil { 142 r0 = ret.Get(0).(*clientv3.GetResponse) 143 } 144 } 145 146 if rf, ok := ret.Get(1).(func(context.Context, string, ...clientv3.OpOption) error); ok { 147 r1 = rf(ctx, key, opts...) 148 } else { 149 r1 = ret.Error(1) 150 } 151 152 return r0, r1 153 } 154 155 // Grant provides a mock function with given fields: ctx, ttl 156 func (_m *ETCDClientV3) Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error) { 157 ret := _m.Called(ctx, ttl) 158 159 var r0 *clientv3.LeaseGrantResponse 160 var r1 error 161 if rf, ok := ret.Get(0).(func(context.Context, int64) (*clientv3.LeaseGrantResponse, error)); ok { 162 return rf(ctx, ttl) 163 } 164 if rf, ok := ret.Get(0).(func(context.Context, int64) *clientv3.LeaseGrantResponse); ok { 165 r0 = rf(ctx, ttl) 166 } else { 167 if ret.Get(0) != nil { 168 r0 = ret.Get(0).(*clientv3.LeaseGrantResponse) 169 } 170 } 171 172 if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { 173 r1 = rf(ctx, ttl) 174 } else { 175 r1 = ret.Error(1) 176 } 177 178 return r0, r1 179 } 180 181 // KeepAlive provides a mock function with given fields: ctx, id 182 func (_m *ETCDClientV3) KeepAlive(ctx context.Context, id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error) { 183 ret := _m.Called(ctx, id) 184 185 var r0 <-chan *clientv3.LeaseKeepAliveResponse 186 var r1 error 187 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)); ok { 188 return rf(ctx, id) 189 } 190 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) <-chan *clientv3.LeaseKeepAliveResponse); ok { 191 r0 = rf(ctx, id) 192 } else { 193 if ret.Get(0) != nil { 194 r0 = ret.Get(0).(<-chan *clientv3.LeaseKeepAliveResponse) 195 } 196 } 197 198 if rf, ok := ret.Get(1).(func(context.Context, clientv3.LeaseID) error); ok { 199 r1 = rf(ctx, id) 200 } else { 201 r1 = ret.Error(1) 202 } 203 204 return r0, r1 205 } 206 207 // KeepAliveOnce provides a mock function with given fields: ctx, id 208 func (_m *ETCDClientV3) KeepAliveOnce(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error) { 209 ret := _m.Called(ctx, id) 210 211 var r0 *clientv3.LeaseKeepAliveResponse 212 var r1 error 213 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)); ok { 214 return rf(ctx, id) 215 } 216 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) *clientv3.LeaseKeepAliveResponse); ok { 217 r0 = rf(ctx, id) 218 } else { 219 if ret.Get(0) != nil { 220 r0 = ret.Get(0).(*clientv3.LeaseKeepAliveResponse) 221 } 222 } 223 224 if rf, ok := ret.Get(1).(func(context.Context, clientv3.LeaseID) error); ok { 225 r1 = rf(ctx, id) 226 } else { 227 r1 = ret.Error(1) 228 } 229 230 return r0, r1 231 } 232 233 // Leases provides a mock function with given fields: ctx 234 func (_m *ETCDClientV3) Leases(ctx context.Context) (*clientv3.LeaseLeasesResponse, error) { 235 ret := _m.Called(ctx) 236 237 var r0 *clientv3.LeaseLeasesResponse 238 var r1 error 239 if rf, ok := ret.Get(0).(func(context.Context) (*clientv3.LeaseLeasesResponse, error)); ok { 240 return rf(ctx) 241 } 242 if rf, ok := ret.Get(0).(func(context.Context) *clientv3.LeaseLeasesResponse); ok { 243 r0 = rf(ctx) 244 } else { 245 if ret.Get(0) != nil { 246 r0 = ret.Get(0).(*clientv3.LeaseLeasesResponse) 247 } 248 } 249 250 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 251 r1 = rf(ctx) 252 } else { 253 r1 = ret.Error(1) 254 } 255 256 return r0, r1 257 } 258 259 // Put provides a mock function with given fields: ctx, key, val, opts 260 func (_m *ETCDClientV3) Put(ctx context.Context, key string, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error) { 261 _va := make([]interface{}, len(opts)) 262 for _i := range opts { 263 _va[_i] = opts[_i] 264 } 265 var _ca []interface{} 266 _ca = append(_ca, ctx, key, val) 267 _ca = append(_ca, _va...) 268 ret := _m.Called(_ca...) 269 270 var r0 *clientv3.PutResponse 271 var r1 error 272 if rf, ok := ret.Get(0).(func(context.Context, string, string, ...clientv3.OpOption) (*clientv3.PutResponse, error)); ok { 273 return rf(ctx, key, val, opts...) 274 } 275 if rf, ok := ret.Get(0).(func(context.Context, string, string, ...clientv3.OpOption) *clientv3.PutResponse); ok { 276 r0 = rf(ctx, key, val, opts...) 277 } else { 278 if ret.Get(0) != nil { 279 r0 = ret.Get(0).(*clientv3.PutResponse) 280 } 281 } 282 283 if rf, ok := ret.Get(1).(func(context.Context, string, string, ...clientv3.OpOption) error); ok { 284 r1 = rf(ctx, key, val, opts...) 285 } else { 286 r1 = ret.Error(1) 287 } 288 289 return r0, r1 290 } 291 292 // RequestProgress provides a mock function with given fields: ctx 293 func (_m *ETCDClientV3) RequestProgress(ctx context.Context) error { 294 ret := _m.Called(ctx) 295 296 var r0 error 297 if rf, ok := ret.Get(0).(func(context.Context) error); ok { 298 r0 = rf(ctx) 299 } else { 300 r0 = ret.Error(0) 301 } 302 303 return r0 304 } 305 306 // Revoke provides a mock function with given fields: ctx, id 307 func (_m *ETCDClientV3) Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error) { 308 ret := _m.Called(ctx, id) 309 310 var r0 *clientv3.LeaseRevokeResponse 311 var r1 error 312 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)); ok { 313 return rf(ctx, id) 314 } 315 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID) *clientv3.LeaseRevokeResponse); ok { 316 r0 = rf(ctx, id) 317 } else { 318 if ret.Get(0) != nil { 319 r0 = ret.Get(0).(*clientv3.LeaseRevokeResponse) 320 } 321 } 322 323 if rf, ok := ret.Get(1).(func(context.Context, clientv3.LeaseID) error); ok { 324 r1 = rf(ctx, id) 325 } else { 326 r1 = ret.Error(1) 327 } 328 329 return r0, r1 330 } 331 332 // TimeToLive provides a mock function with given fields: ctx, id, opts 333 func (_m *ETCDClientV3) TimeToLive(ctx context.Context, id clientv3.LeaseID, opts ...clientv3.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error) { 334 _va := make([]interface{}, len(opts)) 335 for _i := range opts { 336 _va[_i] = opts[_i] 337 } 338 var _ca []interface{} 339 _ca = append(_ca, ctx, id) 340 _ca = append(_ca, _va...) 341 ret := _m.Called(_ca...) 342 343 var r0 *clientv3.LeaseTimeToLiveResponse 344 var r1 error 345 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID, ...clientv3.LeaseOption) (*clientv3.LeaseTimeToLiveResponse, error)); ok { 346 return rf(ctx, id, opts...) 347 } 348 if rf, ok := ret.Get(0).(func(context.Context, clientv3.LeaseID, ...clientv3.LeaseOption) *clientv3.LeaseTimeToLiveResponse); ok { 349 r0 = rf(ctx, id, opts...) 350 } else { 351 if ret.Get(0) != nil { 352 r0 = ret.Get(0).(*clientv3.LeaseTimeToLiveResponse) 353 } 354 } 355 356 if rf, ok := ret.Get(1).(func(context.Context, clientv3.LeaseID, ...clientv3.LeaseOption) error); ok { 357 r1 = rf(ctx, id, opts...) 358 } else { 359 r1 = ret.Error(1) 360 } 361 362 return r0, r1 363 } 364 365 // Txn provides a mock function with given fields: ctx 366 func (_m *ETCDClientV3) Txn(ctx context.Context) clientv3.Txn { 367 ret := _m.Called(ctx) 368 369 var r0 clientv3.Txn 370 if rf, ok := ret.Get(0).(func(context.Context) clientv3.Txn); ok { 371 r0 = rf(ctx) 372 } else { 373 if ret.Get(0) != nil { 374 r0 = ret.Get(0).(clientv3.Txn) 375 } 376 } 377 378 return r0 379 } 380 381 // Watch provides a mock function with given fields: ctx, key, opts 382 func (_m *ETCDClientV3) Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan { 383 _va := make([]interface{}, len(opts)) 384 for _i := range opts { 385 _va[_i] = opts[_i] 386 } 387 var _ca []interface{} 388 _ca = append(_ca, ctx, key) 389 _ca = append(_ca, _va...) 390 ret := _m.Called(_ca...) 391 392 var r0 clientv3.WatchChan 393 if rf, ok := ret.Get(0).(func(context.Context, string, ...clientv3.OpOption) clientv3.WatchChan); ok { 394 r0 = rf(ctx, key, opts...) 395 } else { 396 if ret.Get(0) != nil { 397 r0 = ret.Get(0).(clientv3.WatchChan) 398 } 399 } 400 401 return r0 402 } 403 404 // NewETCDClientV3 creates a new instance of ETCDClientV3. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 405 // The first argument is typically a *testing.T value. 406 func NewETCDClientV3(t interface { 407 mock.TestingT 408 Cleanup(func()) 409 }) *ETCDClientV3 { 410 mock := &ETCDClientV3{} 411 mock.Mock.Test(t) 412 413 t.Cleanup(func() { mock.AssertExpectations(t) }) 414 415 return mock 416 }