/
DistributedLock.go
122 lines (96 loc) · 3.25 KB
/
DistributedLock.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
// Code generated by mockery v2.22.1. DO NOT EDIT.
package mocks
import (
context "context"
time "time"
mock "github.com/stretchr/testify/mock"
)
// DistributedLock is an autogenerated mock type for the DistributedLock type
type DistributedLock struct {
mock.Mock
}
type DistributedLock_Expecter struct {
mock *mock.Mock
}
func (_m *DistributedLock) EXPECT() *DistributedLock_Expecter {
return &DistributedLock_Expecter{mock: &_m.Mock}
}
// Release provides a mock function with given fields:
func (_m *DistributedLock) Release() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// DistributedLock_Release_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Release'
type DistributedLock_Release_Call struct {
*mock.Call
}
// Release is a helper method to define mock.On call
func (_e *DistributedLock_Expecter) Release() *DistributedLock_Release_Call {
return &DistributedLock_Release_Call{Call: _e.mock.On("Release")}
}
func (_c *DistributedLock_Release_Call) Run(run func()) *DistributedLock_Release_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *DistributedLock_Release_Call) Return(_a0 error) *DistributedLock_Release_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *DistributedLock_Release_Call) RunAndReturn(run func() error) *DistributedLock_Release_Call {
_c.Call.Return(run)
return _c
}
// Renew provides a mock function with given fields: ctx, lockTime
func (_m *DistributedLock) Renew(ctx context.Context, lockTime time.Duration) error {
ret := _m.Called(ctx, lockTime)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, time.Duration) error); ok {
r0 = rf(ctx, lockTime)
} else {
r0 = ret.Error(0)
}
return r0
}
// DistributedLock_Renew_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Renew'
type DistributedLock_Renew_Call struct {
*mock.Call
}
// Renew is a helper method to define mock.On call
// - ctx context.Context
// - lockTime time.Duration
func (_e *DistributedLock_Expecter) Renew(ctx interface{}, lockTime interface{}) *DistributedLock_Renew_Call {
return &DistributedLock_Renew_Call{Call: _e.mock.On("Renew", ctx, lockTime)}
}
func (_c *DistributedLock_Renew_Call) Run(run func(ctx context.Context, lockTime time.Duration)) *DistributedLock_Renew_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(time.Duration))
})
return _c
}
func (_c *DistributedLock_Renew_Call) Return(_a0 error) *DistributedLock_Renew_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *DistributedLock_Renew_Call) RunAndReturn(run func(context.Context, time.Duration) error) *DistributedLock_Renew_Call {
_c.Call.Return(run)
return _c
}
type mockConstructorTestingTNewDistributedLock interface {
mock.TestingT
Cleanup(func())
}
// NewDistributedLock creates a new instance of DistributedLock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewDistributedLock(t mockConstructorTestingTNewDistributedLock) *DistributedLock {
mock := &DistributedLock{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}