Skip to content

Commit

Permalink
[lint] Add missing build tags to linter configuration (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpranckaitis authored May 7, 2021
1 parent d838a75 commit 6ea9541
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 27 deletions.
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ run:
tests: true

# list of build tags, all linters use it. Default is empty list.
build-tags: []
build-tags:
- big
- compatibility
- dtest
- integration

# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
Expand Down
5 changes: 3 additions & 2 deletions src/aggregator/integration/placement_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"
"go.uber.org/zap"

aggclient "github.com/m3db/m3/src/aggregator/client"
"github.com/m3db/m3/src/cluster/kv/mem"
"github.com/m3db/m3/src/cluster/placement"
Expand All @@ -38,8 +41,6 @@ import (
"github.com/m3db/m3/src/x/instrument"
xtest "github.com/m3db/m3/src/x/test"
xtime "github.com/m3db/m3/src/x/time"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
)

func TestPlacementChange(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions src/dbnode/integration/bootstrap_retries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestBootstrapRetriesDueToError(t *testing.T) {

go func() {
// Wait for server to get started by the main test method.
setup.WaitUntilServerIsUp()
require.NoError(t, setup.WaitUntilServerIsUp())

// First bootstrap pass. Bootstrapper produces an error. Check if DB is not marked bootstrapped.
signalCh <- true
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestBootstrapRetriesDueToObsoleteRanges(t *testing.T) {

go func() {
// Wait for server to get started by the main test method.
setup.WaitUntilServerIsUp()
require.NoError(t, setup.WaitUntilServerIsUp())

// First bootstrap pass, persist ranges. Check if DB is not marked bootstrapped and advance clock.
signalCh <- struct{}{}
Expand Down Expand Up @@ -161,7 +161,7 @@ func TestBootstrapRetriesDueToUnfulfilledRanges(t *testing.T) {

go func() {
// Wait for server to get started by the main test method.
setup.WaitUntilServerIsUp()
require.NoError(t, setup.WaitUntilServerIsUp())

// First bootstrap pass. Bootstrap produces unfulfilled ranges for persist range.
// Check if DB is not marked bootstrapped.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestIndexMultipleNodeHighConcurrency(t *testing.T) {
node(t, 2, newClusterShardsRange(minShard, maxShard, shard.Available)),
}
// nodes = m3db nodes
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances) //nolint:govet
clientopts = clientopts.SetReadConsistencyLevel(lvl)

defer closeFn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestPeersBootstrapNoneAvailable(t *testing.T) {
defer closeFn()

setups.parallel(func(s TestSetup) {
s.StartServer()
require.NoError(t, s.StartServer())
})
log.Debug("servers are now up")

Expand Down
7 changes: 3 additions & 4 deletions src/dbnode/integration/peers_bootstrap_partial_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import (
"testing"
"time"

xtime "github.com/m3db/m3/src/x/time"
"github.com/stretchr/testify/require"

"github.com/m3db/m3/src/dbnode/integration/generate"
"github.com/m3db/m3/src/dbnode/namespace"
"github.com/m3db/m3/src/dbnode/retention"
xtest "github.com/m3db/m3/src/x/test"

"github.com/stretchr/testify/require"
xtime "github.com/m3db/m3/src/x/time"
)

// This test simulates a case where node fails / reboots while fetching data from peers.
Expand Down Expand Up @@ -72,7 +71,7 @@ func TestPeersBootstrapPartialData(t *testing.T) {
DisablePeersBootstrapper: false,
},
}
setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts)
setups, closeFn := NewDefaultBootstrappableTestSetups(t, opts, setupOpts) //nolint:govet
defer closeFn()

// Write test data to first node
Expand Down
8 changes: 3 additions & 5 deletions src/dbnode/integration/series_wired_list_panic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/m3db/m3/src/dbnode/generated/thrift/rpc"
"github.com/m3db/m3/src/dbnode/integration/generate"
"github.com/m3db/m3/src/dbnode/namespace"
Expand All @@ -36,17 +38,13 @@ import (
"github.com/m3db/m3/src/dbnode/storage/block"
"github.com/m3db/m3/src/x/ident"
xtime "github.com/m3db/m3/src/x/time"

"github.com/stretchr/testify/require"
)

const (
numSeries = 10
)

var (
nsID = ident.StringID("ns0")
)
var nsID = ident.StringID("ns0")

func TestWiredListPanic(t *testing.T) {
// This test is used to repro https://github.com/m3db/m3/issues/2573.
Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/integration/write_quorum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func makeTestWrite(
node.SetOpts(node.Opts().SetNumShards(numShards))
for _, ns := range node.Namespaces() {
// write empty data files to disk so nodes could bootstrap
writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0)
require.NoError(t, writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/integration/write_read_high_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestWriteReadHighConcurrencyTestMultiNS(t *testing.T) {
node(t, 2, newClusterShardsRange(minShard, maxShard, shard.Available)),
}
)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances)
nodes, closeFn, clientopts := makeMultiNodeSetup(t, numShards, true, true, instances) //nolint:govet
clientopts = clientopts.
SetWriteConsistencyLevel(topology.ConsistencyLevelAll).
SetReadConsistencyLevel(topology.ReadConsistencyLevelAll)
Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/integration/write_tagged_quorum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func makeTestWriteTagged(
for _, node := range nodes {
for _, ns := range node.Namespaces() {
// write empty data files to disk so nodes could bootstrap
writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0)
require.NoError(t, writeTestDataToDisk(ns, node, generate.SeriesBlocksByStart{}, 0))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package commitlog

import (
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -194,7 +195,7 @@ func TestCommitLogSourcePropCorrectlyBootstrapsFromCommitlog(t *testing.T) {
reader, ok := encoder.Stream(ctx)
if ok {
bytes, err := xio.ToBytes(reader)
if err != io.EOF {
if !errors.Is(err, io.EOF) {
return false, err
}
encodersBySeries[seriesID] = bytes
Expand Down
14 changes: 9 additions & 5 deletions src/dbnode/storage/index/block_prop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,24 @@ func TestPostingsListCacheDoesNotAffectBlockQueryResults(t *testing.T) {
require.NoError(t, err)
for !queryIter.Done() {
err = uncachedBlock.QueryWithIter(ctx,
queryOpts, queryIter, uncachedResults, time.Now().Add(time.Millisecond * 10), emptyLogFields)
queryOpts, queryIter, uncachedResults, time.Now().Add(time.Millisecond*10), emptyLogFields)
if err != nil {
return false, fmt.Errorf("error querying uncached block: %v", err)
return false, fmt.Errorf("error querying uncached block: %w", err)
}
}

cachedResults := NewQueryResults(nil, QueryResultsOptions{}, testOpts)
ctx = context.NewBackground()
queryIter, err = cachedBlock.QueryIter(ctx, indexQuery)
if err != nil {
return false, err
}

for !queryIter.Done() {
err = cachedBlock.QueryWithIter(ctx, queryOpts, queryIter, cachedResults,
time.Now().Add(time.Millisecond * 10), emptyLogFields)
time.Now().Add(time.Millisecond*10), emptyLogFields)
if err != nil {
return false, fmt.Errorf("error querying cached block: %v", err)
return false, fmt.Errorf("error querying cached block: %w", err)
}
}

Expand Down Expand Up @@ -378,7 +382,7 @@ func TestAggregateDocLimits(t *testing.T) {
aggIter,
QueryOptions{},
results,
time.Now().Add(time.Millisecond * 10),
time.Now().Add(time.Millisecond*10),
emptyLogFields)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/dbnode/storage/series/series_parallel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import (
"time"

"github.com/golang/mock/gomock"
xtest "github.com/m3db/m3/src/x/test"
"github.com/stretchr/testify/require"

"github.com/m3db/m3/src/dbnode/namespace"
"github.com/m3db/m3/src/dbnode/storage/block"
"github.com/m3db/m3/src/dbnode/ts"
"github.com/m3db/m3/src/x/context"
"github.com/m3db/m3/src/x/ident"
xtest "github.com/m3db/m3/src/x/test"
xtime "github.com/m3db/m3/src/x/time"
)

Expand Down

0 comments on commit 6ea9541

Please sign in to comment.