Skip to content

Commit

Permalink
Fix and silence some linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Apr 12, 2021
1 parent d5f62d7 commit 69d1150
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions js/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,7 @@ func TestExecutionStats(t *testing.T) {
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
r, err := getSimpleRunner(t, "/script.js", tc.script)
if tc.expErr != "" {
require.Error(t, err)
Expand Down
5 changes: 5 additions & 0 deletions lib/execution_segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,10 @@ func BenchmarkExecutionSegmentScale(b *testing.B) {
// TODO: test with randomized things

func TestSegmentedIndex(t *testing.T) {
t.Parallel()
// TODO ... more structure ?
t.Run("full", func(t *testing.T) {
t.Parallel()
s := SegmentedIndex{start: 0, lcd: 1, offsets: []int64{1}}

s.Next()
Expand Down Expand Up @@ -964,6 +966,7 @@ func TestSegmentedIndex(t *testing.T) {
})

t.Run("half", func(t *testing.T) {
t.Parallel()
s := SegmentedIndex{start: 0, lcd: 2, offsets: []int64{2}}

s.Next()
Expand Down Expand Up @@ -1004,6 +1007,7 @@ func TestSegmentedIndex(t *testing.T) {
})

t.Run("the other half", func(t *testing.T) {
t.Parallel()
s := SegmentedIndex{start: 1, lcd: 2, offsets: []int64{2}}

s.Next()
Expand Down Expand Up @@ -1044,6 +1048,7 @@ func TestSegmentedIndex(t *testing.T) {
})

t.Run("strange", func(t *testing.T) {
t.Parallel()
s := SegmentedIndex{start: 1, lcd: 7, offsets: []int64{4, 3}}

s.Next()
Expand Down
2 changes: 1 addition & 1 deletion lib/executor/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func setupExecutor(t *testing.T, config lib.ExecutorConfig, es *lib.ExecutionSta
logEntry := logrus.NewEntry(testLog)

initVUFunc := func(_ context.Context, logger *logrus.Entry) (lib.InitializedVU, error) {
return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut)
return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut) //nolint: wrapcheck
}
es.SetInitVUFunc(initVUFunc)

Expand Down
3 changes: 2 additions & 1 deletion lib/executor/constant_arrival_rate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,10 @@ func TestConstantArrivalRateGlobalIters(t *testing.T) {
{"0,1/4,3/4,1", "3/4:1", []uint64{0, 4, 9, 14}},
}

for _, tc := range testCases {
for _, tc := range testCases { //nolint: paralleltest // false positive: https://github.com/kunwardeep/paralleltest/issues/8
tc := tc
t.Run(fmt.Sprintf("%s_%s", tc.seq, tc.seg), func(t *testing.T) {
t.Parallel()
ess, err := lib.NewExecutionSegmentSequenceFromString(tc.seq)
require.NoError(t, err)
seg, err := lib.NewExecutionSegmentFromString(tc.seg)
Expand Down
2 changes: 1 addition & 1 deletion lib/executor/ramping_arrival_rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (varr *RampingArrivalRate) Init(ctx context.Context) error {
start, offsets, lcd := et.GetStripedOffsets()
varr.segIdx = lib.NewSegmentedIndex(start, lcd, offsets)

return err
return err //nolint: wrapcheck
}

// incrGlobalIter increments the global iteration count for this executor,
Expand Down
7 changes: 4 additions & 3 deletions lib/executor/ramping_arrival_rate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestRampingArrivalRateRunUnplannedVUs(t *testing.T) {
time.Sleep(time.Millisecond * 200)
cur = atomic.LoadInt64(&count)
require.NotEqual(t, cur, int64(2))
return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut)
return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut) //nolint: wrapcheck
})
err = executor.Run(ctx, engineOut)
assert.NoError(t, err)
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestRampingArrivalRateRunCorrectRateWithSlowRate(t *testing.T) {
cur = atomic.LoadInt64(&count)
require.NotEqual(t, cur, int64(1))

return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut)
return runner.NewVU(es.GetUniqueVUIdentifier(), engineOut) //nolint: wrapcheck
})
err = executor.Run(ctx, engineOut)
assert.NoError(t, err)
Expand Down Expand Up @@ -611,9 +611,10 @@ func TestRampingArrivalRateGlobalIters(t *testing.T) {
{"0,1/4,3/4,1", "3/4:1", []uint64{0, 4, 9}},
}

for _, tc := range testCases {
for _, tc := range testCases { //nolint: paralleltest // false positive: https://github.com/kunwardeep/paralleltest/issues/8
tc := tc
t.Run(fmt.Sprintf("%s_%s", tc.seq, tc.seg), func(t *testing.T) {
t.Parallel()
ess, err := lib.NewExecutionSegmentSequenceFromString(tc.seq)
require.NoError(t, err)
seg, err := lib.NewExecutionSegmentFromString(tc.seg)
Expand Down
3 changes: 2 additions & 1 deletion lib/executor/shared_iterations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,10 @@ func TestSharedIterationsGlobalIters(t *testing.T) {
{"0,1/4,3/4,1", "3/4:1", []uint64{0, 4, 9, 14, 19, 24, 29, 34, 39, 44}},
}

for _, tc := range testCases {
for _, tc := range testCases { //nolint: paralleltest // false positive: https://github.com/kunwardeep/paralleltest/issues/8
tc := tc
t.Run(fmt.Sprintf("%s_%s", tc.seq, tc.seg), func(t *testing.T) {
t.Parallel()
ess, err := lib.NewExecutionSegmentSequenceFromString(tc.seq)
require.NoError(t, err)
seg, err := lib.NewExecutionSegmentFromString(tc.seg)
Expand Down

0 comments on commit 69d1150

Please sign in to comment.