-
Notifications
You must be signed in to change notification settings - Fork 225
/
fake_varzreporter.go
180 lines (160 loc) · 6.18 KB
/
fake_varzreporter.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
// Code generated by counterfeiter. DO NOT EDIT.
package fakes
import (
"sync"
"time"
"code.cloudfoundry.org/gorouter/metrics"
"code.cloudfoundry.org/gorouter/route"
)
type FakeVarzReporter struct {
CaptureBadGatewayStub func()
captureBadGatewayMutex sync.RWMutex
captureBadGatewayArgsForCall []struct {
}
CaptureBadRequestStub func()
captureBadRequestMutex sync.RWMutex
captureBadRequestArgsForCall []struct {
}
CaptureRoutingRequestStub func(*route.Endpoint)
captureRoutingRequestMutex sync.RWMutex
captureRoutingRequestArgsForCall []struct {
arg1 *route.Endpoint
}
CaptureRoutingResponseLatencyStub func(*route.Endpoint, int, time.Time, time.Duration)
captureRoutingResponseLatencyMutex sync.RWMutex
captureRoutingResponseLatencyArgsForCall []struct {
arg1 *route.Endpoint
arg2 int
arg3 time.Time
arg4 time.Duration
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeVarzReporter) CaptureBadGateway() {
fake.captureBadGatewayMutex.Lock()
fake.captureBadGatewayArgsForCall = append(fake.captureBadGatewayArgsForCall, struct {
}{})
fake.recordInvocation("CaptureBadGateway", []interface{}{})
fake.captureBadGatewayMutex.Unlock()
if fake.CaptureBadGatewayStub != nil {
fake.CaptureBadGatewayStub()
}
}
func (fake *FakeVarzReporter) CaptureBadGatewayCallCount() int {
fake.captureBadGatewayMutex.RLock()
defer fake.captureBadGatewayMutex.RUnlock()
return len(fake.captureBadGatewayArgsForCall)
}
func (fake *FakeVarzReporter) CaptureBadGatewayCalls(stub func()) {
fake.captureBadGatewayMutex.Lock()
defer fake.captureBadGatewayMutex.Unlock()
fake.CaptureBadGatewayStub = stub
}
func (fake *FakeVarzReporter) CaptureBadRequest() {
fake.captureBadRequestMutex.Lock()
fake.captureBadRequestArgsForCall = append(fake.captureBadRequestArgsForCall, struct {
}{})
fake.recordInvocation("CaptureBadRequest", []interface{}{})
fake.captureBadRequestMutex.Unlock()
if fake.CaptureBadRequestStub != nil {
fake.CaptureBadRequestStub()
}
}
func (fake *FakeVarzReporter) CaptureBadRequestCallCount() int {
fake.captureBadRequestMutex.RLock()
defer fake.captureBadRequestMutex.RUnlock()
return len(fake.captureBadRequestArgsForCall)
}
func (fake *FakeVarzReporter) CaptureBadRequestCalls(stub func()) {
fake.captureBadRequestMutex.Lock()
defer fake.captureBadRequestMutex.Unlock()
fake.CaptureBadRequestStub = stub
}
func (fake *FakeVarzReporter) CaptureRoutingRequest(arg1 *route.Endpoint) {
fake.captureRoutingRequestMutex.Lock()
fake.captureRoutingRequestArgsForCall = append(fake.captureRoutingRequestArgsForCall, struct {
arg1 *route.Endpoint
}{arg1})
fake.recordInvocation("CaptureRoutingRequest", []interface{}{arg1})
fake.captureRoutingRequestMutex.Unlock()
if fake.CaptureRoutingRequestStub != nil {
fake.CaptureRoutingRequestStub(arg1)
}
}
func (fake *FakeVarzReporter) CaptureRoutingRequestCallCount() int {
fake.captureRoutingRequestMutex.RLock()
defer fake.captureRoutingRequestMutex.RUnlock()
return len(fake.captureRoutingRequestArgsForCall)
}
func (fake *FakeVarzReporter) CaptureRoutingRequestCalls(stub func(*route.Endpoint)) {
fake.captureRoutingRequestMutex.Lock()
defer fake.captureRoutingRequestMutex.Unlock()
fake.CaptureRoutingRequestStub = stub
}
func (fake *FakeVarzReporter) CaptureRoutingRequestArgsForCall(i int) *route.Endpoint {
fake.captureRoutingRequestMutex.RLock()
defer fake.captureRoutingRequestMutex.RUnlock()
argsForCall := fake.captureRoutingRequestArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeVarzReporter) CaptureRoutingResponseLatency(arg1 *route.Endpoint, arg2 int, arg3 time.Time, arg4 time.Duration) {
fake.captureRoutingResponseLatencyMutex.Lock()
fake.captureRoutingResponseLatencyArgsForCall = append(fake.captureRoutingResponseLatencyArgsForCall, struct {
arg1 *route.Endpoint
arg2 int
arg3 time.Time
arg4 time.Duration
}{arg1, arg2, arg3, arg4})
fake.recordInvocation("CaptureRoutingResponseLatency", []interface{}{arg1, arg2, arg3, arg4})
fake.captureRoutingResponseLatencyMutex.Unlock()
if fake.CaptureRoutingResponseLatencyStub != nil {
fake.CaptureRoutingResponseLatencyStub(arg1, arg2, arg3, arg4)
}
}
func (fake *FakeVarzReporter) CaptureRoutingResponseLatencyCallCount() int {
fake.captureRoutingResponseLatencyMutex.RLock()
defer fake.captureRoutingResponseLatencyMutex.RUnlock()
return len(fake.captureRoutingResponseLatencyArgsForCall)
}
func (fake *FakeVarzReporter) CaptureRoutingResponseLatencyCalls(stub func(*route.Endpoint, int, time.Time, time.Duration)) {
fake.captureRoutingResponseLatencyMutex.Lock()
defer fake.captureRoutingResponseLatencyMutex.Unlock()
fake.CaptureRoutingResponseLatencyStub = stub
}
func (fake *FakeVarzReporter) CaptureRoutingResponseLatencyArgsForCall(i int) (*route.Endpoint, int, time.Time, time.Duration) {
fake.captureRoutingResponseLatencyMutex.RLock()
defer fake.captureRoutingResponseLatencyMutex.RUnlock()
argsForCall := fake.captureRoutingResponseLatencyArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeVarzReporter) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.captureBadGatewayMutex.RLock()
defer fake.captureBadGatewayMutex.RUnlock()
fake.captureBadRequestMutex.RLock()
defer fake.captureBadRequestMutex.RUnlock()
fake.captureRoutingRequestMutex.RLock()
defer fake.captureRoutingRequestMutex.RUnlock()
fake.captureRoutingResponseLatencyMutex.RLock()
defer fake.captureRoutingResponseLatencyMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeVarzReporter) 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)
}
//lint:ignore SA1019 - ignoring deprecation of internal object
var _ metrics.VarzReporter = new(FakeVarzReporter)