-
Notifications
You must be signed in to change notification settings - Fork 6
/
fake_alerter.go
159 lines (144 loc) · 4.13 KB
/
fake_alerter.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
// Code generated by counterfeiter. DO NOT EDIT.
package alertfakes
import (
"replication-canary/alert"
"sync"
"time"
)
type FakeAlerter struct {
NotUnhealthyStub func(time.Time) error
notUnhealthyMutex sync.RWMutex
notUnhealthyArgsForCall []struct {
arg1 time.Time
}
notUnhealthyReturns struct {
result1 error
}
notUnhealthyReturnsOnCall map[int]struct {
result1 error
}
UnhealthyStub func(time.Time) error
unhealthyMutex sync.RWMutex
unhealthyArgsForCall []struct {
arg1 time.Time
}
unhealthyReturns struct {
result1 error
}
unhealthyReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeAlerter) NotUnhealthy(arg1 time.Time) error {
fake.notUnhealthyMutex.Lock()
ret, specificReturn := fake.notUnhealthyReturnsOnCall[len(fake.notUnhealthyArgsForCall)]
fake.notUnhealthyArgsForCall = append(fake.notUnhealthyArgsForCall, struct {
arg1 time.Time
}{arg1})
fake.recordInvocation("NotUnhealthy", []interface{}{arg1})
fake.notUnhealthyMutex.Unlock()
if fake.NotUnhealthyStub != nil {
return fake.NotUnhealthyStub(arg1)
}
if specificReturn {
return ret.result1
}
return fake.notUnhealthyReturns.result1
}
func (fake *FakeAlerter) NotUnhealthyCallCount() int {
fake.notUnhealthyMutex.RLock()
defer fake.notUnhealthyMutex.RUnlock()
return len(fake.notUnhealthyArgsForCall)
}
func (fake *FakeAlerter) NotUnhealthyArgsForCall(i int) time.Time {
fake.notUnhealthyMutex.RLock()
defer fake.notUnhealthyMutex.RUnlock()
return fake.notUnhealthyArgsForCall[i].arg1
}
func (fake *FakeAlerter) NotUnhealthyReturns(result1 error) {
fake.NotUnhealthyStub = nil
fake.notUnhealthyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeAlerter) NotUnhealthyReturnsOnCall(i int, result1 error) {
fake.NotUnhealthyStub = nil
if fake.notUnhealthyReturnsOnCall == nil {
fake.notUnhealthyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.notUnhealthyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeAlerter) Unhealthy(arg1 time.Time) error {
fake.unhealthyMutex.Lock()
ret, specificReturn := fake.unhealthyReturnsOnCall[len(fake.unhealthyArgsForCall)]
fake.unhealthyArgsForCall = append(fake.unhealthyArgsForCall, struct {
arg1 time.Time
}{arg1})
fake.recordInvocation("Unhealthy", []interface{}{arg1})
fake.unhealthyMutex.Unlock()
if fake.UnhealthyStub != nil {
return fake.UnhealthyStub(arg1)
}
if specificReturn {
return ret.result1
}
return fake.unhealthyReturns.result1
}
func (fake *FakeAlerter) UnhealthyCallCount() int {
fake.unhealthyMutex.RLock()
defer fake.unhealthyMutex.RUnlock()
return len(fake.unhealthyArgsForCall)
}
func (fake *FakeAlerter) UnhealthyArgsForCall(i int) time.Time {
fake.unhealthyMutex.RLock()
defer fake.unhealthyMutex.RUnlock()
return fake.unhealthyArgsForCall[i].arg1
}
func (fake *FakeAlerter) UnhealthyReturns(result1 error) {
fake.UnhealthyStub = nil
fake.unhealthyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeAlerter) UnhealthyReturnsOnCall(i int, result1 error) {
fake.UnhealthyStub = nil
if fake.unhealthyReturnsOnCall == nil {
fake.unhealthyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.unhealthyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeAlerter) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.notUnhealthyMutex.RLock()
defer fake.notUnhealthyMutex.RUnlock()
fake.unhealthyMutex.RLock()
defer fake.unhealthyMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeAlerter) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ alert.Alerter = new(FakeAlerter)