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

Method compareResponses

tools/querytee/proxy_endpoint.go:178–193  ·  view source on GitHub ↗
(expectedResponse, actualResponse *backendResponse)

Source from the content-addressed store, hash-verified

176}
177
178func (p *ProxyEndpoint) compareResponses(expectedResponse, actualResponse *backendResponse) error {
179 // compare response body only if we get a 200
180 if expectedResponse.status != 200 {
181 return fmt.Errorf("skipped comparison of response because we got status code %d from preferred backend's response", expectedResponse.status)
182 }
183
184 if actualResponse.status != 200 {
185 return fmt.Errorf("skipped comparison of response because we got status code %d from secondary backend's response", actualResponse.status)
186 }
187
188 if expectedResponse.status != actualResponse.status {
189 return fmt.Errorf("expected status code %d but got %d", expectedResponse.status, actualResponse.status)
190 }
191
192 return p.comparator.Compare(expectedResponse.body, actualResponse.body)
193}
194
195type backendResponse struct {
196 backend *ProxyBackend

Callers 1

Calls 1

CompareMethod · 0.65

Tested by

no test coverage detected