From 389c818ace4f77cf314bfd6a503eb56854ce4362 Mon Sep 17 00:00:00 2001 From: Neeraj Gartia Date: Mon, 24 Feb 2025 20:29:11 +0530 Subject: [PATCH] fix lint Signed-off-by: Neeraj Gartia --- promql/promqltest/test.go | 8 +++----- promql/promqltest/test_test.go | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/promql/promqltest/test.go b/promql/promqltest/test.go index 46f0fb2e3d..d0d586367d 100644 --- a/promql/promqltest/test.go +++ b/promql/promqltest/test.go @@ -266,7 +266,7 @@ func parseSeries(defLine string, line int) (labels.Labels, []parser.SequenceValu return metric, vals, nil } -func parseExpect(defLine string, i int) (expectCmdType, expectCmd, error) { +func parseExpect(defLine string) (expectCmdType, expectCmd, error) { expectParts := patExpect.FindStringSubmatch(strings.TrimSpace(defLine)) expCmd := expectCmd{} if expectParts == nil { @@ -415,7 +415,7 @@ func (t *test) parseEval(lines []string, i int) (int, *evalCmd, error) { // This would still allow a metric named 'expect' if it is written as 'expect{}'. if strings.Split(defLine, " ")[0] == "expect" { - annoType, expectedAnno, err := parseExpect(defLine, i) + annoType, expectedAnno, err := parseExpect(defLine) if err != nil { return i, nil, formatErr("%w", err) } @@ -804,9 +804,7 @@ func validateExpectedAnnotations(expr string, expectedAnnotations []expectCmd, a // Check if all expected annotations are found in actual. for _, e := range expectedAnnotations { - matchFound := slices.ContainsFunc(actualAnnotations, func(anno string) bool { - return e.CheckMatch(anno) - }) + matchFound := slices.ContainsFunc(actualAnnotations, e.CheckMatch) if !matchFound { return fmt.Errorf("expected %s annotation %q but no matching annotation was found for query %q (line %d)", annotationType, e.String(), expr, line) } diff --git a/promql/promqltest/test_test.go b/promql/promqltest/test_test.go index d2c4be0c08..6fdb0929c6 100644 --- a/promql/promqltest/test_test.go +++ b/promql/promqltest/test_test.go @@ -374,6 +374,7 @@ eval_info instant at 50m sort(rate(http_requests[10m])) "instant query with unexpected info annotation": { input: testData + ` eval instant at 50m sort(rate(http_requests[10m])) + expect no_info {group="production", instance="0", job="api-server"} 0.03333333333333333 {group="production", instance="1", job="api-server"} 0.06666666666666667 {group="canary", instance="0", job="api-server"} 0.1