MCPcopy Index your code
hub / github.com/cortexproject/cortex / TestProxy_Passthrough

Function TestProxy_Passthrough

tools/querytee/proxy_test.go:188–338  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

186}
187
188func TestProxy_Passthrough(t *testing.T) {
189 type route struct {
190 path, response string
191 }
192
193 type mockedBackend struct {
194 routes []route
195 }
196
197 type query struct {
198 path string
199 expectedRes string
200 expectedStatusCode int
201 }
202
203 const (
204 pathCommon = "/common" // common path implemented by both backends
205
206 pathZero = "/zero" // only implemented by backend at index 0
207 pathOne = "/one" // only implemented by backend at index 1
208
209 // responses by backend at index 0
210 responseCommon0 = "common-0"
211 responseZero = "zero"
212
213 // responses by backend at index 1
214 responseCommon1 = "common-1"
215 responseOne = "one"
216 )
217
218 backends := []mockedBackend{
219 {
220 routes: []route{
221 {
222 path: pathCommon,
223 response: responseCommon0,
224 },
225 {
226 path: pathZero,
227 response: responseZero,
228 },
229 },
230 },
231 {
232 routes: []route{
233 {
234 path: pathCommon,
235 response: responseCommon1,
236 },
237 {
238 path: pathOne,
239 response: responseOne,
240 },
241 },
242 },
243 }
244
245 tests := map[string]struct {

Callers

nothing calls this directly

Calls 11

StopMethod · 0.95
StartMethod · 0.95
EndpointMethod · 0.95
mockQueryResponseFunction · 0.85
NewProxyFunction · 0.85
JoinMethod · 0.80
RunMethod · 0.65
HandleMethod · 0.65
CloseMethod · 0.65
GetMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected