mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
fix lint
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
This commit is contained in:
parent
853d5ada2a
commit
389c818ace
|
@ -266,7 +266,7 @@ func parseSeries(defLine string, line int) (labels.Labels, []parser.SequenceValu
|
||||||
return metric, vals, nil
|
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))
|
expectParts := patExpect.FindStringSubmatch(strings.TrimSpace(defLine))
|
||||||
expCmd := expectCmd{}
|
expCmd := expectCmd{}
|
||||||
if expectParts == nil {
|
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{}'.
|
// This would still allow a metric named 'expect' if it is written as 'expect{}'.
|
||||||
if strings.Split(defLine, " ")[0] == "expect" {
|
if strings.Split(defLine, " ")[0] == "expect" {
|
||||||
annoType, expectedAnno, err := parseExpect(defLine, i)
|
annoType, expectedAnno, err := parseExpect(defLine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return i, nil, formatErr("%w", err)
|
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.
|
// Check if all expected annotations are found in actual.
|
||||||
for _, e := range expectedAnnotations {
|
for _, e := range expectedAnnotations {
|
||||||
matchFound := slices.ContainsFunc(actualAnnotations, func(anno string) bool {
|
matchFound := slices.ContainsFunc(actualAnnotations, e.CheckMatch)
|
||||||
return e.CheckMatch(anno)
|
|
||||||
})
|
|
||||||
if !matchFound {
|
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)
|
return fmt.Errorf("expected %s annotation %q but no matching annotation was found for query %q (line %d)", annotationType, e.String(), expr, line)
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,6 +374,7 @@ eval_info instant at 50m sort(rate(http_requests[10m]))
|
||||||
"instant query with unexpected info annotation": {
|
"instant query with unexpected info annotation": {
|
||||||
input: testData + `
|
input: testData + `
|
||||||
eval instant at 50m sort(rate(http_requests[10m]))
|
eval instant at 50m sort(rate(http_requests[10m]))
|
||||||
|
expect no_info
|
||||||
{group="production", instance="0", job="api-server"} 0.03333333333333333
|
{group="production", instance="0", job="api-server"} 0.03333333333333333
|
||||||
{group="production", instance="1", job="api-server"} 0.06666666666666667
|
{group="production", instance="1", job="api-server"} 0.06666666666666667
|
||||||
{group="canary", instance="0", job="api-server"} 0.1
|
{group="canary", instance="0", job="api-server"} 0.1
|
||||||
|
|
Loading…
Reference in a new issue