Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/batch/combined_ack_func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,20 @@ func TestCombinedAckErrorSync(t *testing.T) {
})

var derivedFuncs []AckFunc
for i := 0; i < 1000; i++ {
for range 1000 {
derivedFuncs = append(derivedFuncs, combined.Derive())
}

startChan := make(chan struct{})
var wg sync.WaitGroup
for i := 0; i < 10; i++ {
for i := range 10 {
wg.Add(1)
i := i
go func() {
defer wg.Done()
<-startChan

for j := 0; j < 100; j++ {
for j := range 100 {
assert.NoError(t, derivedFuncs[(i*100)+j](t.Context(), nil))
}
}()
Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/field/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func TestStaticExpressionOptimization(t *testing.T) {
}

for _, test := range tests {
test := test
t.Run(test.output, func(t *testing.T) {
e := NewExpression(test.input...)
assert.Equal(t, test.output, e.static)
Expand Down Expand Up @@ -344,7 +343,6 @@ func TestExpressions(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
4 changes: 0 additions & 4 deletions internal/bloblang/mapping/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ func TestAssignments(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
msg := message.QuickBatch(nil)
for _, p := range test.input {
Expand Down Expand Up @@ -393,7 +392,6 @@ func TestTargets(t *testing.T) {
}

for i, test := range tests {
test := test
t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
_, targets := test.mapping.QueryTargets(query.TargetsContext{
Maps: map[string]query.Function{},
Expand Down Expand Up @@ -494,7 +492,6 @@ func TestExec(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
res, err := test.mapping.Exec(query.FunctionContext{
MsgBatch: message.QuickBatch(nil),
Expand Down Expand Up @@ -594,7 +591,6 @@ func TestQueries(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
msg := message.QuickBatch(nil)
for _, p := range test.input {
Expand Down
12 changes: 4 additions & 8 deletions internal/bloblang/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ root.meow = this.apply("foo")
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
m, err := GlobalEnvironment().NewMapping(test.mapping)
require.NoError(t, err)
Expand Down Expand Up @@ -234,21 +233,18 @@ func TestMappingParallelExecution(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
m, err := GlobalEnvironment().NewMapping(test.mapping)
require.NoError(t, err)

startChan := make(chan struct{})

var wg sync.WaitGroup
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for range 10 {
wg.Go(func() {
<-startChan

for j := 0; j < 100; j++ {
for range 100 {
part := message.NewPart(nil)
part.SetStructured(test.input)

Expand All @@ -263,7 +259,7 @@ func TestMappingParallelExecution(t *testing.T) {

assert.Equal(t, test.output, res)
}
}()
})
}

close(startChan)
Expand Down
2 changes: 1 addition & 1 deletion internal/bloblang/parser/combinators.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func UntilTerm(term string) Func[string] {
i := 0
for ; i <= (len(input) - len(termRunes)); i++ {
matched := true
for j := 0; j < len(termRunes); j++ {
for j := range termRunes {
if input[i+j] != termRunes[j] {
matched = false
break
Expand Down
4 changes: 0 additions & 4 deletions internal/bloblang/parser/combinators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ func TestOneOfErrors(t *testing.T) {
for name, test := range tests {
childParsers := []Func[any]{}
for _, err := range test.resultErrs {
err := err
childParsers = append(childParsers, func([]rune) Result[any] {
return Result[any]{
Err: err,
Expand Down Expand Up @@ -428,7 +427,6 @@ func TestBestMatch(t *testing.T) {
for name, test := range tests {
childParsers := []Func[any]{}
for _, res := range test.inputResults {
res := res
childParsers = append(childParsers, func([]rune) Result[any] {
return res
})
Expand Down Expand Up @@ -922,7 +920,6 @@ func TestMustBe(t *testing.T) {
}

for name, test := range tests {
test := test
childParser := func([]rune) Result[any] {
return test.inputRes
}
Expand Down Expand Up @@ -981,7 +978,6 @@ func TestInterceptExpectedError(t *testing.T) {
}

for name, test := range tests {
test := test
childParser := func([]rune) Result[any] {
return test.inputRes
}
Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/parser/field_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestFieldExpressionParserErrors(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
_, err := ParseField(GlobalContext(), test.input)
Expand Down Expand Up @@ -196,7 +195,6 @@ func TestFieldExpressions(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/parser/mapping_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ foo = bar.apply("foo")`, goodMapFile),
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
exec, err := ParseMapping(GlobalContext(), test.mapping)
require.NotNil(t, err)
Expand Down Expand Up @@ -555,7 +554,6 @@ from "%v"`, directMapFile),
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
msg := message.QuickBatch(nil)
for _, p := range test.input {
Expand Down
1 change: 0 additions & 1 deletion internal/bloblang/parser/query_arithmetic_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func TestArithmeticParser(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion internal/bloblang/parser/query_expression_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ func TestExpressionsParser(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 1 addition & 2 deletions internal/bloblang/parser/query_function_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,6 @@ bar""")`,
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -709,7 +708,7 @@ func TestCountersFunction(t *testing.T) {
func TestUUIDV4Function(t *testing.T) {
results := map[string]struct{}{}

for i := 0; i < 100; i++ {
for range 100 {
e, perr := tryParseQuery("uuid_v4()")
require.Nil(t, perr)

Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/parser/query_literal_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func TestLiteralParserErrors(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
_, err := tryParseQuery(test.input)
Expand Down Expand Up @@ -112,7 +111,6 @@ func TestLiteralParser(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 0 additions & 3 deletions internal/bloblang/parser/query_method_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ func TestMethodParser(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -447,7 +446,6 @@ func TestMethodErrors(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -548,7 +546,6 @@ func TestMethodMaps(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/parser/query_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ func TestFunctionParserErrors(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
_, err := tryParseQuery(test.input)
Expand Down Expand Up @@ -235,7 +234,6 @@ not this`,
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()
res := queryParser(Context{
Expand Down
1 change: 0 additions & 1 deletion internal/bloblang/parser/root_expression_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ if this.foo > this.bar {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
for _, io := range test.io {
inPart := message.NewPart([]byte(io[0].Content))
Expand Down
4 changes: 0 additions & 4 deletions internal/bloblang/query/arithmetic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func TestArithmeticNumberDegradation(t *testing.T) {
}

for _, test := range testCases {
test := test
t.Run(test.name, func(t *testing.T) {
res, err := fn(NewLiteralFunction("left", test.left), NewLiteralFunction("right", test.right), test.left, test.right)
if test.err != "" {
Expand Down Expand Up @@ -267,7 +266,6 @@ func TestArithmeticComparisons(t *testing.T) {
}

for _, test := range testCases {
test := test
t.Run(test.name, func(t *testing.T) {
fn, err := NewArithmeticExpression(
[]Function{
Expand Down Expand Up @@ -806,7 +804,6 @@ func TestArithmetic(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -910,7 +907,6 @@ func TestArithmeticTargets(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 0 additions & 2 deletions internal/bloblang/query/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func TestTypeError(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
assert.Equal(t, test.exp, value.NewTypeErrorFrom(test.from, test.actual, test.types...).Error())
})
Expand Down Expand Up @@ -131,7 +130,6 @@ func TestTypeMismatchError(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
assert.Equal(t, test.exp, NewTypeMismatch(
test.operator,
Expand Down
4 changes: 1 addition & 3 deletions internal/bloblang/query/expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ func TestExpressions(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand All @@ -255,7 +254,7 @@ func TestExpressions(t *testing.T) {
msg = append(msg, part)
}

for i := 0; i < 10; i++ {
for range 10 {
res, err := test.input.Exec(FunctionContext{
Maps: map[string]Function{},
Index: test.index,
Expand Down Expand Up @@ -434,7 +433,6 @@ func TestExpressionTargets(t *testing.T) {
}

for name, test := range tests {
test := test
t.Run(name, func(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion internal/bloblang/query/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func rangeFunction(args *ParsedParams) (Function, error) {
return nil, fmt.Errorf("with positive step arg start (%v) must be < stop (%v)", start, stop)
}
r := make([]any, (stop-start)/step)
for i := 0; i < len(r); i++ {
for i := range r {
r[i] = start + step*int64(i)
}
return ClosureFunction("function range", func(ctx FunctionContext) (any, error) {
Expand Down
Loading