Skip to content

Commit

Permalink
Merge branch 'codesome/tee-skip-old' of github.com:grafana/mimir into…
Browse files Browse the repository at this point in the history
… codesome/tee-skip-old

Signed-off-by: Ganesh Vernekar <[email protected]>
  • Loading branch information
codesome committed Oct 9, 2024
2 parents fa25f8f + affff28 commit db5de05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/querytee/response_comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ func compareVector(expectedRaw, actualRaw json.RawMessage, queryEvaluationTime t
} else if eChanged {
warning = " (also, some samples were filtered out from the expected response due to the 'skip samples before'; if all samples have been filtered out, this could cause the check on the expected number of metrics to fail)"
}
retErr = fmt.Errorf("%w%s", retErr, warning)
if warning != "" {
retErr = fmt.Errorf("%w%s", retErr, warning)
}
}
}()
}
Expand Down Expand Up @@ -558,9 +560,12 @@ func compareScalar(expectedRaw, actualRaw json.RawMessage, queryEvaluationTime t
}

func compareSamplePair(expected, actual model.SamplePair, queryEvaluationTime time.Time, opts SampleComparisonOptions) error {
// If the timestamp is before the configured SkipSamplesBefore then we don't even check if the timestamp is correct.
// The reason is that the SkipSamplesBefore feature may be used to compare queries hitting a different storage and one of two storages has no historical data.
if expected.Timestamp < opts.SkipSamplesBefore && actual.Timestamp < opts.SkipSamplesBefore {
return nil
}

if expected.Timestamp != actual.Timestamp {
return fmt.Errorf("expected timestamp %v but got %v", expected.Timestamp, actual.Timestamp)
}
Expand Down

0 comments on commit db5de05

Please sign in to comment.