@@ -81,7 +81,8 @@ func TestCacheHandler(t *testing.T) {
81
81
defer downstreamServerNok .Close ()
82
82
83
83
webSocketReq := mustRequest (t , "/connect" , "" )
84
- webSocketReq .Header .Set ("connection" , "upgrade" )
84
+ webSocketReq .Header .Set ("Connection" , "upgrade" )
85
+ webSocketReq .Header .Set ("Upgrade" , "websocket" )
85
86
86
87
tests := []struct {
87
88
name string
@@ -90,17 +91,17 @@ func TestCacheHandler(t *testing.T) {
90
91
want int
91
92
}{
92
93
{
93
- name : "cacheLookup error should still forward request to downstream and store response " ,
94
+ name : "cacheLookup error should still forward request to downstream" ,
94
95
handler : newCacheHandler (
95
96
func () Cacher {
96
97
mock := NewMockCacher (ctrl )
97
98
mock .EXPECT ().LookUp (gomock .Any (), gomock .Any ()).Return (nil , errors .New ("test-error" ))
98
- mock .EXPECT ().Store (gomock .Any (), gomock .Any (), gomock .Any ())
99
+ mock .EXPECT ().Store (gomock .Any (), gomock .Any (), gomock .Any ()). Times ( 0 )
99
100
return mock
100
101
}(),
101
102
func () MetricsCollector {
102
103
mock := NewMockMetricsCollector (ctrl )
103
- mock .EXPECT ().CacheMiss ("GET" , proxied )
104
+ mock .EXPECT ().CacheMiss ("GET" , proxied ). Times ( 1 )
104
105
return mock
105
106
}(),
106
107
nil ,
@@ -117,7 +118,8 @@ func TestCacheHandler(t *testing.T) {
117
118
func () Cacher {
118
119
mock := NewMockCacher (ctrl )
119
120
mock .EXPECT ().LookUp (gomock .Any (), gomock .Any ()).Return (nil , nil ).Times (1 )
120
- mock .EXPECT ().Store (gomock .Any (), gomock .Any (), newResponseMatcher (proxied , nil )).Return (nil ).Times (1 )
121
+ mock .EXPECT ().Store (gomock .Any (), gomock .Any (), gomock .Any ()).Times (0 )
122
+
121
123
return mock
122
124
}(),
123
125
func () MetricsCollector {
@@ -138,13 +140,13 @@ func TestCacheHandler(t *testing.T) {
138
140
handler : newCacheHandler (
139
141
func () Cacher {
140
142
mock := NewMockCacher (ctrl )
141
- mock .EXPECT ().LookUp (nil , nil ).Times (0 )
142
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
143
+ mock .EXPECT ().LookUp (gomock . Any (), gomock . Any () ).Times (0 )
144
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
143
145
return mock
144
146
}(),
145
147
func () MetricsCollector {
146
148
mock := NewMockMetricsCollector (ctrl )
147
- mock .EXPECT ().CacheMiss (nil , nil ).Times (0 )
149
+ mock .EXPECT ().CacheMiss (gomock . Any (), gomock . Any () ).Times (0 )
148
150
return mock
149
151
}(),
150
152
nil ,
@@ -160,13 +162,13 @@ func TestCacheHandler(t *testing.T) {
160
162
handler : newCacheHandler (
161
163
func () Cacher {
162
164
mock := NewMockCacher (ctrl )
163
- mock .EXPECT ().LookUp (nil , nil ).Times (0 )
164
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
165
+ mock .EXPECT ().LookUp (gomock . Any (), gomock . Any () ).Times (0 )
166
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
165
167
return mock
166
168
}(),
167
169
func () MetricsCollector {
168
170
mock := NewMockMetricsCollector (ctrl )
169
- mock .EXPECT ().CacheMiss (nil , nil ).Times (0 )
171
+ mock .EXPECT ().CacheMiss (gomock . Any (), gomock . Any () ).Times (0 )
170
172
return mock
171
173
}(),
172
174
nil ,
@@ -182,13 +184,13 @@ func TestCacheHandler(t *testing.T) {
182
184
handler : newCacheHandler (
183
185
func () Cacher {
184
186
mock := NewMockCacher (ctrl )
185
- mock .EXPECT ().LookUp (nil , nil ).Times (0 )
186
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
187
+ mock .EXPECT ().LookUp (gomock . Any (), gomock . Any () ).Times (0 )
188
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
187
189
return mock
188
190
}(),
189
191
func () MetricsCollector {
190
192
mock := NewMockMetricsCollector (ctrl )
191
- mock .EXPECT ().CacheMiss (nil , nil ).Times (0 )
193
+ mock .EXPECT ().CacheMiss (gomock . Any (), gomock . Any () ).Times (0 )
192
194
return mock
193
195
}(),
194
196
nil ,
@@ -204,13 +206,13 @@ func TestCacheHandler(t *testing.T) {
204
206
handler : newCacheHandler (
205
207
func () Cacher {
206
208
mock := NewMockCacher (ctrl )
207
- mock .EXPECT ().LookUp (nil , nil ).Times (0 )
208
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
209
+ mock .EXPECT ().LookUp (gomock . Any (), gomock . Any () ).Times (0 )
210
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
209
211
return mock
210
212
}(),
211
213
func () MetricsCollector {
212
214
mock := NewMockMetricsCollector (ctrl )
213
- mock .EXPECT ().CacheMiss (nil , nil ).Times (0 )
215
+ mock .EXPECT ().CacheMiss (gomock . Any (), gomock . Any () ).Times (0 )
214
216
return mock
215
217
}(),
216
218
nil ,
@@ -226,13 +228,13 @@ func TestCacheHandler(t *testing.T) {
226
228
handler : newCacheHandler (
227
229
func () Cacher {
228
230
mock := NewMockCacher (ctrl )
229
- mock .EXPECT ().LookUp (nil , nil ).Times (0 )
230
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
231
+ mock .EXPECT ().LookUp (gomock . Any (), gomock . Any () ).Times (0 )
232
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
231
233
return mock
232
234
}(),
233
235
func () MetricsCollector {
234
236
mock := NewMockMetricsCollector (ctrl )
235
- mock .EXPECT ().CacheMiss (nil , nil ).Times (0 )
237
+ mock .EXPECT ().CacheMiss (gomock . Any (), gomock . Any () ).Times (0 )
236
238
return mock
237
239
}(),
238
240
nil ,
@@ -249,7 +251,7 @@ func TestCacheHandler(t *testing.T) {
249
251
func () Cacher {
250
252
mock := NewMockCacher (ctrl )
251
253
mock .EXPECT ().LookUp (gomock .Any (), gomock .Any ()).Return (nil , nil ).Times (1 )
252
- mock .EXPECT ().Store (nil , nil , nil ).Times (0 )
254
+ mock .EXPECT ().Store (gomock . Any (), gomock . Any (), gomock . Any () ).Times (0 )
253
255
return mock
254
256
}(),
255
257
func () MetricsCollector {
0 commit comments