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

Function compareSamplePair

tools/querytee/response_comparator.go:197–206  ·  view source on GitHub ↗
(expected, actual model.SamplePair, tolerance float64)

Source from the content-addressed store, hash-verified

195}
196
197func compareSamplePair(expected, actual model.SamplePair, tolerance float64) error {
198 if expected.Timestamp != actual.Timestamp {
199 return fmt.Errorf("expected timestamp %v but got %v", expected.Timestamp, actual.Timestamp)
200 }
201 if !compareSampleValue(expected.Value, actual.Value, tolerance) {
202 return fmt.Errorf("expected value %s for timestamp %v but got %s", expected.Value, expected.Timestamp, actual.Value)
203 }
204
205 return nil
206}
207
208func compareSampleValue(first, second model.SampleValue, tolerance float64) bool {
209 f := float64(first)

Callers 3

compareMatrixFunction · 0.85
compareVectorFunction · 0.85
compareScalarFunction · 0.85

Calls 1

compareSampleValueFunction · 0.85

Tested by

no test coverage detected