forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthchecker.go
107 lines (97 loc) · 2.88 KB
/
healthchecker.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
// Code generated by counterfeiter. DO NOT EDIT.
package fakes
import (
"context"
"sync"
)
type HealthChecker struct {
HealthCheckStub func(context.Context) error
healthCheckMutex sync.RWMutex
healthCheckArgsForCall []struct {
arg1 context.Context
}
healthCheckReturns struct {
result1 error
}
healthCheckReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *HealthChecker) HealthCheck(arg1 context.Context) error {
fake.healthCheckMutex.Lock()
ret, specificReturn := fake.healthCheckReturnsOnCall[len(fake.healthCheckArgsForCall)]
fake.healthCheckArgsForCall = append(fake.healthCheckArgsForCall, struct {
arg1 context.Context
}{arg1})
fake.recordInvocation("HealthCheck", []interface{}{arg1})
fake.healthCheckMutex.Unlock()
if fake.HealthCheckStub != nil {
return fake.HealthCheckStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.healthCheckReturns
return fakeReturns.result1
}
func (fake *HealthChecker) HealthCheckCallCount() int {
fake.healthCheckMutex.RLock()
defer fake.healthCheckMutex.RUnlock()
return len(fake.healthCheckArgsForCall)
}
func (fake *HealthChecker) HealthCheckCalls(stub func(context.Context) error) {
fake.healthCheckMutex.Lock()
defer fake.healthCheckMutex.Unlock()
fake.HealthCheckStub = stub
}
func (fake *HealthChecker) HealthCheckArgsForCall(i int) context.Context {
fake.healthCheckMutex.RLock()
defer fake.healthCheckMutex.RUnlock()
argsForCall := fake.healthCheckArgsForCall[i]
return argsForCall.arg1
}
func (fake *HealthChecker) HealthCheckReturns(result1 error) {
fake.healthCheckMutex.Lock()
defer fake.healthCheckMutex.Unlock()
fake.HealthCheckStub = nil
fake.healthCheckReturns = struct {
result1 error
}{result1}
}
func (fake *HealthChecker) HealthCheckReturnsOnCall(i int, result1 error) {
fake.healthCheckMutex.Lock()
defer fake.healthCheckMutex.Unlock()
fake.HealthCheckStub = nil
if fake.healthCheckReturnsOnCall == nil {
fake.healthCheckReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.healthCheckReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *HealthChecker) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.healthCheckMutex.RLock()
defer fake.healthCheckMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *HealthChecker) 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)
}