diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9317cc1bf8..d2e8e5d92f 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -121,15 +121,24 @@ steps: - |- make clean install-vendor-m3 services tools <<: *common -# - name: "Lint" -# command: make clean lint -# env: -# CGO_ENABLED: 0 -# plugins: -# docker-compose#v2.5.1: -# run: app -# workdir: /go/src/github.com/m3db/m3 -# <<: *common + - name: "Lint" + env: + CGO_ENABLED: 0 + GIMME_GO_VERSION: 1.18.x + plugins: + docker-compose#v2.5.1: + run: app + workdir: /go/src/github.com/m3db/m3 + kubernetes: + <<: *kubernetes + podSpec: + <<: *podSpec + containers: + - <<: *commandContainer + command: + - |- + make clean lint + <<: *common # - name: "Integration (:docker:)" # command: make clean install-vendor-m3 docker-integration-test # parallelism: 2 diff --git a/src/aggregator/integration/integration_data.go b/src/aggregator/integration/integration_data.go index 10ff0ac583..a3459794cc 100644 --- a/src/aggregator/integration/integration_data.go +++ b/src/aggregator/integration/integration_data.go @@ -35,7 +35,6 @@ import ( "github.com/m3db/m3/src/metrics/metric/aggregated" metricid "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/metric/unaggregated" - "github.com/m3db/m3/src/metrics/pipeline" mpipeline "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/pipeline/applied" "github.com/m3db/m3/src/metrics/policy" @@ -137,7 +136,7 @@ var ( Operations: []applied.OpUnion{ { Type: mpipeline.TransformationOpType, - Transformation: pipeline.TransformationOp{ + Transformation: mpipeline.TransformationOp{ Type: transformation.Absolute, }, }, diff --git a/src/aggregator/integration/one_client_r2_preserve_original_test.go b/src/aggregator/integration/one_client_r2_preserve_original_test.go index be1250962b..c44d35fd91 100644 --- a/src/aggregator/integration/one_client_r2_preserve_original_test.go +++ b/src/aggregator/integration/one_client_r2_preserve_original_test.go @@ -33,6 +33,7 @@ import ( "github.com/m3db/m3/src/metrics/metric/aggregated" metricid "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/metric/unaggregated" + "github.com/stretchr/testify/require" "go.uber.org/zap" ) diff --git a/src/dbnode/x/encoding/shallow_cloner_test.go b/src/dbnode/x/encoding/shallow_cloner_test.go index 8636300219..1f921fec5a 100644 --- a/src/dbnode/x/encoding/shallow_cloner_test.go +++ b/src/dbnode/x/encoding/shallow_cloner_test.go @@ -45,9 +45,10 @@ func TestCloneMultiReaderIterator(t *testing.T) { f := newFixture(t) defer f.ctrl.Finish() - f.shallowCloner.cloneBlockReaderFn = func(b xio.BlockReader, _ xtime.UnixNano, _ time.Duration) (xio.BlockReader, error) { - return b, nil - } + f.shallowCloner.cloneBlockReaderFn = + func(b xio.BlockReader, _ xtime.UnixNano, _ time.Duration) (xio.BlockReader, error) { + return b, nil + } testBlockSize := time.Hour now := time.Now() diff --git a/src/integration/resources/docker/dockerexternal/etcd.go b/src/integration/resources/docker/dockerexternal/etcd.go index fbc00b2033..e3a5d07ad6 100644 --- a/src/integration/resources/docker/dockerexternal/etcd.go +++ b/src/integration/resources/docker/dockerexternal/etcd.go @@ -35,6 +35,7 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" + "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" clientv3 "go.etcd.io/etcd/client/v3" @@ -221,14 +222,15 @@ func (c *EtcdNode) containerClientHostPort() string { var ipAddress string _, err := net.ResolveIPAddr("ip4", "host.docker.internal") - if err == nil && runtime.GOOS == "darwin" { + switch { + case err == nil && runtime.GOOS == "darwin": c.logger.Info("Running on Mac; using 127.0.0.1 to talk to etcd") ipAddress = "127.0.0.1" - } else if err == nil { + case err == nil: c.logger.Info("Running tests within a docker container (e.g. for buildkite. " + "Using host.docker.internal to talk to etcd") ipAddress = "host.docker.internal" - } else { + default: c.logger.Info("Running tests in environment without host.docker.internal set. Using 127.0.0.1 to talk to etcd") ipAddress = "127.0.0.1" } diff --git a/src/metrics/rules/active_ruleset_test.go b/src/metrics/rules/active_ruleset_test.go index 74a669996c..744022c8b8 100644 --- a/src/metrics/rules/active_ruleset_test.go +++ b/src/metrics/rules/active_ruleset_test.go @@ -629,6 +629,7 @@ func TestActiveRuleSetForwardMatchWithAnyKeepOriginal(t *testing.T) { } } +//nolint:dupl func TestActiveRuleSetForwardMatchWithRollupRules(t *testing.T) { inputs := []testMatchInput{ { @@ -1496,8 +1497,10 @@ func TestActiveRuleSetForwardMatchWithRollupRules(t *testing.T) { } } +//nolint:dupl func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { inputs := []testMatchInput{ + //nolint:lll // Test case that has one include tag in the metric id { id: "rtagName1=rtagValue1,rtagName2=rtagValue2,rtagName3=rtagValue3,includeThisTag1=includeValue1", @@ -1512,6 +1515,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ metadata.DefaultPipelineMetadata, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), StoragePolicies: policy.StoragePolicies{ @@ -1529,6 +1533,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }), }, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Last), StoragePolicies: policy.StoragePolicies{ @@ -1598,6 +1603,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }, }, + //nolint:lll // Test case that has two include tags in the metric id { id: "rtagName1=rtagValue1,rtagName2=rtagValue2,rtagName3=rtagValue3,includeThisTag1=includeValue1,includeThisTag2=includeThisValue2", @@ -1612,6 +1618,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ metadata.DefaultPipelineMetadata, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), StoragePolicies: policy.StoragePolicies{ @@ -1629,6 +1636,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }), }, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Last), StoragePolicies: policy.StoragePolicies{ @@ -1698,6 +1706,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }, }, + //nolint:lll { id: "rtagName1=rtagValue2,includeThisTag1=includeValue1,includeThisTag2=includeThisValue2", matchFrom: 25000, @@ -1760,6 +1769,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { keepOriginal: false, forExistingIDResult: metadata.DefaultStagedMetadatas, }, + //nolint:lll { id: "rtagName1=rtagValue1,rtagName2=rtagValue2,rtagName3=rtagValue3,includeThisTag1=includeValue1,includeThisTag2=includeThisValue2", matchFrom: 10000, @@ -1783,6 +1793,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ metadata.DefaultPipelineMetadata, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), StoragePolicies: policy.StoragePolicies{ @@ -1809,6 +1820,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ metadata.DefaultPipelineMetadata, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), StoragePolicies: policy.StoragePolicies{ @@ -1826,6 +1838,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }), }, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Last), StoragePolicies: policy.StoragePolicies{ @@ -1857,6 +1870,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ metadata.DefaultPipelineMetadata, + //nolint:dupl { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), StoragePolicies: policy.StoragePolicies{ @@ -2351,6 +2365,7 @@ func TestActiveRuleSetForwardMatchWithRollupRulesWithIncludeTags(t *testing.T) { }, }, }, + //nolint:lll //nolint:dupl { id: "rtagName1=rtagValue3,rtagName2=rtagValue2,rtagName3=rtagValue3,includeThisTag1=includeValue1,includeThisTag2=includeThisValue2", diff --git a/src/x/process/process_linux_test.go b/src/x/process/process_linux_test.go index aedfc175ad..17e9c5a213 100644 --- a/src/x/process/process_linux_test.go +++ b/src/x/process/process_linux_test.go @@ -58,8 +58,8 @@ func TestNumFDs(t *testing.T) { func() { numExpectedFds := numFilesToCreate + stdProcessFiles - cleanupFn := createTempFiles(numFilesToCreate) - defer cleanupFn() + cleanupFnFromFiles := createTempFiles(numFilesToCreate) + defer cleanupFnFromFiles() selfPID := os.Getpid()