chore: run lint in docker (#21292)

shantanu/tmp-fix-proj-pushdown
John Newbigin 3 weeks ago committed by GitHub
parent 49aa712921
commit 66ea16436a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      Makefile
  2. 2
      pkg/logql/bench/k6_types.go
  3. 8
      pkg/logql/bench/query_registry.go
  4. 9
      pkg/logql/bench/testcase.go

@ -347,6 +347,9 @@ LINT_FLAGS=--timeout=15m
GOFLAGS=""
endif
lint: ## run linters
ifeq ($(BUILD_IN_CONTAINER),true)
$(run_in_container)
else
go version
golangci-lint version
golangci-lint run -v $(LINT_FLAGS)
@ -363,6 +366,7 @@ lint: ## run linters
faillint -paths \
"github.com/opentracing/opentracing-go,github.com/opentracing/opentracing-go/log,github.com/uber/jaeger-client-go,github.com/opentracing-contrib/go-stdlib/nethttp" \
./...
endif
########
# Test #

@ -35,7 +35,7 @@ func ConvertTestCaseToK6(tc TestCase, tenantID int, length time.Duration, buffer
if tc.QueryDesc != "" {
name = fmt.Sprintf("%s - %s", tc.Source, tc.QueryDesc)
}
if kind == "log" {
if kind == kindLog {
name = fmt.Sprintf("%s [%s]", name, directionLabel(tc.Direction))
}

@ -204,12 +204,12 @@ func (r *QueryRegistry) loadFile(filePath string, suite Suite, fileName string)
q.Source = fmt.Sprintf("%s/%s:%d", suite, fileName, lineNum)
// Default directions to "both" for log queries
if q.Directions == "" && q.Kind == "log" {
if q.Directions == "" && q.Kind == kindLog {
q.Directions = DirectionBoth
}
if q.Kind == "" || (q.Kind != "metric" && q.Kind != "log") {
q.Kind = "log"
if q.Kind == "" || (q.Kind != kindMetric && q.Kind != kindLog) {
q.Kind = kindLog
}
// Validate time range
@ -325,7 +325,7 @@ func (r *QueryRegistry) ExpandQuery(def QueryDefinition, resolver VariableResolv
// Create test cases based on query kind and directions
var cases []TestCase
if def.Kind == "metric" {
if def.Kind == kindMetric {
// Metric queries only run in forward direction
tc := TestCase{
Query: resolvedQuery,

@ -10,6 +10,11 @@ import (
"github.com/grafana/loki/v3/pkg/logql/syntax"
)
const (
kindLog = "log"
kindMetric = "metric"
)
// TestCase represents a LogQL test case for benchmarking and testing
type TestCase struct {
Query string
@ -53,9 +58,9 @@ func (c TestCase) Kind() string {
return "invalid"
}
if _, ok := expr.(syntax.SampleExpr); ok {
return "metric"
return kindMetric
}
return "log"
return kindLog
}
// Description returns a detailed description of the test case including time range

Loading…
Cancel
Save