diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 61cf035f20..12ed82dc28 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -48,6 +48,8 @@ common: &common # Temporarily disable codecov while we investigate issues with uploading. env: SKIP_CODECOV: "true" + CGO_ENABLED: 0 + GIMME_GO_VERSION: 1.22.x # Buildkite pipeline is currently broken, and we are working on fixing it. In the meantime, we are temporarily # disabling steps until it is fixed. ISSUE: https://github.com/m3db/m3/issues/4274 @@ -55,7 +57,7 @@ steps: # - name: "Codegen" # env: # CGO_ENABLED: 0 -# GIMME_GO_VERSION: 1.18.x +# GIMME_GO_VERSION: 1.22.x # plugins: # gopath-checkout#v1.0.1: # import: github.com/m3db/m3 @@ -122,9 +124,6 @@ steps: make clean install-vendor-m3 services tools <<: *common - name: "Lint" - env: - CGO_ENABLED: 0 - GIMME_GO_VERSION: 1.18.x plugins: docker-compose#v2.5.1: run: app @@ -140,9 +139,6 @@ steps: make clean lint <<: *common - label: "Integration (:docker:)" - env: - CGO_ENABLED: 0 - GIMME_GO_VERSION: 1.18.x plugins: docker-compose#v2.5.1: run: app @@ -158,9 +154,6 @@ steps: make clean install-vendor-m3 docker-integration-test <<: *common - label: "M3 Cluster Integration Tests" - env: - CGO_ENABLED: 0 - GIMME_GO_VERSION: 1.18.x plugins: gopath-checkout#v1.0.1: import: github.com/m3db/m3 @@ -195,7 +188,7 @@ steps: # parallelism: 1 # env: # CGO_ENABLED: 0 -# GIMME_GO_VERSION: 1.18.x +# GIMME_GO_VERSION: 1.22.x # plugins: # gopath-checkout#v1.0.1: # import: github.com/m3db/m3 @@ -286,7 +279,7 @@ steps: # command: make clean install-vendor-m3 docs-test # env: # CGO_ENABLED: 0 -# GIMME_GO_VERSION: 1.18.x +# GIMME_GO_VERSION: 1.22.x # plugins: # gopath-checkout#v1.0.1: # import: github.com/m3db/m3 diff --git a/.golangci.yml b/.golangci.yml index 19c9240798..452c27ee57 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,6 +81,8 @@ linters-settings: min-len: 3 # minimal occurrences count to trigger, 3 by default min-occurrences: 3 + # ignore tests + ignore-tests: true depguard: list-type: blacklist include-go-root: false @@ -156,6 +158,7 @@ linters-settings: # as a general rule of thumb. - hugeParam - rangeValCopy + - ifElseChain enabled-checks: # temp disabled, something wrong on go 1.18 # - ruleguard @@ -170,6 +173,9 @@ linters-settings: - standard - prefix(github.com/m3db/m3) - default + staticcheck: + # disable pkg deprecation checks. + checks: ["all", "-SA1019"] linters: enable: @@ -253,6 +259,26 @@ linters: - gomoddirectives - gofumpt - ifshort + - wastedassign + - usestdlibvars + - testifylint + - inamedparam + - exhaustruct + - depguard + - revive + - protogetter + - gosec + - mirror + - interfacebloat + - musttag + - nonamedreturns + - stylecheck + - contextcheck + - tagalign + - gosmopolitan + - nilerr + - whitespace + - bodyclose disable-all: false presets: # bodyclose, errcheck, gosec, govet, scopelint, staticcheck, typecheck diff --git a/Dockerfile b/Dockerfile index 37e546ed53..98b67e1b25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM golang:1.18-bullseye +FROM golang:1.22-bullseye RUN apt-get update && apt-get install -y lsof netcat-openbsd docker.io jq diff --git a/Makefile b/Makefile index 0b6ac44aee..62d31c7403 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ LINUX_AMD64_ENV := GOOS=linux GOARCH=amd64 $(GO_BUILD_COMMON_ENV) GO_RELEASER_DOCKER_IMAGE := goreleaser/goreleaser:v1.8.3 GO_RELEASER_RELEASE_ARGS ?= --rm-dist GO_RELEASER_WORKING_DIR := /go/src/github.com/m3db/m3 -GOLANGCI_LINT_VERSION := v1.45.2 +GOLANGCI_LINT_VERSION := v1.56.0 export NPROC := 2 # Maximum package concurrency for unit tests. diff --git a/docker/m3aggregator/Dockerfile b/docker/m3aggregator/Dockerfile index 222e66344f..7e0bed8650 100644 --- a/docker/m3aggregator/Dockerfile +++ b/docker/m3aggregator/Dockerfile @@ -1,5 +1,5 @@ # stage 1: build -FROM golang:1.18-alpine3.15 AS builder +FROM golang:1.22-alpine3.20 AS builder LABEL maintainer="The M3DB Authors " # Install deps @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \ make m3aggregator-linux-amd64 # stage 2: lightweight "release" -FROM alpine:3.15 +FROM alpine:3.20 LABEL maintainer="The M3DB Authors " EXPOSE 5000/tcp 6000/tcp 6001/tcp diff --git a/docker/m3coordinator/Dockerfile b/docker/m3coordinator/Dockerfile index 01313b01aa..c03bd43337 100644 --- a/docker/m3coordinator/Dockerfile +++ b/docker/m3coordinator/Dockerfile @@ -1,5 +1,5 @@ # stage 1: build -FROM golang:1.18-alpine3.15 AS builder +FROM golang:1.22-alpine3.20 AS builder LABEL maintainer="The M3DB Authors " # Install deps diff --git a/docker/m3dbnode/Dockerfile b/docker/m3dbnode/Dockerfile index 1075d9c6f4..94d00398a4 100644 --- a/docker/m3dbnode/Dockerfile +++ b/docker/m3dbnode/Dockerfile @@ -1,5 +1,5 @@ # stage 1: build -FROM golang:1.18-alpine3.15 AS builder +FROM golang:1.22-alpine3.20 AS builder LABEL maintainer="The M3DB Authors " # Install deps @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \ make m3dbnode-linux-amd64 # Stage 2: lightweight "release" -FROM alpine:3.15 +FROM alpine:3.20 LABEL maintainer="The M3DB Authors " ENV GODEBUG madvdontneed=1 diff --git a/docker/m3dbnode/Dockerfile-setcap b/docker/m3dbnode/Dockerfile-setcap index 270cfb37e8..b9f2087058 100644 --- a/docker/m3dbnode/Dockerfile-setcap +++ b/docker/m3dbnode/Dockerfile-setcap @@ -1,5 +1,5 @@ # stage 1: build -FROM golang:1.18-alpine3.15 AS builder +FROM golang:1.22-alpine3.20 AS builder LABEL maintainer="The M3DB Authors " # Install deps @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \ make m3dbnode-linux-amd64 # Stage 2: lightweight "release" -FROM alpine:3.15 +FROM alpine:3.20 LABEL maintainer="The M3DB Authors " ENV GODEBUG madvdontneed=1 diff --git a/docker/m3query/Dockerfile b/docker/m3query/Dockerfile index 63e5178f62..6feacf573f 100644 --- a/docker/m3query/Dockerfile +++ b/docker/m3query/Dockerfile @@ -1,5 +1,5 @@ # stage 1: build -FROM golang:1.18-alpine3.15 AS builder +FROM golang:1.22-alpine3.20 AS builder LABEL maintainer="The M3DB Authors " # Install deps @@ -15,7 +15,7 @@ RUN cd /go/src/github.com/m3db/m3/ && \ make m3query-linux-amd64 # stage 2: lightweight "release" -FROM alpine:3.15 +FROM alpine:3.20 LABEL maintainer="The M3DB Authors " EXPOSE 7201/tcp 7203/tcp diff --git a/examples/dbnode/metrics_client/main.go b/examples/dbnode/metrics_client/main.go index eeaca80cee..18cac77081 100644 --- a/examples/dbnode/metrics_client/main.go +++ b/examples/dbnode/metrics_client/main.go @@ -27,13 +27,13 @@ import ( "log" "time" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - yaml "gopkg.in/yaml.v2" ) const ( @@ -84,8 +84,8 @@ func main() { // runTaggedExample demonstrates how to write "tagged" (indexed) metrics data // and then read it back out again by either: // -// 1. Querying for a set of time series using an inverted index query -// 2. Querying for a specific time series by its ID directly +// 1. Querying for a set of time series using an inverted index query +// 2. Querying for a specific time series by its ID directly func runTaggedExample(session client.Session) { log.Printf("------ run tagged example ------") var ( diff --git a/examples/dbnode/proto_client/main.go b/examples/dbnode/proto_client/main.go index 5e4338ecea..05a8df1ac9 100644 --- a/examples/dbnode/proto_client/main.go +++ b/examples/dbnode/proto_client/main.go @@ -29,11 +29,12 @@ import ( "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding/proto" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - yaml "gopkg.in/yaml.v2" ) const ( @@ -135,8 +136,8 @@ func runUntaggedExample(session client.Session, schema *desc.MessageDescriptor) // runTaggedExample demonstrates how to write "tagged" (indexed) data into M3DB with a given protobuf // schema and then read it back out again by either: // -// 1. Querying for a specific time series by its ID directly -// 2. TODO(rartoul): Querying for a set of time series using an inverted index query +// 1. Querying for a specific time series by its ID directly +// 2. TODO(rartoul): Querying for a set of time series using an inverted index query func runTaggedExample(session client.Session, schema *desc.MessageDescriptor) { log.Printf("------ run tagged example ------") var ( diff --git a/go.mod b/go.mod index d74a51e018..ed10b1a75f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/m3db/m3 -go 1.18 +go 1.22 require ( github.com/MichaelTJones/pcg v0.0.0-20180122055547-df440c6ed7ed @@ -91,7 +91,10 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 +require ( + github.com/twmb/murmur3 v1.1.6 + golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 +) require ( github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect @@ -102,7 +105,6 @@ require ( github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect github.com/aws/aws-sdk-go v1.41.7 // indirect - github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.1.2 // indirect github.com/containerd/continuity v0.1.0 // indirect @@ -166,7 +168,6 @@ require ( github.com/stretchr/objx v0.3.0 // indirect github.com/tinylib/msgp v1.1.0 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect - github.com/twmb/murmur3 v1.1.6 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.etcd.io/etcd/client/v2 v2.306.0-alpha.0 // indirect diff --git a/go.sum b/go.sum index 03e1b6a240..6467f0df4b 100644 --- a/go.sum +++ b/go.sum @@ -237,6 +237,7 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b h1:AP/Y7sqYicnjGDfD5VcY4CIfh1hRXBUavxrvELjTiOE= +github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bonitoo-io/go-sql-bigquery v0.3.4-1.4.0/go.mod h1:J4Y6YJm0qTWB9aFziB7cPeSyc6dOZFyJdteSeybVpXQ= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= @@ -259,6 +260,7 @@ github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= @@ -287,8 +289,11 @@ github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490 h1:KwaoQzs/WeUxxJqiJsZ github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 h1:xD/lrqdvwsc+O2bjSSi3YqY73Ke3LAiSCx49aCesA0E= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= github.com/cockroachdb/errors v1.2.4 h1:Lap807SXTH5tri2TivECb/4abUkMZC9zRoLarvcKDqs= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= @@ -496,6 +501,7 @@ github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXt github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -540,6 +546,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -1312,6 +1319,7 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prashantv/protectmem v0.0.0-20171002184600-e20412882b3a h1:AA9vgIBDjMHPC2McaGPojgV2dcI78ZC0TLNhYCXEKH8= +github.com/prashantv/protectmem v0.0.0-20171002184600-e20412882b3a/go.mod h1:lzZQ3Noex5pfAy7mkAeCjcBDteYU85uWWnJ/y6gKU8k= github.com/prometheus/alertmanager v0.20.0/go.mod h1:9g2i48FAyZW6BtbsnvHtMHQXl2aVtrORKwKVCQ+nbrg= github.com/prometheus/alertmanager v0.23.0/go.mod h1:0MLTrjQI8EuVmvykEhcfr/7X0xmaDAZrqMgxIq3OXHk= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -1474,6 +1482,7 @@ github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/streadway/quantile v0.0.0-20220407130108-4246515d968d h1:X4+kt6zM/OVO6gbJdAfJR60MGPsqCzbtXNnjoGqdfAs= +github.com/streadway/quantile v0.0.0-20220407130108-4246515d968d/go.mod h1:lbP8tGiBjZ5YWIc2fzuRpTaz0b/53vT6PEs3QuAWzuU= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1492,7 +1501,9 @@ github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo= +github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ= +github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= @@ -1992,6 +2003,7 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/scripts/comparator/compare.go b/scripts/comparator/compare.go index eee6ce1cfc..9ebbc38a06 100644 --- a/scripts/comparator/compare.go +++ b/scripts/comparator/compare.go @@ -31,12 +31,12 @@ import ( "os" "time" + "go.uber.org/zap" + "github.com/m3db/m3/scripts/comparator/utils" "github.com/m3db/m3/src/query/api/v1/handler/prometheus" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) func paramError(err string, log *zap.Logger) { diff --git a/scripts/comparator/grafana/generate_dash.go b/scripts/comparator/grafana/generate_dash.go index 0079e4709a..7aedc9c66a 100644 --- a/scripts/comparator/grafana/generate_dash.go +++ b/scripts/comparator/grafana/generate_dash.go @@ -26,10 +26,10 @@ import ( "text/template" "time" + "go.uber.org/zap" + "github.com/m3db/m3/scripts/comparator/utils" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) // TemplateData is a collection of template data. diff --git a/scripts/comparator/utils/compare_utilities_regression.go b/scripts/comparator/utils/compare_utilities_regression.go index 8482271839..4eb2bcc8d1 100644 --- a/scripts/comparator/utils/compare_utilities_regression.go +++ b/scripts/comparator/utils/compare_utilities_regression.go @@ -28,9 +28,9 @@ import ( "os" "path/filepath" - "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" ) // RegressionQuery is the JSON representation of a query to be compared. diff --git a/scripts/thriftgen.Dockerfile b/scripts/thriftgen.Dockerfile index 91edd88d8d..319f1d9815 100644 --- a/scripts/thriftgen.Dockerfile +++ b/scripts/thriftgen.Dockerfile @@ -1,7 +1,7 @@ # built artifacts maintained externally at https://quay.io/repository/m3db/thrift-gen # stage 1: build thrift-gen binary -FROM golang:1.17-alpine3.15 AS thriftgen +FROM golang:1.22-alpine3.20 AS thriftgen LABEL maintainer="The M3DB Authors " # install git diff --git a/src/aggregator/aggregation/common_test.go b/src/aggregator/aggregation/common_test.go index b5c63d7b2d..a0ed98630f 100644 --- a/src/aggregator/aggregation/common_test.go +++ b/src/aggregator/aggregation/common_test.go @@ -23,9 +23,9 @@ package aggregation import ( "testing" - "github.com/m3db/m3/src/metrics/aggregation" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/metrics/aggregation" ) func TestStdev(t *testing.T) { diff --git a/src/aggregator/aggregation/counter_test.go b/src/aggregator/aggregation/counter_test.go index 0a284bb491..d9126ac6c0 100644 --- a/src/aggregator/aggregation/counter_test.go +++ b/src/aggregator/aggregation/counter_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestCounterDefaultAggregationType(t *testing.T) { diff --git a/src/aggregator/aggregation/gauge_test.go b/src/aggregator/aggregation/gauge_test.go index 2fb891edf8..c5277f7875 100644 --- a/src/aggregator/aggregation/gauge_test.go +++ b/src/aggregator/aggregation/gauge_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/metrics/aggregation" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/metrics/aggregation" + "github.com/m3db/m3/src/x/instrument" ) func TestGaugeDefaultAggregationType(t *testing.T) { diff --git a/src/aggregator/aggregation/options.go b/src/aggregator/aggregation/options.go index a981e879da..0b3a68d499 100644 --- a/src/aggregator/aggregation/options.go +++ b/src/aggregator/aggregation/options.go @@ -21,10 +21,10 @@ package aggregation import ( + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/x/instrument" - - "github.com/uber-go/tally" ) var ( diff --git a/src/aggregator/aggregation/options_test.go b/src/aggregator/aggregation/options_test.go index e216b045ef..935f61d827 100644 --- a/src/aggregator/aggregation/options_test.go +++ b/src/aggregator/aggregation/options_test.go @@ -23,10 +23,10 @@ package aggregation import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestOptions(t *testing.T) { diff --git a/src/aggregator/aggregation/timer_test.go b/src/aggregator/aggregation/timer_test.go index e80c8d1b5a..83f834c723 100644 --- a/src/aggregator/aggregation/timer_test.go +++ b/src/aggregator/aggregation/timer_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation/quantile/cm" "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/aggregator/aggregation_key_test.go b/src/aggregator/aggregator/aggregation_key_test.go index b686bb867b..5864a6ee3a 100644 --- a/src/aggregator/aggregator/aggregation_key_test.go +++ b/src/aggregator/aggregator/aggregation_key_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/pipeline/applied" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestAggregationKeyEqual(t *testing.T) { diff --git a/src/aggregator/aggregator/aggregation_test.go b/src/aggregator/aggregator/aggregation_test.go index ef727da93b..8da9b1c211 100644 --- a/src/aggregator/aggregator/aggregation_test.go +++ b/src/aggregator/aggregator/aggregation_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation" "github.com/m3db/m3/src/aggregator/aggregation/quantile/cm" "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/metric/unaggregated" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/aggregator/aggregator.go b/src/aggregator/aggregator/aggregator.go index d1b858e9c5..05a505818e 100644 --- a/src/aggregator/aggregator/aggregator.go +++ b/src/aggregator/aggregator/aggregator.go @@ -28,6 +28,10 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/client" @@ -43,10 +47,6 @@ import ( "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/uber-go/tally" - "go.uber.org/atomic" - "go.uber.org/zap" ) const ( diff --git a/src/aggregator/aggregator/aggregator_test.go b/src/aggregator/aggregator/aggregator_test.go index 4120c0b58d..02f7756228 100644 --- a/src/aggregator/aggregator/aggregator_test.go +++ b/src/aggregator/aggregator/aggregator_test.go @@ -27,6 +27,13 @@ import ( "testing" "time" + "github.com/gogo/protobuf/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/client" @@ -48,13 +55,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/gogo/protobuf/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/aggregator/aggregator/capture/aggregator_test.go b/src/aggregator/aggregator/capture/aggregator_test.go index 6032b4e0b5..76975cdda0 100644 --- a/src/aggregator/aggregator/capture/aggregator_test.go +++ b/src/aggregator/aggregator/capture/aggregator_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/metric" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/pipeline/applied" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/aggregator/election_mgr.go b/src/aggregator/aggregator/election_mgr.go index 4e9e8840fc..ab5ed0a235 100644 --- a/src/aggregator/aggregator/election_mgr.go +++ b/src/aggregator/aggregator/election_mgr.go @@ -29,15 +29,15 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/services/leader/campaign" "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/retry" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // ElectionManager manages leadership elections. diff --git a/src/aggregator/aggregator/election_mgr_test.go b/src/aggregator/aggregator/election_mgr_test.go index 07dd3b63e2..2a7924a5af 100644 --- a/src/aggregator/aggregator/election_mgr_test.go +++ b/src/aggregator/aggregator/election_mgr_test.go @@ -29,15 +29,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/services/leader/campaign" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/retry" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestElectionStateJSONMarshal(t *testing.T) { diff --git a/src/aggregator/aggregator/elem_base.go b/src/aggregator/aggregator/elem_base.go index ea06c93b04..3c3d939023 100644 --- a/src/aggregator/aggregator/elem_base.go +++ b/src/aggregator/aggregator/elem_base.go @@ -27,6 +27,10 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/willf/bitset" + "go.uber.org/zap" + raggregation "github.com/m3db/m3/src/aggregator/aggregation" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "github.com/willf/bitset" - "go.uber.org/zap" ) const ( @@ -662,12 +662,12 @@ type parsedPipeline struct { // parsePipeline parses the given pipeline and returns an error if the pipeline is invalid. // A valid pipeline should take the form of one of the following: -// * Empty pipeline with no operations. -// * Pipeline that starts with a rollup operation. -// * Pipeline that starts with a transformation operation and contains at least one -// rollup operation. Additionally, the transformation derivative order computed from -// the list of transformations must be no more than the maximum transformation derivative -// order that is supported. +// - Empty pipeline with no operations. +// - Pipeline that starts with a rollup operation. +// - Pipeline that starts with a transformation operation and contains at least one +// rollup operation. Additionally, the transformation derivative order computed from +// the list of transformations must be no more than the maximum transformation derivative +// order that is supported. func newParsedPipeline(pipeline applied.Pipeline) (parsedPipeline, error) { if pipeline.IsEmpty() { return parsedPipeline{}, nil diff --git a/src/aggregator/aggregator/elem_base_test.go b/src/aggregator/aggregator/elem_base_test.go index e9f16f29b6..57f8a7a8c6 100644 --- a/src/aggregator/aggregator/elem_base_test.go +++ b/src/aggregator/aggregator/elem_base_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + raggregation "github.com/m3db/m3/src/aggregator/aggregation" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metric" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/metrics/pipeline/applied" "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/x/clock" - - "github.com/stretchr/testify/require" ) func mustNewOp(t require.TestingT, ttype transformation.Type) transformation.Op { diff --git a/src/aggregator/aggregator/elem_pool_test.go b/src/aggregator/aggregator/elem_pool_test.go index 48cbf42a65..9d8bb672a7 100644 --- a/src/aggregator/aggregator/elem_pool_test.go +++ b/src/aggregator/aggregator/elem_pool_test.go @@ -23,9 +23,9 @@ package aggregator import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestCounterElemPool(t *testing.T) { diff --git a/src/aggregator/aggregator/elem_test.go b/src/aggregator/aggregator/elem_test.go index 44b6b9a26a..5b419bfdd9 100644 --- a/src/aggregator/aggregator/elem_test.go +++ b/src/aggregator/aggregator/elem_test.go @@ -26,6 +26,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/willf/bitset" + "go.uber.org/atomic" + raggregation "github.com/m3db/m3/src/aggregator/aggregation" "github.com/m3db/m3/src/aggregator/aggregation/quantile/cm" maggregation "github.com/m3db/m3/src/metrics/aggregation" @@ -40,12 +46,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "github.com/willf/bitset" - "go.uber.org/atomic" ) var ( diff --git a/src/aggregator/aggregator/entry.go b/src/aggregator/aggregator/entry.go index 6cf4f2cc63..4fc2c34316 100644 --- a/src/aggregator/aggregator/entry.go +++ b/src/aggregator/aggregator/entry.go @@ -27,6 +27,9 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "github.com/m3db/m3/src/aggregator/bitset" "github.com/m3db/m3/src/aggregator/rate" "github.com/m3db/m3/src/aggregator/runtime" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/atomic" ) const ( @@ -184,6 +184,7 @@ type entryMetrics struct { } // NewEntryMetrics creates new entry metrics. +// //nolint:golint,revive func NewEntryMetrics(scope tally.Scope) *entryMetrics { scope = scope.SubScope("entry") diff --git a/src/aggregator/aggregator/entry_pool_test.go b/src/aggregator/aggregator/entry_pool_test.go index 994e1e9b9d..fe6858c3cf 100644 --- a/src/aggregator/aggregator/entry_pool_test.go +++ b/src/aggregator/aggregator/entry_pool_test.go @@ -23,10 +23,10 @@ package aggregator import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestEntryPool(t *testing.T) { diff --git a/src/aggregator/aggregator/entry_test.go b/src/aggregator/aggregator/entry_test.go index be98f28e69..e6f3471b47 100644 --- a/src/aggregator/aggregator/entry_test.go +++ b/src/aggregator/aggregator/entry_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -42,10 +46,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( @@ -1467,7 +1467,7 @@ func TestEntryAddTimedEntryClosed(t *testing.T) { require.Equal(t, errEntryClosed, e.AddTimed(testTimedMetric, testTimedMetadata)) } -//nolint: dupl +// nolint: dupl func TestEntryAddTimedMetricTooLate(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() diff --git a/src/aggregator/aggregator/flush_mgr_test.go b/src/aggregator/aggregator/flush_mgr_test.go index 50a81faa7c..4f8246c057 100644 --- a/src/aggregator/aggregator/flush_mgr_test.go +++ b/src/aggregator/aggregator/flush_mgr_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/clock" - "github.com/m3db/m3/src/x/watch" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/clock" + "github.com/m3db/m3/src/x/watch" ) func TestFlushManagerReset(t *testing.T) { diff --git a/src/aggregator/aggregator/flush_times_mgr.go b/src/aggregator/aggregator/flush_times_mgr.go index 4683179034..2edaa38ce3 100644 --- a/src/aggregator/aggregator/flush_times_mgr.go +++ b/src/aggregator/aggregator/flush_times_mgr.go @@ -25,15 +25,15 @@ import ( "fmt" "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) type getFlushTimesByResolutionFn func(*schema.ShardFlushTimes) map[int64]int64 diff --git a/src/aggregator/aggregator/flush_times_mgr_test.go b/src/aggregator/aggregator/flush_times_mgr_test.go index ce28a63901..099ccc4be9 100644 --- a/src/aggregator/aggregator/flush_times_mgr_test.go +++ b/src/aggregator/aggregator/flush_times_mgr_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) const ( diff --git a/src/aggregator/aggregator/follower_flush_mgr.go b/src/aggregator/aggregator/follower_flush_mgr.go index 1adaf92498..b76aafa731 100644 --- a/src/aggregator/aggregator/follower_flush_mgr.go +++ b/src/aggregator/aggregator/follower_flush_mgr.go @@ -24,13 +24,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/x/clock" xsync "github.com/m3db/m3/src/x/sync" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) type standardFollowerFlusherMetrics struct { diff --git a/src/aggregator/aggregator/follower_flush_mgr_test.go b/src/aggregator/aggregator/follower_flush_mgr_test.go index a74eb0c5bf..5d957fb3e0 100644 --- a/src/aggregator/aggregator/follower_flush_mgr_test.go +++ b/src/aggregator/aggregator/follower_flush_mgr_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/watch" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestFollowerFlushManagerOpen(t *testing.T) { diff --git a/src/aggregator/aggregator/forwarded_writer.go b/src/aggregator/aggregator/forwarded_writer.go index 29233efaad..ced0936f48 100644 --- a/src/aggregator/aggregator/forwarded_writer.go +++ b/src/aggregator/aggregator/forwarded_writer.go @@ -24,6 +24,9 @@ import ( "errors" "fmt" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "github.com/m3db/m3/src/aggregator/aggregation" "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/aggregator/hash" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/atomic" ) var ( diff --git a/src/aggregator/aggregator/forwarded_writer_test.go b/src/aggregator/aggregator/forwarded_writer_test.go index 43b5b694df..188d538984 100644 --- a/src/aggregator/aggregator/forwarded_writer_test.go +++ b/src/aggregator/aggregator/forwarded_writer_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -34,10 +38,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var testForwardedWriterAggregationKey = aggregationKey{ diff --git a/src/aggregator/aggregator/generic_elem.go b/src/aggregator/aggregator/generic_elem.go index 0d53fec568..bff8ea89c1 100644 --- a/src/aggregator/aggregator/generic_elem.go +++ b/src/aggregator/aggregator/generic_elem.go @@ -26,6 +26,10 @@ import ( "sync" "time" + "github.com/mauricelam/genny/generic" + "github.com/willf/bitset" + "go.uber.org/zap" + raggregation "github.com/m3db/m3/src/aggregator/aggregation" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/mauricelam/genny/generic" - "github.com/willf/bitset" - "go.uber.org/zap" ) type typeSpecificAggregation interface { @@ -237,7 +237,7 @@ func (e *GenericElem) AddValue(timestamp time.Time, value float64, annotation [] // AddUnique adds a metric value from a given source at a given timestamp. // If previous values from the same source have already been added to the // same aggregation, the incoming value is discarded. -//nolint: dupl +// nolint: dupl func (e *GenericElem) AddUnique( timestamp time.Time, metric aggregated.ForwardedMetric, @@ -682,7 +682,7 @@ func (e *GenericElem) insertDirty(alignedStart xtime.UnixNano) { } // find finds the aggregation for a given time, or returns nil. -//nolint: dupl +// nolint: dupl func (e *GenericElem) find(alignedStartNanos xtime.UnixNano) (timedAggregation, error) { e.RLock() if e.closed { @@ -700,7 +700,7 @@ func (e *GenericElem) find(alignedStartNanos xtime.UnixNano) (timedAggregation, // findOrCreate finds the aggregation for a given time, or creates one // if it doesn't exist. -//nolint: dupl +// nolint: dupl func (e *GenericElem) findOrCreate( alignedStartNanos int64, createOpts createAggregationOptions, diff --git a/src/aggregator/aggregator/handler/blackhole.go b/src/aggregator/aggregator/handler/blackhole.go index 1e303c34f6..96750d0b6c 100644 --- a/src/aggregator/aggregator/handler/blackhole.go +++ b/src/aggregator/aggregator/handler/blackhole.go @@ -21,9 +21,9 @@ package handler import ( - "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" ) type blackholeHandler struct{} diff --git a/src/aggregator/aggregator/handler/broadcast.go b/src/aggregator/aggregator/handler/broadcast.go index 443f109e4f..c350ef53ed 100644 --- a/src/aggregator/aggregator/handler/broadcast.go +++ b/src/aggregator/aggregator/handler/broadcast.go @@ -21,9 +21,9 @@ package handler import ( - "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" ) type broadcastHandler struct { diff --git a/src/aggregator/aggregator/handler/broadcast_test.go b/src/aggregator/aggregator/handler/broadcast_test.go index 15e0b7d437..0c33f43a86 100644 --- a/src/aggregator/aggregator/handler/broadcast_test.go +++ b/src/aggregator/aggregator/handler/broadcast_test.go @@ -24,12 +24,12 @@ import ( "errors" "testing" - "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" - "github.com/m3db/m3/src/metrics/metric/aggregated" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" + "github.com/m3db/m3/src/metrics/metric/aggregated" ) func TestBroadcastHandlerNewWriterSingleHandler(t *testing.T) { diff --git a/src/aggregator/aggregator/handler/config.go b/src/aggregator/aggregator/handler/config.go index eec848dbbe..aff25d1838 100644 --- a/src/aggregator/aggregator/handler/config.go +++ b/src/aggregator/aggregator/handler/config.go @@ -24,6 +24,8 @@ import ( "errors" "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator/handler/filter" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/sharding" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xio "github.com/m3db/m3/src/x/io" "github.com/m3db/m3/src/x/pool" - - "go.uber.org/zap" ) var ( diff --git a/src/aggregator/aggregator/handler/filter/percentageFilter_test.go b/src/aggregator/aggregator/handler/filter/percentageFilter_test.go index 08ef4f7a06..3f848643eb 100644 --- a/src/aggregator/aggregator/handler/filter/percentageFilter_test.go +++ b/src/aggregator/aggregator/handler/filter/percentageFilter_test.go @@ -23,10 +23,10 @@ package filter import ( "testing" - "github.com/m3db/m3/src/msg/producer" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/msg/producer" ) func TestPercentageFilter(t *testing.T) { diff --git a/src/aggregator/aggregator/handler/filter/shard_test.go b/src/aggregator/aggregator/handler/filter/shard_test.go index 63732784ab..d78aa6c188 100644 --- a/src/aggregator/aggregator/handler/filter/shard_test.go +++ b/src/aggregator/aggregator/handler/filter/shard_test.go @@ -23,11 +23,11 @@ package filter import ( "testing" - "github.com/m3db/m3/src/aggregator/sharding" - "github.com/m3db/m3/src/msg/producer" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/aggregator/sharding" + "github.com/m3db/m3/src/msg/producer" ) func TestShardSetFilter(t *testing.T) { diff --git a/src/aggregator/aggregator/handler/handler.go b/src/aggregator/aggregator/handler/handler.go index 28eee60cae..c90b67ac9e 100644 --- a/src/aggregator/aggregator/handler/handler.go +++ b/src/aggregator/aggregator/handler/handler.go @@ -21,9 +21,9 @@ package handler import ( - "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" ) // Handler handles aggregated metrics alongside their policies. diff --git a/src/aggregator/aggregator/handler/logging.go b/src/aggregator/aggregator/handler/logging.go index 062bc5e2e1..a6014b6b47 100644 --- a/src/aggregator/aggregator/handler/logging.go +++ b/src/aggregator/aggregator/handler/logging.go @@ -21,10 +21,10 @@ package handler import ( - "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" - "github.com/uber-go/tally" "go.uber.org/zap" + + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" ) type loggingHandler struct { diff --git a/src/aggregator/aggregator/handler/protobuf.go b/src/aggregator/aggregator/handler/protobuf.go index 625a9fdab4..e52602c111 100644 --- a/src/aggregator/aggregator/handler/protobuf.go +++ b/src/aggregator/aggregator/handler/protobuf.go @@ -21,11 +21,11 @@ package handler import ( + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/sharding" "github.com/m3db/m3/src/msg/producer" - - "github.com/uber-go/tally" ) type protobufHandler struct { diff --git a/src/aggregator/aggregator/handler/protobuf_test.go b/src/aggregator/aggregator/handler/protobuf_test.go index 84ced1f5e3..12a48a6046 100644 --- a/src/aggregator/aggregator/handler/protobuf_test.go +++ b/src/aggregator/aggregator/handler/protobuf_test.go @@ -23,11 +23,11 @@ package handler import ( "testing" + "github.com/golang/mock/gomock" + "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/sharding" "github.com/m3db/m3/src/msg/producer" - - "github.com/golang/mock/gomock" ) func TestProtobufHandler(t *testing.T) { diff --git a/src/aggregator/aggregator/handler/writer/logging.go b/src/aggregator/aggregator/handler/writer/logging.go index 0167ef5c44..974eb9233c 100644 --- a/src/aggregator/aggregator/handler/writer/logging.go +++ b/src/aggregator/aggregator/handler/writer/logging.go @@ -21,9 +21,9 @@ package writer import ( - "github.com/m3db/m3/src/metrics/metric/aggregated" - "go.uber.org/zap" + + "github.com/m3db/m3/src/metrics/metric/aggregated" ) type loggingWriter struct { diff --git a/src/aggregator/aggregator/handler/writer/multi_test.go b/src/aggregator/aggregator/handler/writer/multi_test.go index b53aa91366..d0afb59eb7 100644 --- a/src/aggregator/aggregator/handler/writer/multi_test.go +++ b/src/aggregator/aggregator/handler/writer/multi_test.go @@ -24,10 +24,10 @@ import ( "errors" "testing" - "github.com/m3db/m3/src/metrics/metric/aggregated" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/metrics/metric/aggregated" ) func TestMultiWriterWriteNoError(t *testing.T) { diff --git a/src/aggregator/aggregator/handler/writer/protobuf.go b/src/aggregator/aggregator/handler/writer/protobuf.go index 2ab738c10a..11e767916a 100644 --- a/src/aggregator/aggregator/handler/writer/protobuf.go +++ b/src/aggregator/aggregator/handler/writer/protobuf.go @@ -23,13 +23,13 @@ package writer import ( "errors" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/sharding" "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/msg/producer" - - "github.com/uber-go/tally" ) var ( diff --git a/src/aggregator/aggregator/handler/writer/protobuf_test.go b/src/aggregator/aggregator/handler/writer/protobuf_test.go index 2e67f2e813..f0331d1f7c 100644 --- a/src/aggregator/aggregator/handler/writer/protobuf_test.go +++ b/src/aggregator/aggregator/handler/writer/protobuf_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/sharding" "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/metric/aggregated" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/msg/producer" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/aggregator/handler/writer/sharded.go b/src/aggregator/aggregator/handler/writer/sharded.go index 6bfbf58963..03695dfdd6 100644 --- a/src/aggregator/aggregator/handler/writer/sharded.go +++ b/src/aggregator/aggregator/handler/writer/sharded.go @@ -23,12 +23,12 @@ package writer import ( "sync" + "github.com/pkg/errors" + "github.com/m3db/m3/src/aggregator/sharding" "github.com/m3db/m3/src/metrics/metric/aggregated" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/pkg/errors" ) var ( diff --git a/src/aggregator/aggregator/handler/writer/sharded_test.go b/src/aggregator/aggregator/handler/writer/sharded_test.go index a07e4d288d..a9deeb87af 100644 --- a/src/aggregator/aggregator/handler/writer/sharded_test.go +++ b/src/aggregator/aggregator/handler/writer/sharded_test.go @@ -23,13 +23,13 @@ package writer import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestNewShardedWriter(t *testing.T) { diff --git a/src/aggregator/aggregator/leader_flush_mgr.go b/src/aggregator/aggregator/leader_flush_mgr.go index b835b448f7..ba7d4059b3 100644 --- a/src/aggregator/aggregator/leader_flush_mgr.go +++ b/src/aggregator/aggregator/leader_flush_mgr.go @@ -24,13 +24,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/clock" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/aggregator/aggregator/leader_flush_mgr_test.go b/src/aggregator/aggregator/leader_flush_mgr_test.go index 988ed3af12..6401b60c10 100644 --- a/src/aggregator/aggregator/leader_flush_mgr_test.go +++ b/src/aggregator/aggregator/leader_flush_mgr_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" - schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" - "github.com/m3db/m3/src/cluster/shard" - xtest "github.com/m3db/m3/src/x/test" - "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + schema "github.com/m3db/m3/src/aggregator/generated/proto/flush" + "github.com/m3db/m3/src/cluster/shard" + xtest "github.com/m3db/m3/src/x/test" ) var ( diff --git a/src/aggregator/aggregator/list.go b/src/aggregator/aggregator/list.go index 83871469a0..f49ccdaad6 100644 --- a/src/aggregator/aggregator/list.go +++ b/src/aggregator/aggregator/list.go @@ -28,6 +28,9 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/metrics/metric/aggregated" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/aggregator/aggregator/list_test.go b/src/aggregator/aggregator/list_test.go index 792ba4d7b6..6185825cd0 100644 --- a/src/aggregator/aggregator/list_test.go +++ b/src/aggregator/aggregator/list_test.go @@ -28,6 +28,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/aggregator/client" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/pipeline/applied" "github.com/m3db/m3/src/x/clock" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestBaseMetricListPushBackElemWithDefaultPipeline(t *testing.T) { diff --git a/src/aggregator/aggregator/map.go b/src/aggregator/aggregator/map.go index 3b8c8b2213..e9c0b96019 100644 --- a/src/aggregator/aggregator/map.go +++ b/src/aggregator/aggregator/map.go @@ -27,6 +27,8 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/hash" "github.com/m3db/m3/src/aggregator/rate" "github.com/m3db/m3/src/aggregator/runtime" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/x/clock" xresource "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) const ( diff --git a/src/aggregator/aggregator/map_test.go b/src/aggregator/aggregator/map_test.go index d913d15941..71c6d3079a 100644 --- a/src/aggregator/aggregator/map_test.go +++ b/src/aggregator/aggregator/map_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/hash" "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/metrics/aggregation" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/aggregator/options_test.go b/src/aggregator/aggregator/options_test.go index 9cdd9330dc..c8410cf95b 100644 --- a/src/aggregator/aggregator/options_test.go +++ b/src/aggregator/aggregator/options_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation/quantile/cm" "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func validateDerivedPrefix( diff --git a/src/aggregator/aggregator/placement_mgr.go b/src/aggregator/aggregator/placement_mgr.go index 2950f08a35..0e4737468f 100644 --- a/src/aggregator/aggregator/placement_mgr.go +++ b/src/aggregator/aggregator/placement_mgr.go @@ -24,11 +24,11 @@ import ( "errors" "sync" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/clock" - - "github.com/uber-go/tally" ) var ( diff --git a/src/aggregator/aggregator/placement_mgr_test.go b/src/aggregator/aggregator/placement_mgr_test.go index 539f05753e..498fa49a72 100644 --- a/src/aggregator/aggregator/placement_mgr_test.go +++ b/src/aggregator/aggregator/placement_mgr_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/aggregator/aggregator/shard.go b/src/aggregator/aggregator/shard.go index 2855c8380a..165ee1f3be 100644 --- a/src/aggregator/aggregator/shard.go +++ b/src/aggregator/aggregator/shard.go @@ -27,12 +27,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/metric/unaggregated" "github.com/m3db/m3/src/x/clock" - - "github.com/uber-go/tally" ) var ( diff --git a/src/aggregator/aggregator/shard_test.go b/src/aggregator/aggregator/shard_test.go index 50fd505e65..12b03f901b 100644 --- a/src/aggregator/aggregator/shard_test.go +++ b/src/aggregator/aggregator/shard_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/metric/unaggregated" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/client/config.go b/src/aggregator/client/config.go index be7500d9bb..a3779df345 100644 --- a/src/aggregator/client/config.go +++ b/src/aggregator/client/config.go @@ -25,6 +25,8 @@ import ( "fmt" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/sharding" m3clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" @@ -37,8 +39,6 @@ import ( "github.com/m3db/m3/src/x/net" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" ) var errNoM3MsgOptions = errors.New("m3msg aggregator client: missing m3msg options") diff --git a/src/aggregator/client/config_test.go b/src/aggregator/client/config_test.go index 3f765f4874..7ec1276b7a 100644 --- a/src/aggregator/client/config_test.go +++ b/src/aggregator/client/config_test.go @@ -24,6 +24,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/aggregator/sharding" m3clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xio "github.com/m3db/m3/src/x/io" "github.com/m3db/m3/src/x/pool" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) var testClientConfig = ` diff --git a/src/aggregator/client/conn.go b/src/aggregator/client/conn.go index 705ff1d48f..8fa1e4b7e5 100644 --- a/src/aggregator/client/conn.go +++ b/src/aggregator/client/conn.go @@ -28,12 +28,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/x/clock" xio "github.com/m3db/m3/src/x/io" xnet "github.com/m3db/m3/src/x/net" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" ) const ( diff --git a/src/aggregator/client/conn_test.go b/src/aggregator/client/conn_test.go index 6c1e6b330d..c868ca6098 100644 --- a/src/aggregator/client/conn_test.go +++ b/src/aggregator/client/conn_test.go @@ -30,14 +30,14 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/clock" - "github.com/golang/mock/gomock" "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/clock" ) const ( diff --git a/src/aggregator/client/m3msg_client.go b/src/aggregator/client/m3msg_client.go index e69c9a054b..b4d297cd86 100644 --- a/src/aggregator/client/m3msg_client.go +++ b/src/aggregator/client/m3msg_client.go @@ -319,6 +319,7 @@ func newMessage(pool *messagePool) *message { } // Encode encodes a m3msg payload +// //nolint:gocyclo,gocritic func (m *message) Encode( shard uint32, diff --git a/src/aggregator/client/queue.go b/src/aggregator/client/queue.go index 63ff4c555e..32c6444450 100644 --- a/src/aggregator/client/queue.go +++ b/src/aggregator/client/queue.go @@ -28,12 +28,12 @@ import ( "strings" "sync" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/metrics/encoding/protobuf" - "github.com/uber-go/tally" "go.uber.org/atomic" "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/metrics/encoding/protobuf" ) const ( diff --git a/src/aggregator/client/writer.go b/src/aggregator/client/writer.go index 8bc9466f41..078d511ef7 100644 --- a/src/aggregator/client/writer.go +++ b/src/aggregator/client/writer.go @@ -24,6 +24,10 @@ import ( "errors" "sync" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/encoding" "github.com/m3db/m3/src/metrics/encoding/protobuf" @@ -33,10 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/metric/unaggregated" "github.com/m3db/m3/src/metrics/policy" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/uber-go/tally" - "go.uber.org/atomic" - "go.uber.org/zap" ) var ( diff --git a/src/aggregator/client/writer_benchmark_test.go b/src/aggregator/client/writer_benchmark_test.go index 50c6a3ef43..49e5e57a36 100644 --- a/src/aggregator/client/writer_benchmark_test.go +++ b/src/aggregator/client/writer_benchmark_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/metric/unaggregated" - - "github.com/uber-go/tally" ) var ( diff --git a/src/aggregator/client/writer_mgr.go b/src/aggregator/client/writer_mgr.go index 49710201e0..aea69d4370 100644 --- a/src/aggregator/client/writer_mgr.go +++ b/src/aggregator/client/writer_mgr.go @@ -26,12 +26,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "golang.org/x/sys/cpu" + "github.com/m3db/m3/src/cluster/placement" xerrors "github.com/m3db/m3/src/x/errors" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber-go/tally" - "golang.org/x/sys/cpu" ) var ( diff --git a/src/aggregator/client/writer_test.go b/src/aggregator/client/writer_test.go index 8c6ca9bef4..64395939c5 100644 --- a/src/aggregator/client/writer_test.go +++ b/src/aggregator/client/writer_test.go @@ -32,6 +32,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/encoding" "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/metadata" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/metrics/metric/unaggregated" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestWriterWriteClosed(t *testing.T) { diff --git a/src/aggregator/integration/custom_aggregations_test.go b/src/aggregator/integration/custom_aggregations_test.go index 6bae441f46..a423a1e72f 100644 --- a/src/aggregator/integration/custom_aggregations_test.go +++ b/src/aggregator/integration/custom_aggregations_test.go @@ -27,11 +27,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metric/aggregated" - - "github.com/stretchr/testify/require" ) func TestCustomAggregationWithStagedMetadatas(t *testing.T) { diff --git a/src/aggregator/integration/election.go b/src/aggregator/integration/election.go index 146055078d..96273059ad 100644 --- a/src/aggregator/integration/election.go +++ b/src/aggregator/integration/election.go @@ -23,12 +23,12 @@ package integration import ( "testing" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/services/leader" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" - "github.com/stretchr/testify/require" - clientv3 "go.etcd.io/etcd/client/v3" ) var ( diff --git a/src/aggregator/integration/integration_data.go b/src/aggregator/integration/integration_data.go index a3459794cc..0f874f9716 100644 --- a/src/aggregator/integration/integration_data.go +++ b/src/aggregator/integration/integration_data.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation" "github.com/m3db/m3/src/aggregator/aggregator" maggregation "github.com/m3db/m3/src/metrics/aggregation" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/integration/metadata_change_test.go b/src/aggregator/integration/metadata_change_test.go index 9822579101..f1bc80e21e 100644 --- a/src/aggregator/integration/metadata_change_test.go +++ b/src/aggregator/integration/metadata_change_test.go @@ -27,10 +27,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/metric/aggregated" - - "github.com/stretchr/testify/require" ) func TestMetadataChangeWithStagedMetadatas(t *testing.T) { diff --git a/src/aggregator/integration/multi_client_one_type_test.go b/src/aggregator/integration/multi_client_one_type_test.go index 2af620205f..741c69e832 100644 --- a/src/aggregator/integration/multi_client_one_type_test.go +++ b/src/aggregator/integration/multi_client_one_type_test.go @@ -27,10 +27,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/metric" - - "github.com/stretchr/testify/require" ) func TestMultiClientOneTypeWithStagedMetadatas(t *testing.T) { diff --git a/src/aggregator/integration/multi_server_follower_health_init_test.go b/src/aggregator/integration/multi_server_follower_health_init_test.go index 7584da265c..8cd7564d10 100644 --- a/src/aggregator/integration/multi_server_follower_health_init_test.go +++ b/src/aggregator/integration/multi_server_follower_health_init_test.go @@ -28,11 +28,11 @@ import ( "sync/atomic" "testing" - httpserver "github.com/m3db/m3/src/aggregator/server/http" - xtest "github.com/m3db/m3/src/x/test" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + httpserver "github.com/m3db/m3/src/aggregator/server/http" + xtest "github.com/m3db/m3/src/x/test" ) func TestMultiServerFollowerHealthInit(t *testing.T) { diff --git a/src/aggregator/integration/multi_server_forwarding_pipeline_test.go b/src/aggregator/integration/multi_server_forwarding_pipeline_test.go index 679e0f1875..0eed12952f 100644 --- a/src/aggregator/integration/multi_server_forwarding_pipeline_test.go +++ b/src/aggregator/integration/multi_server_forwarding_pipeline_test.go @@ -31,6 +31,9 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -42,9 +45,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" ) func TestMultiServerForwardingPipelineKeepNaNAggregatedValues(t *testing.T) { diff --git a/src/aggregator/integration/multi_server_resend_test.go b/src/aggregator/integration/multi_server_resend_test.go index 466bf078a8..5ff2a58fbc 100644 --- a/src/aggregator/integration/multi_server_resend_test.go +++ b/src/aggregator/integration/multi_server_resend_test.go @@ -31,6 +31,9 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregation" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" @@ -42,9 +45,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" ) //nolint:dupl diff --git a/src/aggregator/integration/one_client_multi_type_forwarded_test.go b/src/aggregator/integration/one_client_multi_type_forwarded_test.go index 039eeae391..9fefc68e84 100644 --- a/src/aggregator/integration/one_client_multi_type_forwarded_test.go +++ b/src/aggregator/integration/one_client_multi_type_forwarded_test.go @@ -26,13 +26,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestOneClientMultiTypeForwardedMetrics(t *testing.T) { diff --git a/src/aggregator/integration/one_client_multi_type_timed_test.go b/src/aggregator/integration/one_client_multi_type_timed_test.go index 80f8d6ec3f..1c8506300b 100644 --- a/src/aggregator/integration/one_client_multi_type_timed_test.go +++ b/src/aggregator/integration/one_client_multi_type_timed_test.go @@ -26,13 +26,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" maggregation "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestOneClientMultiTypeTimedMetrics(t *testing.T) { diff --git a/src/aggregator/integration/one_client_multi_type_untimed_test.go b/src/aggregator/integration/one_client_multi_type_untimed_test.go index 0adc3a5c2d..5eb254c52b 100644 --- a/src/aggregator/integration/one_client_multi_type_untimed_test.go +++ b/src/aggregator/integration/one_client_multi_type_untimed_test.go @@ -26,9 +26,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" ) const ( diff --git a/src/aggregator/integration/one_client_passthru_test.go b/src/aggregator/integration/one_client_passthru_test.go index 489730a123..d3e93fe4da 100644 --- a/src/aggregator/integration/one_client_passthru_test.go +++ b/src/aggregator/integration/one_client_passthru_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + aggclient "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestOneClientPassthroughMetrics(t *testing.T) { 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 c44d35fd91..2dd28838ba 100644 --- a/src/aggregator/integration/one_client_r2_preserve_original_test.go +++ b/src/aggregator/integration/one_client_r2_preserve_original_test.go @@ -27,15 +27,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/metric" "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" ) // TestOriginalMetricIsPreservedOnlyWithDefaultPipeline test emits two unique diff --git a/src/aggregator/integration/options.go b/src/aggregator/integration/options.go index 9b26147e08..dd8417a327 100644 --- a/src/aggregator/integration/options.go +++ b/src/aggregator/integration/options.go @@ -24,6 +24,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" aggclient "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/aggregator/sharding" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/aggregator/integration/placement.go b/src/aggregator/integration/placement.go index 919ad81f06..91c5733f1f 100644 --- a/src/aggregator/integration/placement.go +++ b/src/aggregator/integration/placement.go @@ -24,12 +24,12 @@ import ( "math" "testing" + "github.com/stretchr/testify/require" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" - - "github.com/stretchr/testify/require" ) type placementInstanceConfig struct { diff --git a/src/aggregator/integration/placement_change_test.go b/src/aggregator/integration/placement_change_test.go index 9f798b0ee1..0ba507b7ad 100644 --- a/src/aggregator/integration/placement_change_test.go +++ b/src/aggregator/integration/placement_change_test.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + aggclient "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/cluster/kv" memcluster "github.com/m3db/m3/src/cluster/mem" @@ -38,10 +42,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/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestPlacementChange(t *testing.T) { diff --git a/src/aggregator/integration/resend_stress_test.go b/src/aggregator/integration/resend_stress_test.go index e4934bf1db..411c551ffe 100644 --- a/src/aggregator/integration/resend_stress_test.go +++ b/src/aggregator/integration/resend_stress_test.go @@ -28,6 +28,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" aggclient "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/cluster/placement" @@ -44,11 +46,9 @@ 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" ) -//nolint +// nolint func TestResendAggregatedValueStress(t *testing.T) { if testing.Short() { t.SkipNow() diff --git a/src/aggregator/integration/same_id_multi_type_test.go b/src/aggregator/integration/same_id_multi_type_test.go index fe6b70d999..038ca9f607 100644 --- a/src/aggregator/integration/same_id_multi_type_test.go +++ b/src/aggregator/integration/same_id_multi_type_test.go @@ -26,10 +26,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/metrics/metric" - - "github.com/stretchr/testify/require" ) func TestSameIDMultiTypeWithStagedMetadatas(t *testing.T) { diff --git a/src/aggregator/integration/setup.go b/src/aggregator/integration/setup.go index 80eea426b2..4fbb885c7c 100644 --- a/src/aggregator/integration/setup.go +++ b/src/aggregator/integration/setup.go @@ -31,6 +31,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" @@ -56,10 +60,6 @@ import ( "github.com/m3db/m3/src/x/retry" xserver "github.com/m3db/m3/src/x/server" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/aggregator/integration/topic.go b/src/aggregator/integration/topic.go index 3a6d82b5e5..a83ae7b82e 100644 --- a/src/aggregator/integration/topic.go +++ b/src/aggregator/integration/topic.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/msg/topic" - - "github.com/stretchr/testify/require" ) func initializeTopic( diff --git a/src/aggregator/server/m3msg/server.go b/src/aggregator/server/m3msg/server.go index 467ff6e5c8..3fec8ebc4a 100644 --- a/src/aggregator/server/m3msg/server.go +++ b/src/aggregator/server/m3msg/server.go @@ -23,14 +23,14 @@ package m3msg import ( "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/metrics/encoding" "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" "github.com/m3db/m3/src/msg/consumer" xserver "github.com/m3db/m3/src/x/server" - - "go.uber.org/zap" ) // NewServer creates a new M3Msg server. diff --git a/src/aggregator/server/rawtcp/server.go b/src/aggregator/server/rawtcp/server.go index b1e76f3658..b22f75fb0a 100644 --- a/src/aggregator/server/rawtcp/server.go +++ b/src/aggregator/server/rawtcp/server.go @@ -28,6 +28,9 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/rate" "github.com/m3db/m3/src/metrics/encoding" @@ -39,9 +42,6 @@ import ( xio "github.com/m3db/m3/src/x/io" xserver "github.com/m3db/m3/src/x/server" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/aggregator/server/rawtcp/server_test.go b/src/aggregator/server/rawtcp/server_test.go index 9be15c2145..d2d61c81e4 100644 --- a/src/aggregator/server/rawtcp/server_test.go +++ b/src/aggregator/server/rawtcp/server_test.go @@ -27,6 +27,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zaptest/observer" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/aggregator/capture" "github.com/m3db/m3/src/metrics/aggregation" @@ -45,14 +53,6 @@ import ( xserver "github.com/m3db/m3/src/x/server" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "go.uber.org/zap/zaptest/observer" ) const ( diff --git a/src/aggregator/server/server.go b/src/aggregator/server/server.go index e53511a495..23f54e3446 100644 --- a/src/aggregator/server/server.go +++ b/src/aggregator/server/server.go @@ -28,6 +28,8 @@ import ( "syscall" "time" + "go.uber.org/zap" + m3aggregator "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/cmd/services/m3aggregator/config" "github.com/m3db/m3/src/cmd/services/m3aggregator/serve" @@ -35,8 +37,6 @@ import ( xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/instrument" xos "github.com/m3db/m3/src/x/os" - - "go.uber.org/zap" ) const ( diff --git a/src/aggregator/sharding/hash.go b/src/aggregator/sharding/hash.go index 6172e6a6a4..d93ae85c4a 100644 --- a/src/aggregator/sharding/hash.go +++ b/src/aggregator/sharding/hash.go @@ -24,9 +24,9 @@ import ( "fmt" "strings" - "github.com/m3db/m3/src/metrics/metric/id" - murmur3 "github.com/m3db/stackmurmur3/v2" + + "github.com/m3db/m3/src/metrics/metric/id" ) const ( diff --git a/src/aggregator/sharding/hash_test.go b/src/aggregator/sharding/hash_test.go index 9997f9075a..7d49325613 100644 --- a/src/aggregator/sharding/hash_test.go +++ b/src/aggregator/sharding/hash_test.go @@ -24,10 +24,10 @@ import ( "sync" "testing" - "github.com/m3db/m3/src/metrics/metric/id" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/metrics/metric/id" ) func TestHashTypeUnmarshalYAML(t *testing.T) { diff --git a/src/aggregator/tools/deploy/client_test.go b/src/aggregator/tools/deploy/client_test.go index 8bbd2c41fb..f78a06a160 100644 --- a/src/aggregator/tools/deploy/client_test.go +++ b/src/aggregator/tools/deploy/client_test.go @@ -28,10 +28,10 @@ import ( "net/http" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" httpserver "github.com/m3db/m3/src/aggregator/server/http" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/aggregator/tools/deploy/helper.go b/src/aggregator/tools/deploy/helper.go index ac0c7cd02c..52047a3455 100644 --- a/src/aggregator/tools/deploy/helper.go +++ b/src/aggregator/tools/deploy/helper.go @@ -27,12 +27,12 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/retry" xsync "github.com/m3db/m3/src/x/sync" - - "go.uber.org/zap" ) var ( diff --git a/src/aggregator/tools/deploy/helper_test.go b/src/aggregator/tools/deploy/helper_test.go index 9956df55a1..6ef575aa47 100644 --- a/src/aggregator/tools/deploy/helper_test.go +++ b/src/aggregator/tools/deploy/helper_test.go @@ -27,11 +27,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/x/retry" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/x/retry" ) var ( diff --git a/src/aggregator/tools/deploy/planner_test.go b/src/aggregator/tools/deploy/planner_test.go index e42651b676..5cd5e6f607 100644 --- a/src/aggregator/tools/deploy/planner_test.go +++ b/src/aggregator/tools/deploy/planner_test.go @@ -26,10 +26,10 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/cluster/services" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/services" ) var ( diff --git a/src/aggregator/tools/deploy/validator_test.go b/src/aggregator/tools/deploy/validator_test.go index 45876f5fcd..cdcb68bfab 100644 --- a/src/aggregator/tools/deploy/validator_test.go +++ b/src/aggregator/tools/deploy/validator_test.go @@ -24,11 +24,11 @@ import ( "errors" "testing" - "github.com/m3db/m3/src/aggregator/aggregator" - "github.com/m3db/m3/src/x/sync" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/aggregator/aggregator" + "github.com/m3db/m3/src/x/sync" ) func TestValidatorForFollowerStatusError(t *testing.T) { diff --git a/src/cluster/changeset/manager.go b/src/cluster/changeset/manager.go index baba727b9a..52b9d8b862 100644 --- a/src/cluster/changeset/manager.go +++ b/src/cluster/changeset/manager.go @@ -24,11 +24,11 @@ import ( "errors" "fmt" - "github.com/m3db/m3/src/cluster/generated/proto/changesetpb" - "github.com/m3db/m3/src/cluster/kv" - "github.com/golang/protobuf/proto" "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/generated/proto/changesetpb" + "github.com/m3db/m3/src/cluster/kv" ) var ( diff --git a/src/cluster/changeset/manager_test.go b/src/cluster/changeset/manager_test.go index 334591c437..3db700be03 100644 --- a/src/cluster/changeset/manager_test.go +++ b/src/cluster/changeset/manager_test.go @@ -25,14 +25,14 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/changesetpb" "github.com/m3db/m3/src/cluster/generated/proto/changesettest" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" - - "github.com/golang/mock/gomock" - "github.com/golang/protobuf/proto" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cluster/client/etcd/client.go b/src/cluster/client/etcd/client.go index 6dd5f0a338..2fa041a4b7 100644 --- a/src/cluster/client/etcd/client.go +++ b/src/cluster/client/etcd/client.go @@ -32,6 +32,10 @@ import ( "sync" "time" + "github.com/uber-go/tally" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" etcdkv "github.com/m3db/m3/src/cluster/kv/etcd" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/cluster/services/leader" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" ) const ( @@ -78,6 +78,7 @@ type ZoneClient struct { } // NewEtcdConfigServiceClient returns a new etcd-backed cluster client. +// //nolint:golint func NewEtcdConfigServiceClient(opts Options) (*csclient, error) { if err := opts.Validate(); err != nil { diff --git a/src/cluster/client/etcd/client_test.go b/src/cluster/client/etcd/client_test.go index 343842eb4e..7b9de5fba1 100644 --- a/src/cluster/client/etcd/client_test.go +++ b/src/cluster/client/etcd/client_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/kv" - "github.com/m3db/m3/src/cluster/services" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" - "github.com/m3db/m3/src/x/retry" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" "google.golang.org/grpc" + + "github.com/m3db/m3/src/cluster/kv" + "github.com/m3db/m3/src/cluster/services" + integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" + "github.com/m3db/m3/src/x/retry" ) func TestETCDClientGen(t *testing.T) { diff --git a/src/cluster/client/etcd/options.go b/src/cluster/client/etcd/options.go index 6dc98848ed..018387be4a 100644 --- a/src/cluster/client/etcd/options.go +++ b/src/cluster/client/etcd/options.go @@ -30,11 +30,11 @@ import ( "os" "time" + "google.golang.org/grpc" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" - - "google.golang.org/grpc" ) const ( diff --git a/src/cluster/client/etcd/options_test.go b/src/cluster/client/etcd/options_test.go index 235ea13d46..4620420cb7 100644 --- a/src/cluster/client/etcd/options_test.go +++ b/src/cluster/client/etcd/options_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/x/instrument" ) func TestKeepAliveOptions(t *testing.T) { diff --git a/src/cluster/client/etcd/types.go b/src/cluster/client/etcd/types.go index 5b60832801..c254f388be 100644 --- a/src/cluster/client/etcd/types.go +++ b/src/cluster/client/etcd/types.go @@ -25,12 +25,12 @@ import ( "os" "time" + "google.golang.org/grpc" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" - - "google.golang.org/grpc" ) // Options is the Options to create a config service client. diff --git a/src/cluster/etcd/watchmanager/manager_test.go b/src/cluster/etcd/watchmanager/manager_test.go index ddc8df306c..89258973fe 100644 --- a/src/cluster/etcd/watchmanager/manager_test.go +++ b/src/cluster/etcd/watchmanager/manager_test.go @@ -26,13 +26,13 @@ import ( "testing" "time" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" clientv3 "go.etcd.io/etcd/client/v3" "golang.org/x/net/context" + integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" "github.com/m3db/m3/src/x/clock" ) diff --git a/src/cluster/etcd/watchmanager/options.go b/src/cluster/etcd/watchmanager/options.go index 046dddc1a1..160dacc475 100644 --- a/src/cluster/etcd/watchmanager/options.go +++ b/src/cluster/etcd/watchmanager/options.go @@ -24,9 +24,9 @@ import ( "errors" "time" - "github.com/m3db/m3/src/x/instrument" - clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/m3db/m3/src/x/instrument" ) const ( diff --git a/src/cluster/etcd/watchmanager/types.go b/src/cluster/etcd/watchmanager/types.go index 755087b2ca..62e60b7ade 100644 --- a/src/cluster/etcd/watchmanager/types.go +++ b/src/cluster/etcd/watchmanager/types.go @@ -23,9 +23,9 @@ package watchmanager import ( "time" - "github.com/m3db/m3/src/x/instrument" - clientv3 "go.etcd.io/etcd/client/v3" + + "github.com/m3db/m3/src/x/instrument" ) // WatchManager manages etcd watch on a key diff --git a/src/cluster/integration/etcd/etcd.go b/src/cluster/integration/etcd/etcd.go index b836e36967..3e1c9711c2 100644 --- a/src/cluster/integration/etcd/etcd.go +++ b/src/cluster/integration/etcd/etcd.go @@ -28,13 +28,13 @@ import ( "net/http" "strings" + "github.com/ory/dockertest/v3" + "github.com/m3db/m3/src/cluster/client" etcdclient "github.com/m3db/m3/src/cluster/client/etcd" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/integration/resources/docker/dockerexternal" "github.com/m3db/m3/src/x/instrument" - - "github.com/ory/dockertest/v3" ) type embeddedKV struct { diff --git a/src/cluster/kv/etcd/store.go b/src/cluster/kv/etcd/store.go index 27e2b16843..97eb86ec04 100644 --- a/src/cluster/kv/etcd/store.go +++ b/src/cluster/kv/etcd/store.go @@ -28,16 +28,16 @@ import ( "path" "sync" - "github.com/m3db/m3/src/cluster/etcd/watchmanager" - "github.com/m3db/m3/src/cluster/kv" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/m3db/m3/src/x/retry" - "github.com/golang/protobuf/proto" "github.com/uber-go/tally" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" "golang.org/x/net/context" + + "github.com/m3db/m3/src/cluster/etcd/watchmanager" + "github.com/m3db/m3/src/cluster/kv" + xerrors "github.com/m3db/m3/src/x/errors" + "github.com/m3db/m3/src/x/retry" ) const etcdVersionZero = 0 diff --git a/src/cluster/kv/etcd/store_test.go b/src/cluster/kv/etcd/store_test.go index 64c7e781d2..4ee47b1bf1 100644 --- a/src/cluster/kv/etcd/store_test.go +++ b/src/cluster/kv/etcd/store_test.go @@ -30,17 +30,17 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/generated/proto/kvtest" - "github.com/m3db/m3/src/cluster/kv" - xclock "github.com/m3db/m3/src/x/clock" - "github.com/m3db/m3/src/x/retry" - "github.com/golang/protobuf/proto" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" "golang.org/x/net/context" + + "github.com/m3db/m3/src/cluster/generated/proto/kvtest" + "github.com/m3db/m3/src/cluster/kv" + integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" + xclock "github.com/m3db/m3/src/x/clock" + "github.com/m3db/m3/src/x/retry" ) func TestValue(t *testing.T) { diff --git a/src/cluster/kv/fake/store.go b/src/cluster/kv/fake/store.go index b0d6c34a3c..a70b2a2884 100644 --- a/src/cluster/kv/fake/store.go +++ b/src/cluster/kv/fake/store.go @@ -23,9 +23,9 @@ package fake import ( "errors" - "github.com/m3db/m3/src/cluster/kv" - "github.com/golang/protobuf/proto" + + "github.com/m3db/m3/src/cluster/kv" ) // NewStore returns a fakeStore adhering to the kv.Store interface. diff --git a/src/cluster/kv/mem/store.go b/src/cluster/kv/mem/store.go index e61c831d3a..a3f24aeb37 100644 --- a/src/cluster/kv/mem/store.go +++ b/src/cluster/kv/mem/store.go @@ -24,9 +24,9 @@ import ( "errors" "sync" - "github.com/m3db/m3/src/cluster/kv" - "github.com/golang/protobuf/proto" + + "github.com/m3db/m3/src/cluster/kv" ) // NewStore returns a new in-process store that can be used for testing diff --git a/src/cluster/kv/mem/store_test.go b/src/cluster/kv/mem/store_test.go index e0bc4d94c9..5a0e61fc9d 100644 --- a/src/cluster/kv/mem/store_test.go +++ b/src/cluster/kv/mem/store_test.go @@ -24,10 +24,10 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/kvtest" "github.com/m3db/m3/src/cluster/kv" - - "github.com/stretchr/testify/require" ) func TestValue(t *testing.T) { diff --git a/src/cluster/kv/util/atomic.go b/src/cluster/kv/util/atomic.go index 886d86dbd5..99a84dc2f5 100644 --- a/src/cluster/kv/util/atomic.go +++ b/src/cluster/kv/util/atomic.go @@ -21,9 +21,9 @@ package util import ( - "github.com/m3db/m3/src/cluster/kv" - "go.uber.org/atomic" + + "github.com/m3db/m3/src/cluster/kv" ) // WatchAndUpdateAtomicBool sets up a watch with validation for an atomic bool diff --git a/src/cluster/kv/util/atomic_test.go b/src/cluster/kv/util/atomic_test.go index 4fa728db31..738874ccff 100644 --- a/src/cluster/kv/util/atomic_test.go +++ b/src/cluster/kv/util/atomic_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/generated/proto/commonpb" - "github.com/m3db/m3/src/cluster/kv/mem" - "github.com/fortytw2/leaktest" "github.com/stretchr/testify/require" "go.uber.org/atomic" + + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" + "github.com/m3db/m3/src/cluster/kv/mem" ) func TestWatchAndAtomicUpdateBool(t *testing.T) { diff --git a/src/cluster/kv/util/lock_test.go b/src/cluster/kv/util/lock_test.go index de74885ecf..c8105e3d79 100644 --- a/src/cluster/kv/util/lock_test.go +++ b/src/cluster/kv/util/lock_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/generated/proto/testpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cluster/kv/util/runtime/value.go b/src/cluster/kv/util/runtime/value.go index 7a10ad475c..9db156543a 100644 --- a/src/cluster/kv/util/runtime/value.go +++ b/src/cluster/kv/util/runtime/value.go @@ -23,10 +23,10 @@ package runtime import ( "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/x/watch" - - "go.uber.org/zap" ) // Value is a value that can be updated during runtime. diff --git a/src/cluster/kv/util/runtime/value_test.go b/src/cluster/kv/util/runtime/value_test.go index c880094287..4b17caaeb3 100644 --- a/src/cluster/kv/util/runtime/value_test.go +++ b/src/cluster/kv/util/runtime/value_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/watch" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/cluster/kv/util/types.go b/src/cluster/kv/util/types.go index cee3137877..d2c560918b 100644 --- a/src/cluster/kv/util/types.go +++ b/src/cluster/kv/util/types.go @@ -21,9 +21,9 @@ package util import ( - "github.com/m3db/m3/src/cluster/kv" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/kv" ) // ValidateFn validates an update from KV. diff --git a/src/cluster/kv/util/util.go b/src/cluster/kv/util/util.go index 5a8ccda181..02f11d07c7 100644 --- a/src/cluster/kv/util/util.go +++ b/src/cluster/kv/util/util.go @@ -25,10 +25,10 @@ import ( "fmt" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/kv" - - "go.uber.org/zap" ) var ( diff --git a/src/cluster/kv/util/util_test.go b/src/cluster/kv/util/util_test.go index 696dd66c09..4c39ef3994 100644 --- a/src/cluster/kv/util/util_test.go +++ b/src/cluster/kv/util/util_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" - - "github.com/stretchr/testify/require" ) func TestBoolFromValue(t *testing.T) { diff --git a/src/cluster/mem/mem_test.go b/src/cluster/mem/mem_test.go index ca864ab40a..7bd7919183 100644 --- a/src/cluster/mem/mem_test.go +++ b/src/cluster/mem/mem_test.go @@ -23,11 +23,12 @@ package memcluster import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestReusesStores(t *testing.T) { diff --git a/src/cluster/placement/algo/mirrored_test.go b/src/cluster/placement/algo/mirrored_test.go index 68ad24cece..03d55d61b7 100644 --- a/src/cluster/placement/algo/mirrored_test.go +++ b/src/cluster/placement/algo/mirrored_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/shard" ) func TestMirrorWorkflow(t *testing.T) { diff --git a/src/cluster/placement/algo/non_sharded_test.go b/src/cluster/placement/algo/non_sharded_test.go index e8f29aced7..12810e6bea 100644 --- a/src/cluster/placement/algo/non_sharded_test.go +++ b/src/cluster/placement/algo/non_sharded_test.go @@ -23,9 +23,9 @@ package algo import ( "testing" - "github.com/m3db/m3/src/cluster/placement" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/cluster/placement" ) func TestNonShardedAlgo(t *testing.T) { diff --git a/src/cluster/placement/algo/sharded_helper.go b/src/cluster/placement/algo/sharded_helper.go index 74dc36b834..c98bdbc0f2 100644 --- a/src/cluster/placement/algo/sharded_helper.go +++ b/src/cluster/placement/algo/sharded_helper.go @@ -26,10 +26,10 @@ import ( "fmt" "math" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" - - "go.uber.org/zap" ) var ( diff --git a/src/cluster/placement/algo/sharded_helper_test.go b/src/cluster/placement/algo/sharded_helper_test.go index 6a5bfc125d..39ca416689 100644 --- a/src/cluster/placement/algo/sharded_helper_test.go +++ b/src/cluster/placement/algo/sharded_helper_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/shard" ) func TestMoveInitializingShard(t *testing.T) { diff --git a/src/cluster/placement/algo/sharded_prop_test.go b/src/cluster/placement/algo/sharded_prop_test.go index b6eafac390..ded632b79a 100644 --- a/src/cluster/placement/algo/sharded_prop_test.go +++ b/src/cluster/placement/algo/sharded_prop_test.go @@ -27,11 +27,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" + + "github.com/m3db/m3/src/cluster/placement" ) const minSuccessfulTests = 100 diff --git a/src/cluster/placement/algo/sharded_test.go b/src/cluster/placement/algo/sharded_test.go index b305bfbeed..d732232164 100644 --- a/src/cluster/placement/algo/sharded_test.go +++ b/src/cluster/placement/algo/sharded_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/shard" ) func TestMinorWeightDifference(t *testing.T) { diff --git a/src/cluster/placement/compress.go b/src/cluster/placement/compress.go index 77d4805e88..2ac2ce8f14 100644 --- a/src/cluster/placement/compress.go +++ b/src/cluster/placement/compress.go @@ -21,10 +21,10 @@ package placement import ( - "github.com/m3db/m3/src/cluster/generated/proto/placementpb" - "github.com/gogo/protobuf/proto" "github.com/klauspost/compress/zstd" + + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" ) const _decoderInitialBufferSize = 131072 diff --git a/src/cluster/placement/compress_test.go b/src/cluster/placement/compress_test.go index 662026c454..96a146a74a 100644 --- a/src/cluster/placement/compress_test.go +++ b/src/cluster/placement/compress_test.go @@ -26,12 +26,12 @@ import ( "sync" "testing" - "github.com/m3db/m3/src/cluster/generated/proto/placementpb" - "github.com/m3db/m3/src/cluster/shard" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/require" "go.uber.org/goleak" + + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" + "github.com/m3db/m3/src/cluster/shard" ) func TestMarshalAndUnmarshalPlacementProto(t *testing.T) { diff --git a/src/cluster/placement/config.go b/src/cluster/placement/config.go index 8c7bbf5f15..2988cbbb88 100644 --- a/src/cluster/placement/config.go +++ b/src/cluster/placement/config.go @@ -23,11 +23,11 @@ package placement import ( "time" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/x/instrument" - - "gopkg.in/yaml.v2" ) // Configuration is configuration for placement options. diff --git a/src/cluster/placement/config_test.go b/src/cluster/placement/config_test.go index 1bed8c82ff..00b6466957 100644 --- a/src/cluster/placement/config_test.go +++ b/src/cluster/placement/config_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestWatcherConfiguration(t *testing.T) { diff --git a/src/cluster/placement/options_test.go b/src/cluster/placement/options_test.go index db99bdd2c5..0884b5f441 100644 --- a/src/cluster/placement/options_test.go +++ b/src/cluster/placement/options_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/assert" ) func TestDeploymentOptions(t *testing.T) { diff --git a/src/cluster/placement/placement_test.go b/src/cluster/placement/placement_test.go index 4da58b4071..3dfcdc7be6 100644 --- a/src/cluster/placement/placement_test.go +++ b/src/cluster/placement/placement_test.go @@ -25,11 +25,11 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/cluster/generated/proto/placementpb" - "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" + "github.com/m3db/m3/src/cluster/shard" ) func TestPlacement(t *testing.T) { diff --git a/src/cluster/placement/placements_test.go b/src/cluster/placement/placements_test.go index d4fe9a0253..a3500821a8 100644 --- a/src/cluster/placement/placements_test.go +++ b/src/cluster/placement/placements_test.go @@ -23,9 +23,9 @@ package placement import ( "testing" - "github.com/m3db/m3/src/cluster/generated/proto/placementpb" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" ) var ( diff --git a/src/cluster/placement/placements_watcher.go b/src/cluster/placement/placements_watcher.go index 19db59050d..3a42d8da45 100644 --- a/src/cluster/placement/placements_watcher.go +++ b/src/cluster/placement/placements_watcher.go @@ -24,11 +24,11 @@ import ( "errors" "sync" + "go.uber.org/atomic" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/util/runtime" - - "go.uber.org/atomic" ) var ( diff --git a/src/cluster/placement/placements_watcher_test.go b/src/cluster/placement/placements_watcher_test.go index 32a353d7ad..2983b2c469 100644 --- a/src/cluster/placement/placements_watcher_test.go +++ b/src/cluster/placement/placements_watcher_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/kv" - "github.com/m3db/m3/src/cluster/kv/mem" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/kv" + "github.com/m3db/m3/src/cluster/kv/mem" ) const ( diff --git a/src/cluster/placement/planner/planner_test.go b/src/cluster/placement/planner/planner_test.go index f874e08106..2d749cf984 100644 --- a/src/cluster/placement/planner/planner_test.go +++ b/src/cluster/placement/planner/planner_test.go @@ -24,10 +24,10 @@ import ( "sort" "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" - - "github.com/stretchr/testify/assert" ) func TestDeployment(t *testing.T) { diff --git a/src/cluster/placement/selector/common_test.go b/src/cluster/placement/selector/common_test.go index 3944e5f5bd..1917708278 100644 --- a/src/cluster/placement/selector/common_test.go +++ b/src/cluster/placement/selector/common_test.go @@ -23,10 +23,10 @@ package selector import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" - - "github.com/stretchr/testify/require" ) func TestGetValidCandidates(t *testing.T) { diff --git a/src/cluster/placement/selector/mirrored.go b/src/cluster/placement/selector/mirrored.go index dc1a1618ac..c4f257d86b 100644 --- a/src/cluster/placement/selector/mirrored.go +++ b/src/cluster/placement/selector/mirrored.go @@ -26,9 +26,9 @@ import ( "fmt" "math" - "github.com/m3db/m3/src/cluster/placement" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/placement" ) var ( diff --git a/src/cluster/placement/selector/mirrored_custom_groups.go b/src/cluster/placement/selector/mirrored_custom_groups.go index 6479ed3a08..00bfa91578 100644 --- a/src/cluster/placement/selector/mirrored_custom_groups.go +++ b/src/cluster/placement/selector/mirrored_custom_groups.go @@ -23,16 +23,16 @@ package selector import ( "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/x/errors" - - "go.uber.org/zap" ) type mirroredCustomGroupSelector struct { instanceIDToGroupID InstanceGroupIDFunc logger *zap.Logger - opts placement.Options + opts placement.Options } // InstanceGroupIDFunc maps an instance to its mirrored group. @@ -94,7 +94,7 @@ func (e *mirroredCustomGroupSelector) SelectReplaceInstances( ) ([]placement.Instance, error) { candidates, err := getValidCandidates(p, candidates, e.opts) if err != nil { - return nil, err + return nil, err } // find a replacement for each leaving instance. diff --git a/src/cluster/placement/selector/mirrored_custom_groups_test.go b/src/cluster/placement/selector/mirrored_custom_groups_test.go index 628aa4d89f..c7765f165f 100644 --- a/src/cluster/placement/selector/mirrored_custom_groups_test.go +++ b/src/cluster/placement/selector/mirrored_custom_groups_test.go @@ -23,12 +23,12 @@ package selector import ( "testing" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/x/instrument" ) const ( @@ -138,7 +138,7 @@ func testAddingNodesBehavior( SetValidZone("zone"). SetAllowAllZones(false), ) - + instances, err := doAdd(tctx, []placement.Instance{ newInstanceWithID(instG1I1).SetZone("zone"), newInstanceWithID(instG1I2).SetZone("otherZone"), @@ -199,7 +199,7 @@ func TestExplicitMirroredCustomGroupSelector_SelectReplaceInstances(t *testing.T return &testContext{ mirroredCustomGroupSelectorTestContext: tctx, - ToReplace: toReplace, + ToReplace: toReplace, } } @@ -281,7 +281,7 @@ func mirroredCustomGroupSelectorSetup(_ *testing.T) *mirroredCustomGroupSelector } tctx.Groups = testGroups - + tctx.GroupFn = NewMapInstanceGroupIDFunc(tctx.Groups) tctx.Selector = NewMirroredCustomGroupSelector( diff --git a/src/cluster/placement/selector/mirrored_test.go b/src/cluster/placement/selector/mirrored_test.go index c6fd8ea328..6b3f7bb52a 100644 --- a/src/cluster/placement/selector/mirrored_test.go +++ b/src/cluster/placement/selector/mirrored_test.go @@ -23,11 +23,11 @@ package selector import ( "testing" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/shard" ) func TestSelectInitialInstancesForMirror(t *testing.T) { diff --git a/src/cluster/placement/selector/non_mirrored_test.go b/src/cluster/placement/selector/non_mirrored_test.go index 21cdf0bb83..4590ceff38 100644 --- a/src/cluster/placement/selector/non_mirrored_test.go +++ b/src/cluster/placement/selector/non_mirrored_test.go @@ -25,10 +25,10 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/cluster/placement" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" ) func TestGroupInstancesByConflict(t *testing.T) { diff --git a/src/cluster/placement/service/mirrored_custom_groups_test.go b/src/cluster/placement/service/mirrored_custom_groups_test.go index 1d624aaaef..f82f8bb852 100644 --- a/src/cluster/placement/service/mirrored_custom_groups_test.go +++ b/src/cluster/placement/service/mirrored_custom_groups_test.go @@ -26,16 +26,16 @@ import ( "sync/atomic" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placement/selector" placementstorage "github.com/m3db/m3/src/cluster/placement/storage" "github.com/m3db/m3/src/cluster/shard" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placement/service/operator_test.go b/src/cluster/placement/service/operator_test.go index 0616be2026..42f9f28701 100644 --- a/src/cluster/placement/service/operator_test.go +++ b/src/cluster/placement/service/operator_test.go @@ -24,9 +24,10 @@ package service import ( "testing" - "github.com/m3db/m3/src/cluster/placement" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" ) func TestOperator(t *testing.T) { diff --git a/src/cluster/placement/service/service.go b/src/cluster/placement/service/service.go index b35d148d21..0b720e1e44 100644 --- a/src/cluster/placement/service/service.go +++ b/src/cluster/placement/service/service.go @@ -23,11 +23,12 @@ package service import ( "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placement/algo" "github.com/m3db/m3/src/cluster/placement/selector" "github.com/m3db/m3/src/cluster/shard" - "go.uber.org/zap" ) type placementService struct { diff --git a/src/cluster/placement/service/service_test.go b/src/cluster/placement/service/service_test.go index 0271f04f61..7cdcac2af1 100644 --- a/src/cluster/placement/service/service_test.go +++ b/src/cluster/placement/service/service_test.go @@ -24,13 +24,14 @@ import ( "errors" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placement/algo" "github.com/m3db/m3/src/cluster/placement/storage" "github.com/m3db/m3/src/cluster/shard" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestGoodWorkflow(t *testing.T) { diff --git a/src/cluster/placement/storage/helper.go b/src/cluster/placement/storage/helper.go index 496b946dd3..4185025c80 100644 --- a/src/cluster/placement/storage/helper.go +++ b/src/cluster/placement/storage/helper.go @@ -24,11 +24,11 @@ import ( "errors" "fmt" + "github.com/golang/protobuf/proto" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" - - "github.com/golang/protobuf/proto" ) var ( diff --git a/src/cluster/placement/storage/helper_test.go b/src/cluster/placement/storage/helper_test.go index c5f77d2bc3..be395f3944 100644 --- a/src/cluster/placement/storage/helper_test.go +++ b/src/cluster/placement/storage/helper_test.go @@ -23,12 +23,12 @@ package storage import ( "testing" + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" - - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/require" ) func TestPlacementHelper(t *testing.T) { diff --git a/src/cluster/placement/storage/storage.go b/src/cluster/placement/storage/storage.go index 027dd198a3..7d15460165 100644 --- a/src/cluster/placement/storage/storage.go +++ b/src/cluster/placement/storage/storage.go @@ -21,11 +21,11 @@ package storage import ( - "github.com/m3db/m3/src/cluster/kv" - "github.com/m3db/m3/src/cluster/placement" - "github.com/golang/protobuf/proto" "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/kv" + "github.com/m3db/m3/src/cluster/placement" ) const errorVersionValue = 0 diff --git a/src/cluster/placement/storage/storage_test.go b/src/cluster/placement/storage/storage_test.go index c57b0d4ae0..2799ca1c27 100644 --- a/src/cluster/placement/storage/storage_test.go +++ b/src/cluster/placement/storage/storage_test.go @@ -23,13 +23,13 @@ package storage import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestStorageWithSinglePlacement(t *testing.T) { diff --git a/src/cluster/placement/storage/watch_test.go b/src/cluster/placement/storage/watch_test.go index 5c1728d974..f20488d010 100644 --- a/src/cluster/placement/storage/watch_test.go +++ b/src/cluster/placement/storage/watch_test.go @@ -23,12 +23,12 @@ package storage import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/kvtest" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPlacementWatch(t *testing.T) { diff --git a/src/cluster/placement/types.go b/src/cluster/placement/types.go index 4a39303b49..e940e4e0a4 100644 --- a/src/cluster/placement/types.go +++ b/src/cluster/placement/types.go @@ -23,13 +23,13 @@ package placement import ( "time" + "github.com/golang/protobuf/proto" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/protobuf/proto" ) // Instance represents an instance in a placement. @@ -465,13 +465,13 @@ type Service interface { // a local copy of a placement without persisting anything to backing storage. This can be useful // to apply multiple placement operations in a row before persisting them, e.g.: // -// func DoMultipleOps(opts placement.Options, store placement.Storage) { -// curPlacement := store.Placement() -// op := placement.NewOperator(curPlacement, opts) -// op.ReplaceInstances(...) -// op.MarkAllShardsAvailable() -// store.CheckAndSet(op.Placement()) -// } +// func DoMultipleOps(opts placement.Options, store placement.Storage) { +// curPlacement := store.Placement() +// op := placement.NewOperator(curPlacement, opts) +// op.ReplaceInstances(...) +// op.MarkAllShardsAvailable() +// store.CheckAndSet(op.Placement()) +// } type Operator interface { operations diff --git a/src/cluster/placementhandler/add.go b/src/cluster/placementhandler/add.go index c77ff1ce87..9b5e4e69fd 100644 --- a/src/cluster/placementhandler/add.go +++ b/src/cluster/placementhandler/add.go @@ -25,6 +25,9 @@ import ( "path" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/route" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/add_test.go b/src/cluster/placementhandler/add_test.go index 2aba47df3c..10b30f81eb 100644 --- a/src/cluster/placementhandler/add_test.go +++ b/src/cluster/placementhandler/add_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" - "github.com/m3db/m3/src/x/instrument" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" + "github.com/m3db/m3/src/x/instrument" ) func TestPlacementAddHandler_Force(t *testing.T) { diff --git a/src/cluster/placementhandler/common_test.go b/src/cluster/placementhandler/common_test.go index a82ce5ec4a..bceea16835 100644 --- a/src/cluster/placementhandler/common_test.go +++ b/src/cluster/placementhandler/common_test.go @@ -25,16 +25,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPlacementService(t *testing.T) { diff --git a/src/cluster/placementhandler/delete.go b/src/cluster/placementhandler/delete.go index 85906b19df..75bd211189 100644 --- a/src/cluster/placementhandler/delete.go +++ b/src/cluster/placementhandler/delete.go @@ -27,6 +27,9 @@ import ( "path" "time" + "github.com/gorilla/mux" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/route" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gorilla/mux" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/delete_all.go b/src/cluster/placementhandler/delete_all.go index 56982e304a..2d647d36ad 100644 --- a/src/cluster/placementhandler/delete_all.go +++ b/src/cluster/placementhandler/delete_all.go @@ -26,13 +26,13 @@ import ( "path" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/query/util/logging" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/delete_all_test.go b/src/cluster/placementhandler/delete_all_test.go index 5452fef85c..e627594565 100644 --- a/src/cluster/placementhandler/delete_all_test.go +++ b/src/cluster/placementhandler/delete_all_test.go @@ -27,15 +27,15 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPlacementDeleteAllHandler(t *testing.T) { diff --git a/src/cluster/placementhandler/delete_test.go b/src/cluster/placementhandler/delete_test.go index e05edeb4b5..b69d8059a4 100644 --- a/src/cluster/placementhandler/delete_test.go +++ b/src/cluster/placementhandler/delete_test.go @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/gorilla/mux" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/gorilla/mux" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPlacementDeleteHandler_Force(t *testing.T) { diff --git a/src/cluster/placementhandler/get.go b/src/cluster/placementhandler/get.go index 7dd7484779..7847ddc245 100644 --- a/src/cluster/placementhandler/get.go +++ b/src/cluster/placementhandler/get.go @@ -28,6 +28,8 @@ import ( "strconv" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/get_test.go b/src/cluster/placementhandler/get_test.go index b468acacce..849086f003 100644 --- a/src/cluster/placementhandler/get_test.go +++ b/src/cluster/placementhandler/get_test.go @@ -27,6 +27,10 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func SetupPlacementTest(t *testing.T, ctrl *gomock.Controller) (*client.MockClient, *placement.MockService) { diff --git a/src/cluster/placementhandler/handleroptions/service_options_test.go b/src/cluster/placementhandler/handleroptions/service_options_test.go index 682563756e..003ac90e27 100644 --- a/src/cluster/placementhandler/handleroptions/service_options_test.go +++ b/src/cluster/placementhandler/handleroptions/service_options_test.go @@ -25,9 +25,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/headers" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/x/headers" ) func TestNewServiceOptions(t *testing.T) { diff --git a/src/cluster/placementhandler/init.go b/src/cluster/placementhandler/init.go index 9698c4b1a7..efe398e63a 100644 --- a/src/cluster/placementhandler/init.go +++ b/src/cluster/placementhandler/init.go @@ -25,6 +25,9 @@ import ( "path" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/init_test.go b/src/cluster/placementhandler/init_test.go index 9124a39be9..71a31fe764 100644 --- a/src/cluster/placementhandler/init_test.go +++ b/src/cluster/placementhandler/init_test.go @@ -28,15 +28,15 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cluster/placementhandler/remove.go b/src/cluster/placementhandler/remove.go index 3567e52961..b113d44dd6 100644 --- a/src/cluster/placementhandler/remove.go +++ b/src/cluster/placementhandler/remove.go @@ -25,6 +25,9 @@ import ( "path" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/route" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( @@ -67,7 +67,7 @@ func NewRemoveHandler(opts HandlerOptions) *RemoveHandler { } // ServeHTTP serves HTTP requests. -//nolint: dupl +// nolint: dupl func (h *RemoveHandler) ServeHTTP( svc handleroptions.ServiceNameAndDefaults, w http.ResponseWriter, diff --git a/src/cluster/placementhandler/remove_test.go b/src/cluster/placementhandler/remove_test.go index 65bd59f662..a8342fb06a 100644 --- a/src/cluster/placementhandler/remove_test.go +++ b/src/cluster/placementhandler/remove_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" - "github.com/m3db/m3/src/x/instrument" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" + "github.com/m3db/m3/src/x/instrument" ) func TestPlacementRemoveHandler_Force(t *testing.T) { diff --git a/src/cluster/placementhandler/replace.go b/src/cluster/placementhandler/replace.go index c488facdad..1709fc1ab0 100644 --- a/src/cluster/placementhandler/replace.go +++ b/src/cluster/placementhandler/replace.go @@ -25,6 +25,9 @@ import ( "path" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/route" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/replace_test.go b/src/cluster/placementhandler/replace_test.go index ddd16b6242..1c6deb8a95 100644 --- a/src/cluster/placementhandler/replace_test.go +++ b/src/cluster/placementhandler/replace_test.go @@ -29,14 +29,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func newReplaceRequest(body string) *http.Request { diff --git a/src/cluster/placementhandler/set.go b/src/cluster/placementhandler/set.go index 7d7592d6df..8d2b1ae798 100644 --- a/src/cluster/placementhandler/set.go +++ b/src/cluster/placementhandler/set.go @@ -26,6 +26,9 @@ import ( "path" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/placementhandler/set_test.go b/src/cluster/placementhandler/set_test.go index a8d143a27d..756f9c2be8 100644 --- a/src/cluster/placementhandler/set_test.go +++ b/src/cluster/placementhandler/set_test.go @@ -26,6 +26,11 @@ import ( "strings" "testing" + "github.com/gogo/protobuf/jsonpb" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" @@ -33,11 +38,6 @@ import ( "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/gogo/protobuf/jsonpb" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cluster/services/heartbeat/etcd/store.go b/src/cluster/services/heartbeat/etcd/store.go index 83ab6af55f..ec685528e4 100644 --- a/src/cluster/services/heartbeat/etcd/store.go +++ b/src/cluster/services/heartbeat/etcd/store.go @@ -27,6 +27,12 @@ import ( "sync" "time" + "github.com/golang/protobuf/proto" + "github.com/uber-go/tally" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "golang.org/x/net/context" + "github.com/m3db/m3/src/cluster/etcd/watchmanager" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -34,12 +40,6 @@ import ( "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/x/retry" "github.com/m3db/m3/src/x/watch" - - "github.com/golang/protobuf/proto" - "github.com/uber-go/tally" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "golang.org/x/net/context" ) const ( diff --git a/src/cluster/services/heartbeat/etcd/store_test.go b/src/cluster/services/heartbeat/etcd/store_test.go index b38025259b..f95f585018 100644 --- a/src/cluster/services/heartbeat/etcd/store_test.go +++ b/src/cluster/services/heartbeat/etcd/store_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/m3db/m3/src/cluster/mocks" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" - "github.com/stretchr/testify/require" - clientv3 "go.etcd.io/etcd/client/v3" ) func TestKeys(t *testing.T) { diff --git a/src/cluster/services/leader/client.go b/src/cluster/services/leader/client.go index d01f13ae44..bf11da2383 100644 --- a/src/cluster/services/leader/client.go +++ b/src/cluster/services/leader/client.go @@ -25,13 +25,13 @@ import ( "fmt" "sync" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/cluster/services/leader/campaign" - "github.com/m3db/m3/src/cluster/services/leader/election" - clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "golang.org/x/net/context" + + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/cluster/services/leader/campaign" + "github.com/m3db/m3/src/cluster/services/leader/election" ) // Appended to elections with an empty string for electionID to make it easier diff --git a/src/cluster/services/leader/client_test.go b/src/cluster/services/leader/client_test.go index 0fb7b75d4c..282a48a501 100644 --- a/src/cluster/services/leader/client_test.go +++ b/src/cluster/services/leader/client_test.go @@ -26,15 +26,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/cluster/services/leader/campaign" - "github.com/m3db/m3/src/cluster/services/leader/election" - - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" "golang.org/x/net/context" + + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/cluster/services/leader/campaign" + "github.com/m3db/m3/src/cluster/services/leader/election" + integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" ) var ( diff --git a/src/cluster/services/leader/election/client_test.go b/src/cluster/services/leader/election/client_test.go index 6cc2db348d..40402018b8 100644 --- a/src/cluster/services/leader/election/client_test.go +++ b/src/cluster/services/leader/election/client_test.go @@ -25,11 +25,12 @@ import ( "testing" "time" - integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" + + integration "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration" ) type testCluster struct { diff --git a/src/cluster/services/leader/service.go b/src/cluster/services/leader/service.go index a9fe2aaa1d..37e24c5e01 100644 --- a/src/cluster/services/leader/service.go +++ b/src/cluster/services/leader/service.go @@ -25,10 +25,10 @@ import ( "fmt" "sync" + clientv3 "go.etcd.io/etcd/client/v3" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/services/leader/campaign" - - clientv3 "go.etcd.io/etcd/client/v3" ) const ( diff --git a/src/cluster/services/options_test.go b/src/cluster/services/options_test.go index b796bbf98d..d3b15b1505 100644 --- a/src/cluster/services/options_test.go +++ b/src/cluster/services/options_test.go @@ -22,10 +22,10 @@ package services import ( "testing" - "github.com/m3db/m3/src/cluster/kv" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/kv" ) var ( diff --git a/src/cluster/services/services.go b/src/cluster/services/services.go index d09e182d7d..ae0ec55ab2 100644 --- a/src/cluster/services/services.go +++ b/src/cluster/services/services.go @@ -26,6 +26,9 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/generated/proto/metadatapb" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/cluster/shard" xos "github.com/m3db/m3/src/x/os" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/cluster/services/services_test.go b/src/cluster/services/services_test.go index 076f061103..96a55c9d51 100644 --- a/src/cluster/services/services_test.go +++ b/src/cluster/services/services_test.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/metadatapb" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xos "github.com/m3db/m3/src/x/os" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestConvertBetweenProtoAndService(t *testing.T) { diff --git a/src/cluster/shard/shard.go b/src/cluster/shard/shard.go index 63bca13bc6..b90a1e5dd2 100644 --- a/src/cluster/shard/shard.go +++ b/src/cluster/shard/shard.go @@ -27,9 +27,9 @@ import ( "strconv" "strings" - "github.com/m3db/m3/src/cluster/generated/proto/placementpb" - "github.com/gogo/protobuf/types" + + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" ) var ( diff --git a/src/cmd/services/m3aggregator/config/config.go b/src/cmd/services/m3aggregator/config/config.go index f4c797ec2f..97d1ea12d8 100644 --- a/src/cmd/services/m3aggregator/config/config.go +++ b/src/cmd/services/m3aggregator/config/config.go @@ -21,11 +21,11 @@ package config import ( + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/x/debug/config" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/log" - - "gopkg.in/yaml.v2" ) // Configuration contains top-level configuration. diff --git a/src/cmd/services/m3aggregator/config/runtime.go b/src/cmd/services/m3aggregator/config/runtime.go index ac2a3357ce..814dba73a3 100644 --- a/src/cmd/services/m3aggregator/config/runtime.go +++ b/src/cmd/services/m3aggregator/config/runtime.go @@ -24,13 +24,13 @@ import ( "math" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" kvutil "github.com/m3db/m3/src/cluster/kv/util" - - "go.uber.org/zap" ) // RuntimeOptionsConfiguration configures runtime options. diff --git a/src/cmd/services/m3aggregator/config/runtime_test.go b/src/cmd/services/m3aggregator/config/runtime_test.go index 34099a6541..9bcb9f7a8e 100644 --- a/src/cmd/services/m3aggregator/config/runtime_test.go +++ b/src/cmd/services/m3aggregator/config/runtime_test.go @@ -24,6 +24,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/runtime" "github.com/m3db/m3/src/cluster/client" @@ -31,10 +35,6 @@ import ( "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) func TestRuntimeOptionsConfigurationNewRuntimeOptionsManager(t *testing.T) { diff --git a/src/cmd/services/m3aggregator/serve/serve.go b/src/cmd/services/m3aggregator/serve/serve.go index cc1a51466e..11d1e856b1 100644 --- a/src/cmd/services/m3aggregator/serve/serve.go +++ b/src/cmd/services/m3aggregator/serve/serve.go @@ -24,13 +24,13 @@ import ( "fmt" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator" httpserver "github.com/m3db/m3/src/aggregator/server/http" m3msgserver "github.com/m3db/m3/src/aggregator/server/m3msg" rawtcpserver "github.com/m3db/m3/src/aggregator/server/rawtcp" xdebug "github.com/m3db/m3/src/x/debug" - - "go.uber.org/zap" ) // Serve starts serving RPC traffic. diff --git a/src/cmd/services/m3comparator/main/filterer_test.go b/src/cmd/services/m3comparator/main/filterer_test.go index 467b9808ba..48f05c033e 100644 --- a/src/cmd/services/m3comparator/main/filterer_test.go +++ b/src/cmd/services/m3comparator/main/filterer_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cmd/services/m3comparator/main/main.go b/src/cmd/services/m3comparator/main/main.go index 307cea42b4..b9f7b954c8 100644 --- a/src/cmd/services/m3comparator/main/main.go +++ b/src/cmd/services/m3comparator/main/main.go @@ -25,6 +25,8 @@ import ( "net/http" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" @@ -33,8 +35,6 @@ import ( "github.com/m3db/m3/src/query/remote" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" - - "go.uber.org/zap" ) var ( diff --git a/src/cmd/services/m3comparator/main/parser/series_load.go b/src/cmd/services/m3comparator/main/parser/series_load.go index 319d80f678..ca172f4dc2 100644 --- a/src/cmd/services/m3comparator/main/parser/series_load.go +++ b/src/cmd/services/m3comparator/main/parser/series_load.go @@ -28,6 +28,8 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) // Options are options for series parsing. diff --git a/src/cmd/services/m3comparator/main/querier.go b/src/cmd/services/m3comparator/main/querier.go index c0593ca873..aab93609a2 100644 --- a/src/cmd/services/m3comparator/main/querier.go +++ b/src/cmd/services/m3comparator/main/querier.go @@ -32,6 +32,8 @@ import ( "sync" "time" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" @@ -41,8 +43,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3" "github.com/m3db/m3/src/query/storage/m3/consolidators" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/common/model" ) var _ m3.Querier = (*querier)(nil) diff --git a/src/cmd/services/m3comparator/main/querier_test.go b/src/cmd/services/m3comparator/main/querier_test.go index 1b21d55ff9..02060ba29a 100644 --- a/src/cmd/services/m3comparator/main/querier_test.go +++ b/src/cmd/services/m3comparator/main/querier_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/models" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testSeriesLoadHandler struct { diff --git a/src/cmd/services/m3comparator/main/series_load_handler.go b/src/cmd/services/m3comparator/main/series_load_handler.go index b92f661dcc..cf0029fd7d 100644 --- a/src/cmd/services/m3comparator/main/series_load_handler.go +++ b/src/cmd/services/m3comparator/main/series_load_handler.go @@ -24,11 +24,11 @@ import ( "net/http" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/dbnode/encoding" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) type seriesLoadHandler interface { diff --git a/src/cmd/services/m3comparator/main/series_load_handler_test.go b/src/cmd/services/m3comparator/main/series_load_handler_test.go index 6da9d981b3..4c24d2bfda 100644 --- a/src/cmd/services/m3comparator/main/series_load_handler_test.go +++ b/src/cmd/services/m3comparator/main/series_load_handler_test.go @@ -27,11 +27,11 @@ import ( "strings" "testing" - "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" - "github.com/m3db/m3/src/dbnode/encoding" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" + "github.com/m3db/m3/src/dbnode/encoding" ) // NB: this is regression test data that used to cause issues. diff --git a/src/cmd/services/m3coordinator/downsample/downsampler.go b/src/cmd/services/m3coordinator/downsample/downsampler.go index 04ac2d0964..fa0f002382 100644 --- a/src/cmd/services/m3coordinator/downsample/downsampler.go +++ b/src/cmd/services/m3coordinator/downsample/downsampler.go @@ -23,6 +23,9 @@ package downsample import ( "sync" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/metrics/generated/proto/metricpb" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/metrics/rules/view" @@ -30,9 +33,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) // Downsampler is a downsampler. diff --git a/src/cmd/services/m3coordinator/downsample/downsampler_test.go b/src/cmd/services/m3coordinator/downsample/downsampler_test.go index 9352d3f16d..7df6389127 100644 --- a/src/cmd/services/m3coordinator/downsample/downsampler_test.go +++ b/src/cmd/services/m3coordinator/downsample/downsampler_test.go @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -//nolint: dupl +// nolint: dupl package downsample import ( @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/client" clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" @@ -60,11 +65,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/services/m3coordinator/downsample/flush_handler.go b/src/cmd/services/m3coordinator/downsample/flush_handler.go index 2b953d125d..4bfb0435fd 100644 --- a/src/cmd/services/m3coordinator/downsample/flush_handler.go +++ b/src/cmd/services/m3coordinator/downsample/flush_handler.go @@ -25,6 +25,9 @@ import ( "context" "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/aggregator/handler/writer" "github.com/m3db/m3/src/metrics/metric/aggregated" @@ -37,9 +40,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/services/m3coordinator/downsample/flush_handler_test.go b/src/cmd/services/m3coordinator/downsample/flush_handler_test.go index 14a411dea4..85fb8e9595 100644 --- a/src/cmd/services/m3coordinator/downsample/flush_handler_test.go +++ b/src/cmd/services/m3coordinator/downsample/flush_handler_test.go @@ -25,6 +25,11 @@ import ( "sync" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/policy" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestDownsamplerFlushHandlerCopiesTags(t *testing.T) { diff --git a/src/cmd/services/m3coordinator/downsample/id_pool_types_test.go b/src/cmd/services/m3coordinator/downsample/id_pool_types_test.go index 5ee586be9e..d6d38824a8 100644 --- a/src/cmd/services/m3coordinator/downsample/id_pool_types_test.go +++ b/src/cmd/services/m3coordinator/downsample/id_pool_types_test.go @@ -23,14 +23,14 @@ package downsample import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/serialize" - - "github.com/stretchr/testify/require" ) -//nolint: dupl +// nolint: dupl func TestRollupIdProvider(t *testing.T) { cases := []struct { name string diff --git a/src/cmd/services/m3coordinator/downsample/leader_local_test.go b/src/cmd/services/m3coordinator/downsample/leader_local_test.go index 83bb3c9a93..339b07b512 100644 --- a/src/cmd/services/m3coordinator/downsample/leader_local_test.go +++ b/src/cmd/services/m3coordinator/downsample/leader_local_test.go @@ -23,11 +23,11 @@ package downsample import ( "testing" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/cluster/services/leader/campaign" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/cluster/services/leader/campaign" ) func TestLeaderLocalService(t *testing.T) { diff --git a/src/cmd/services/m3coordinator/downsample/metrics_appender.go b/src/cmd/services/m3coordinator/downsample/metrics_appender.go index d39fa129eb..3d146f8f86 100644 --- a/src/cmd/services/m3coordinator/downsample/metrics_appender.go +++ b/src/cmd/services/m3coordinator/downsample/metrics_appender.go @@ -28,6 +28,11 @@ import ( "sort" "time" + "github.com/gogo/protobuf/jsonpb" + "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/metrics/aggregation" @@ -44,11 +49,6 @@ import ( "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" - - "github.com/gogo/protobuf/jsonpb" - "github.com/uber-go/tally" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) var errNoTags = errors.New("no tags provided") diff --git a/src/cmd/services/m3coordinator/downsample/metrics_appender_test.go b/src/cmd/services/m3coordinator/downsample/metrics_appender_test.go index 0a42970512..c8a8e603b6 100644 --- a/src/cmd/services/m3coordinator/downsample/metrics_appender_test.go +++ b/src/cmd/services/m3coordinator/downsample/metrics_appender_test.go @@ -25,6 +25,11 @@ import ( "fmt" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/metrics/matcher" "github.com/m3db/m3/src/metrics/metadata" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestSamplesAppenderPoolResetsTagsAcrossSamples(t *testing.T) { diff --git a/src/cmd/services/m3coordinator/downsample/options.go b/src/cmd/services/m3coordinator/downsample/options.go index 2bf8dcdcf3..f3057625dd 100644 --- a/src/cmd/services/m3coordinator/downsample/options.go +++ b/src/cmd/services/m3coordinator/downsample/options.go @@ -27,6 +27,9 @@ import ( "runtime" "time" + "github.com/pborman/uuid" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/aggregator/handler" "github.com/m3db/m3/src/aggregator/client" @@ -69,9 +72,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" - "github.com/prometheus/common/model" ) const ( diff --git a/src/cmd/services/m3coordinator/downsample/options_test.go b/src/cmd/services/m3coordinator/downsample/options_test.go index 50589347e3..e6064c23cb 100644 --- a/src/cmd/services/m3coordinator/downsample/options_test.go +++ b/src/cmd/services/m3coordinator/downsample/options_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/policy" @@ -32,8 +34,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestBufferForPastTimedMetric(t *testing.T) { diff --git a/src/cmd/services/m3coordinator/downsample/samples_appender.go b/src/cmd/services/m3coordinator/downsample/samples_appender.go index 5d52dd9c4b..6827d85bc1 100644 --- a/src/cmd/services/m3coordinator/downsample/samples_appender.go +++ b/src/cmd/services/m3coordinator/downsample/samples_appender.go @@ -21,6 +21,8 @@ package downsample import ( + "github.com/uber-go/tally" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/client" "github.com/m3db/m3/src/metrics/metadata" @@ -29,8 +31,6 @@ import ( "github.com/m3db/m3/src/metrics/metric/unaggregated" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) // samplesAppender must have one of agg or client set diff --git a/src/cmd/services/m3coordinator/ingest/carbon/ingest.go b/src/cmd/services/m3coordinator/ingest/carbon/ingest.go index 2877a3f1ba..8637a8453f 100644 --- a/src/cmd/services/m3coordinator/ingest/carbon/ingest.go +++ b/src/cmd/services/m3coordinator/ingest/carbon/ingest.go @@ -32,6 +32,10 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cmd/services/m3coordinator/downsample" "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -48,10 +52,6 @@ import ( m3xserver "github.com/m3db/m3/src/x/server" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( @@ -470,11 +470,14 @@ func newCarbonIngesterMetrics(scope tally.Scope) (carbonIngesterMetrics, error) // GenerateTagsFromName accepts a carbon metric name and blows it up into a list of // key-value pair tags such that an input like: -// foo.bar.baz +// +// foo.bar.baz +// // becomes -// __g0__:foo -// __g1__:bar -// __g2__:baz +// +// __g0__:foo +// __g1__:bar +// __g2__:baz func GenerateTagsFromName( name []byte, opts models.TagOptions, diff --git a/src/cmd/services/m3coordinator/ingest/carbon/ingest_test.go b/src/cmd/services/m3coordinator/ingest/carbon/ingest_test.go index 48ae57bc74..c54410506d 100644 --- a/src/cmd/services/m3coordinator/ingest/carbon/ingest_test.go +++ b/src/cmd/services/m3coordinator/ingest/carbon/ingest_test.go @@ -34,6 +34,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3coordinator/downsample" "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -50,10 +54,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/cmd/services/m3coordinator/ingest/m3msg/ingest.go b/src/cmd/services/m3coordinator/ingest/m3msg/ingest.go index 3873c568f7..e073254116 100644 --- a/src/cmd/services/m3coordinator/ingest/m3msg/ingest.go +++ b/src/cmd/services/m3coordinator/ingest/m3msg/ingest.go @@ -24,6 +24,9 @@ import ( "bytes" "context" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3coordinator/downsample" "github.com/m3db/m3/src/cmd/services/m3coordinator/server/m3msg" "github.com/m3db/m3/src/metrics/metric/id" @@ -41,9 +44,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // Options configures the ingester. diff --git a/src/cmd/services/m3coordinator/ingest/m3msg/ingest_test.go b/src/cmd/services/m3coordinator/ingest/m3msg/ingest_test.go index b6c8274e98..0348fa0060 100644 --- a/src/cmd/services/m3coordinator/ingest/m3msg/ingest_test.go +++ b/src/cmd/services/m3coordinator/ingest/m3msg/ingest_test.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3coordinator/server/m3msg" "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/policy" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestIngest(t *testing.T) { diff --git a/src/cmd/services/m3coordinator/ingest/write.go b/src/cmd/services/m3coordinator/ingest/write.go index 05fab4c2bd..8e5f00989b 100644 --- a/src/cmd/services/m3coordinator/ingest/write.go +++ b/src/cmd/services/m3coordinator/ingest/write.go @@ -24,6 +24,8 @@ import ( "context" "sync" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3coordinator/downsample" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/models" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) var ( diff --git a/src/cmd/services/m3coordinator/ingest/write_test.go b/src/cmd/services/m3coordinator/ingest/write_test.go index a887186e84..5be2ba46a0 100644 --- a/src/cmd/services/m3coordinator/ingest/write_test.go +++ b/src/cmd/services/m3coordinator/ingest/write_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3coordinator/downsample" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/metrics/aggregation" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler.go b/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler.go index a7319ff24d..0f4bb2d685 100644 --- a/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler.go +++ b/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler.go @@ -24,14 +24,14 @@ import ( "context" "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/msg/consumer" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // Options for the ingest handler. @@ -51,7 +51,7 @@ type handlerMetrics struct { func newHandlerMetrics(scope tally.Scope) handlerMetrics { messageScope := scope.SubScope("metric") return handlerMetrics{ - metricAccepted: messageScope.Counter("accepted"), + metricAccepted: messageScope.Counter("accepted"), droppedMetricDecodeError: messageScope.Tagged(map[string]string{ "reason": "decode-error", }).Counter("dropped"), diff --git a/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler_test.go b/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler_test.go index 1a11d16696..fc3a82cbcc 100644 --- a/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler_test.go +++ b/src/cmd/services/m3coordinator/server/m3msg/protobuf_handler_test.go @@ -27,6 +27,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/encoding/protobuf" "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/metric/aggregated" @@ -37,8 +39,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/server" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/cmd/services/m3dbnode/config/config.go b/src/cmd/services/m3dbnode/config/config.go index 6825fd22ce..1c13488844 100644 --- a/src/cmd/services/m3dbnode/config/config.go +++ b/src/cmd/services/m3dbnode/config/config.go @@ -29,6 +29,12 @@ import ( "strings" "time" + "github.com/m3dbx/vellum/regexp" + "go.etcd.io/etcd/client/pkg/v3/transport" + "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/server/v3/embed" + "gopkg.in/yaml.v2" + coordinatorcfg "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/discovery" @@ -40,12 +46,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xlog "github.com/m3db/m3/src/x/log" "github.com/m3db/m3/src/x/opentracing" - - "github.com/m3dbx/vellum/regexp" - "go.etcd.io/etcd/client/pkg/v3/transport" - "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/server/v3/embed" - "gopkg.in/yaml.v2" ) const ( diff --git a/src/cmd/services/m3dbnode/config/config_test.go b/src/cmd/services/m3dbnode/config/config_test.go index 45b15a41bd..a5f3c0897e 100644 --- a/src/cmd/services/m3dbnode/config/config_test.go +++ b/src/cmd/services/m3dbnode/config/config_test.go @@ -26,6 +26,11 @@ import ( "os" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/environment" "github.com/m3db/m3/src/dbnode/storage" @@ -35,11 +40,6 @@ import ( xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) const testBaseConfig = ` diff --git a/src/cmd/services/m3dbnode/config/pooling.go b/src/cmd/services/m3dbnode/config/pooling.go index 8c1898db5b..ba594e1700 100644 --- a/src/cmd/services/m3dbnode/config/pooling.go +++ b/src/cmd/services/m3dbnode/config/pooling.go @@ -276,10 +276,10 @@ var ( // PoolingPolicy specifies the pooling policy. To add a new pool, follow these steps: // -// 1. Add the pool to the struct below. -// 2. Add the default values to the defaultPoolPolicies or defaultBucketPoolPolicies map. -// 3. Add a call to initDefaultsAndValidate() for the new pool in the -// PoolingPolicy.InitDefaultsAndValidate() method. +// 1. Add the pool to the struct below. +// 2. Add the default values to the defaultPoolPolicies or defaultBucketPoolPolicies map. +// 3. Add a call to initDefaultsAndValidate() for the new pool in the +// PoolingPolicy.InitDefaultsAndValidate() method. type PoolingPolicy struct { // The initial alloc size for a block. BlockAllocSize *int `yaml:"blockAllocSize"` diff --git a/src/cmd/services/m3dbnode/main/common_test.go b/src/cmd/services/m3dbnode/main/common_test.go index c1f744f9e7..ca12f78170 100644 --- a/src/cmd/services/m3dbnode/main/common_test.go +++ b/src/cmd/services/m3dbnode/main/common_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2017 Uber Technologies, Inc. // @@ -33,15 +35,15 @@ import ( "testing" "time" + "github.com/gogo/protobuf/proto" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/ident" - - "github.com/gogo/protobuf/proto" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/cmd/services/m3dbnode/main/main_index_test.go b/src/cmd/services/m3dbnode/main/main_index_test.go index 00d3ff67eb..b5c0e12a9f 100644 --- a/src/cmd/services/m3dbnode/main/main_index_test.go +++ b/src/cmd/services/m3dbnode/main/main_index_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2017 Uber Technologies, Inc. // @@ -33,6 +35,10 @@ import ( "text/template" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/integration/etcd" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" @@ -47,10 +53,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) // TestIndexEnabledServer tests booting a server using file based configuration. diff --git a/src/cmd/services/m3dbnode/main/main_test.go b/src/cmd/services/m3dbnode/main/main_test.go index f46e6c39aa..7cbdaf773e 100644 --- a/src/cmd/services/m3dbnode/main/main_test.go +++ b/src/cmd/services/m3dbnode/main/main_test.go @@ -33,6 +33,10 @@ import ( "text/template" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/integration/etcd" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" @@ -44,10 +48,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) // TestConfig tests booting a server using file based configuration. diff --git a/src/cmd/services/m3em_agent/agentmain/agent.go b/src/cmd/services/m3em_agent/agentmain/agent.go index 53298f4327..d9e7a505fd 100644 --- a/src/cmd/services/m3em_agent/agentmain/agent.go +++ b/src/cmd/services/m3em_agent/agentmain/agent.go @@ -28,6 +28,11 @@ import ( "strings" "time" + "github.com/pborman/getopt" + "github.com/uber-go/tally" + "go.uber.org/zap" + "google.golang.org/grpc/credentials" + m3emconfig "github.com/m3db/m3/src/cmd/services/m3em_agent/config" "github.com/m3db/m3/src/m3em/agent" "github.com/m3db/m3/src/m3em/generated/proto/m3em" @@ -36,11 +41,6 @@ import ( xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/instrument" xtcp "github.com/m3db/m3/src/x/tcp" - - "github.com/pborman/getopt" - "github.com/uber-go/tally" - "go.uber.org/zap" - "google.golang.org/grpc/credentials" ) // Run runs a m3em_agent process diff --git a/src/cmd/services/m3em_agent/config/config.go b/src/cmd/services/m3em_agent/config/config.go index a079cf644f..82a991e32e 100644 --- a/src/cmd/services/m3em_agent/config/config.go +++ b/src/cmd/services/m3em_agent/config/config.go @@ -23,10 +23,10 @@ package agentmain import ( "io/ioutil" - xgrpc "github.com/m3db/m3/src/m3em/x/grpc" - tallym3 "github.com/uber-go/tally/m3" "google.golang.org/grpc/credentials" + + xgrpc "github.com/m3db/m3/src/m3em/x/grpc" ) // Configuration is a collection of knobs to configure m3em_agent processes diff --git a/src/cmd/services/m3query/config/config_test.go b/src/cmd/services/m3query/config/config_test.go index 0d5cd69a22..11bb6c1eae 100644 --- a/src/cmd/services/m3query/config/config_test.go +++ b/src/cmd/services/m3query/config/config_test.go @@ -25,16 +25,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "gopkg.in/validator.v2" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage" xconfig "github.com/m3db/m3/src/x/config" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/validator.v2" - "gopkg.in/yaml.v2" ) const testConfigFile = "./testdata/config.yml" diff --git a/src/cmd/services/m3query/config/remote_config_test.go b/src/cmd/services/m3query/config/remote_config_test.go index cc913243f6..431d880b8a 100644 --- a/src/cmd/services/m3query/config/remote_config_test.go +++ b/src/cmd/services/m3query/config/remote_config_test.go @@ -23,11 +23,11 @@ package config import ( "testing" - "github.com/m3db/m3/src/query/storage" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/query/storage" ) func TestMakeRemote(t *testing.T) { diff --git a/src/cmd/tools/annotation_checker/main/main.go b/src/cmd/tools/annotation_checker/main/main.go index b7aa2aa5c2..d8311666b7 100644 --- a/src/cmd/tools/annotation_checker/main/main.go +++ b/src/cmd/tools/annotation_checker/main/main.go @@ -30,6 +30,9 @@ import ( "sort" "strconv" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/persist" @@ -39,9 +42,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) const ( diff --git a/src/cmd/tools/clone_fileset/main/main.go b/src/cmd/tools/clone_fileset/main/main.go index 49d5ab8c5d..b547753a74 100644 --- a/src/cmd/tools/clone_fileset/main/main.go +++ b/src/cmd/tools/clone_fileset/main/main.go @@ -25,10 +25,10 @@ import ( "log" "os" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist/fs/clone" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) var ( diff --git a/src/cmd/tools/dtest/config/config.go b/src/cmd/tools/dtest/config/config.go index 04ab3d15a2..71ac542076 100644 --- a/src/cmd/tools/dtest/config/config.go +++ b/src/cmd/tools/dtest/config/config.go @@ -25,6 +25,10 @@ import ( "io/ioutil" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + etcdclient "github.com/m3db/m3/src/cluster/client/etcd" "github.com/m3db/m3/src/cluster/placement" m3emnode "github.com/m3db/m3/src/dbnode/x/m3em/node" @@ -33,10 +37,6 @@ import ( "github.com/m3db/m3/src/m3em/node" "github.com/m3db/m3/src/m3em/x/grpc" xconfig "github.com/m3db/m3/src/x/config" - - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) // Configuration is a collection of knobs to control test behavior diff --git a/src/cmd/tools/dtest/config/opts.go b/src/cmd/tools/dtest/config/opts.go index dd03123174..e18ff78322 100644 --- a/src/cmd/tools/dtest/config/opts.go +++ b/src/cmd/tools/dtest/config/opts.go @@ -23,9 +23,9 @@ package config import ( "fmt" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/spf13/cobra" + + xerrors "github.com/m3db/m3/src/x/errors" ) // Args represents the CLI arguments to be set during a dtest diff --git a/src/cmd/tools/dtest/harness/harness.go b/src/cmd/tools/dtest/harness/harness.go index 2a7953e341..6260e20de2 100644 --- a/src/cmd/tools/dtest/harness/harness.go +++ b/src/cmd/tools/dtest/harness/harness.go @@ -33,6 +33,9 @@ import ( "sync/atomic" "time" + "github.com/gogo/protobuf/proto" + "go.uber.org/zap" + etcdclient "github.com/m3db/m3/src/cluster/client/etcd" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" @@ -56,9 +59,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtcp "github.com/m3db/m3/src/x/tcp" - - "github.com/gogo/protobuf/proto" - "go.uber.org/zap" ) const ( diff --git a/src/cmd/tools/dtest/tests/add_down_node_bring_up.go b/src/cmd/tools/dtest/tests/add_down_node_bring_up.go index e8a1b36f05..9efa6eee4a 100644 --- a/src/cmd/tools/dtest/tests/add_down_node_bring_up.go +++ b/src/cmd/tools/dtest/tests/add_down_node_bring_up.go @@ -21,10 +21,10 @@ package dtests import ( + "github.com/spf13/cobra" + "github.com/m3db/m3/src/cmd/tools/dtest/harness" "github.com/m3db/m3/src/m3em/node" - - "github.com/spf13/cobra" ) var ( diff --git a/src/cmd/tools/dtest/tests/add_up_node_remove.go b/src/cmd/tools/dtest/tests/add_up_node_remove.go index c0cb70c48d..f0dba3bd34 100644 --- a/src/cmd/tools/dtest/tests/add_up_node_remove.go +++ b/src/cmd/tools/dtest/tests/add_up_node_remove.go @@ -21,11 +21,11 @@ package dtests import ( + "github.com/spf13/cobra" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/cmd/tools/dtest/harness" xclock "github.com/m3db/m3/src/x/clock" - - "github.com/spf13/cobra" ) var ( diff --git a/src/cmd/tools/dtest/tests/dtest.go b/src/cmd/tools/dtest/tests/dtest.go index ab6b6d82e3..b7bdb4a07f 100644 --- a/src/cmd/tools/dtest/tests/dtest.go +++ b/src/cmd/tools/dtest/tests/dtest.go @@ -24,10 +24,10 @@ import ( "fmt" "os" - "github.com/m3db/m3/src/cmd/tools/dtest/config" - "github.com/spf13/cobra" "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/dtest/config" ) var ( diff --git a/src/cmd/tools/dtest/tests/remove_down_node.go b/src/cmd/tools/dtest/tests/remove_down_node.go index 180f9b6291..295b793511 100644 --- a/src/cmd/tools/dtest/tests/remove_down_node.go +++ b/src/cmd/tools/dtest/tests/remove_down_node.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var removeDownNodeTestCmd = &cobra.Command{ diff --git a/src/cmd/tools/dtest/tests/remove_up_node.go b/src/cmd/tools/dtest/tests/remove_up_node.go index 87325a43f5..bcc7bd4951 100644 --- a/src/cmd/tools/dtest/tests/remove_up_node.go +++ b/src/cmd/tools/dtest/tests/remove_up_node.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var removeUpNodeTestCmd = &cobra.Command{ diff --git a/src/cmd/tools/dtest/tests/replace_down_node.go b/src/cmd/tools/dtest/tests/replace_down_node.go index 02b68dc23f..035b4ce1da 100644 --- a/src/cmd/tools/dtest/tests/replace_down_node.go +++ b/src/cmd/tools/dtest/tests/replace_down_node.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var ( diff --git a/src/cmd/tools/dtest/tests/replace_up_node.go b/src/cmd/tools/dtest/tests/replace_up_node.go index 52b89aec70..1ef1e21647 100644 --- a/src/cmd/tools/dtest/tests/replace_up_node.go +++ b/src/cmd/tools/dtest/tests/replace_up_node.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var ( diff --git a/src/cmd/tools/dtest/tests/replace_up_node_remove.go b/src/cmd/tools/dtest/tests/replace_up_node_remove.go index d454bf3da0..532648420d 100644 --- a/src/cmd/tools/dtest/tests/replace_up_node_remove.go +++ b/src/cmd/tools/dtest/tests/replace_up_node_remove.go @@ -21,11 +21,11 @@ package dtests import ( + "github.com/spf13/cobra" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/cmd/tools/dtest/harness" xclock "github.com/m3db/m3/src/x/clock" - - "github.com/spf13/cobra" ) var ( diff --git a/src/cmd/tools/dtest/tests/replace_up_node_remove_unseeded.go b/src/cmd/tools/dtest/tests/replace_up_node_remove_unseeded.go index dd0189f937..c372fee6cc 100644 --- a/src/cmd/tools/dtest/tests/replace_up_node_remove_unseeded.go +++ b/src/cmd/tools/dtest/tests/replace_up_node_remove_unseeded.go @@ -21,11 +21,11 @@ package dtests import ( + "github.com/spf13/cobra" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/cmd/tools/dtest/harness" xclock "github.com/m3db/m3/src/x/clock" - - "github.com/spf13/cobra" ) var ( diff --git a/src/cmd/tools/dtest/tests/seeded_bootstrap.go b/src/cmd/tools/dtest/tests/seeded_bootstrap.go index fa7058576e..f0bde2b247 100644 --- a/src/cmd/tools/dtest/tests/seeded_bootstrap.go +++ b/src/cmd/tools/dtest/tests/seeded_bootstrap.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var seededBootstrapTestCmd = &cobra.Command{ diff --git a/src/cmd/tools/dtest/tests/simple_bootstrap.go b/src/cmd/tools/dtest/tests/simple_bootstrap.go index 3dc6e745f6..375951d187 100644 --- a/src/cmd/tools/dtest/tests/simple_bootstrap.go +++ b/src/cmd/tools/dtest/tests/simple_bootstrap.go @@ -21,9 +21,9 @@ package dtests import ( - "github.com/m3db/m3/src/cmd/tools/dtest/harness" - "github.com/spf13/cobra" + + "github.com/m3db/m3/src/cmd/tools/dtest/harness" ) var simpleBootstrapTestCmd = &cobra.Command{ diff --git a/src/cmd/tools/dtest/util/listener.go b/src/cmd/tools/dtest/util/listener.go index 22aba1a5c5..446bad6264 100644 --- a/src/cmd/tools/dtest/util/listener.go +++ b/src/cmd/tools/dtest/util/listener.go @@ -26,9 +26,9 @@ import ( "path" "time" - "github.com/m3db/m3/src/m3em/node" - "go.uber.org/zap" + + "github.com/m3db/m3/src/m3em/node" ) const ( diff --git a/src/cmd/tools/dtest/util/seed/generator.go b/src/cmd/tools/dtest/util/seed/generator.go index fa346564c5..1ef79afdfc 100644 --- a/src/cmd/tools/dtest/util/seed/generator.go +++ b/src/cmd/tools/dtest/util/seed/generator.go @@ -24,14 +24,14 @@ import ( "fmt" "math/rand" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/integration/generate" ns "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) // specific to data generation diff --git a/src/cmd/tools/dtest/util/seed/generator_test.go b/src/cmd/tools/dtest/util/seed/generator_test.go index 31a73196dc..f881ac5338 100644 --- a/src/cmd/tools/dtest/util/seed/generator_test.go +++ b/src/cmd/tools/dtest/util/seed/generator_test.go @@ -32,15 +32,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "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/x/ident" "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/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestGenerator(t *testing.T) { diff --git a/src/cmd/tools/dtest/util/watcher.go b/src/cmd/tools/dtest/util/watcher.go index 829f074aac..b312e228f7 100644 --- a/src/cmd/tools/dtest/util/watcher.go +++ b/src/cmd/tools/dtest/util/watcher.go @@ -27,10 +27,10 @@ import ( "sync" "time" + "go.uber.org/zap" + m3emnode "github.com/m3db/m3/src/dbnode/x/m3em/node" xclock "github.com/m3db/m3/src/x/clock" - - "go.uber.org/zap" ) type nodesWatcher struct { diff --git a/src/cmd/tools/m3ctl/main/main.go b/src/cmd/tools/m3ctl/main/main.go index 35a3b2119e..edcaf83db6 100644 --- a/src/cmd/tools/m3ctl/main/main.go +++ b/src/cmd/tools/m3ctl/main/main.go @@ -27,16 +27,16 @@ import ( "os" "strings" + "github.com/gogo/protobuf/jsonpb" + "github.com/spf13/cobra" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cmd/tools/m3ctl/apply" "github.com/m3db/m3/src/cmd/tools/m3ctl/namespaces" "github.com/m3db/m3/src/cmd/tools/m3ctl/placements" "github.com/m3db/m3/src/cmd/tools/m3ctl/topics" "github.com/m3db/m3/src/query/generated/proto/admin" - - "github.com/gogo/protobuf/jsonpb" - "github.com/spf13/cobra" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/src/cmd/tools/m3ctl/namespaces/delete.go b/src/cmd/tools/m3ctl/namespaces/delete.go index 4feafe49eb..ab0bb7ba08 100644 --- a/src/cmd/tools/m3ctl/namespaces/delete.go +++ b/src/cmd/tools/m3ctl/namespaces/delete.go @@ -23,8 +23,9 @@ package namespaces import ( "fmt" - "github.com/m3db/m3/src/cmd/tools/m3ctl/client" "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/m3ctl/client" ) // DoDelete calls the delete namespaces api on the backend diff --git a/src/cmd/tools/m3ctl/placements/delete.go b/src/cmd/tools/m3ctl/placements/delete.go index a341d69983..890dc5f18c 100644 --- a/src/cmd/tools/m3ctl/placements/delete.go +++ b/src/cmd/tools/m3ctl/placements/delete.go @@ -23,9 +23,9 @@ package placements import ( "fmt" - "github.com/m3db/m3/src/cmd/tools/m3ctl/client" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/m3ctl/client" ) // DoDelete does the delete api calls for placements diff --git a/src/cmd/tools/m3ctl/placements/get.go b/src/cmd/tools/m3ctl/placements/get.go index fe8b1943c7..bffe560df3 100644 --- a/src/cmd/tools/m3ctl/placements/get.go +++ b/src/cmd/tools/m3ctl/placements/get.go @@ -23,9 +23,9 @@ package placements import ( "fmt" - "github.com/m3db/m3/src/cmd/tools/m3ctl/client" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/m3ctl/client" ) // DoGet calls the backend api for get placements diff --git a/src/cmd/tools/m3ctl/topics/delete.go b/src/cmd/tools/m3ctl/topics/delete.go index 7ff9be9ac8..b08b9b7222 100644 --- a/src/cmd/tools/m3ctl/topics/delete.go +++ b/src/cmd/tools/m3ctl/topics/delete.go @@ -24,9 +24,9 @@ package topics import ( "fmt" - "github.com/m3db/m3/src/cmd/tools/m3ctl/client" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/m3ctl/client" ) // DoDelete does the delete api calls for topics diff --git a/src/cmd/tools/m3ctl/topics/get.go b/src/cmd/tools/m3ctl/topics/get.go index f42e8d1744..403698720e 100644 --- a/src/cmd/tools/m3ctl/topics/get.go +++ b/src/cmd/tools/m3ctl/topics/get.go @@ -24,9 +24,9 @@ package topics import ( "fmt" - "github.com/m3db/m3/src/cmd/tools/m3ctl/client" - "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/tools/m3ctl/client" ) // DoGet calls the backend api for get topics diff --git a/src/cmd/tools/m3ctl/yaml/load.go b/src/cmd/tools/m3ctl/yaml/load.go index 34c93a05a9..b21c4a79e4 100644 --- a/src/cmd/tools/m3ctl/yaml/load.go +++ b/src/cmd/tools/m3ctl/yaml/load.go @@ -22,12 +22,12 @@ package yaml import ( "bytes" - "go.uber.org/zap" "io" "io/ioutil" "github.com/gogo/protobuf/jsonpb" "github.com/gogo/protobuf/proto" + "go.uber.org/zap" ) // Load reads a yaml representation of an m3 structure @@ -37,7 +37,6 @@ import ( // so peek at it to see what's the intended action then load it // // See the examples directories. -// func Load(path string, zl *zap.Logger) (string, io.Reader, error) { content, err := ioutil.ReadFile(path) if err != nil { diff --git a/src/cmd/tools/query_index_segments/main/main.go b/src/cmd/tools/query_index_segments/main/main.go index 76db473e2d..bcaf2579c7 100644 --- a/src/cmd/tools/query_index_segments/main/main.go +++ b/src/cmd/tools/query_index_segments/main/main.go @@ -29,6 +29,10 @@ import ( "sync" "time" + "github.com/pborman/getopt" + "github.com/prometheus/prometheus/model/labels" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/m3ninx/index" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/pborman/getopt" - "github.com/prometheus/prometheus/model/labels" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/tools/read_commitlog/main/main.go b/src/cmd/tools/read_commitlog/main/main.go index 7f85cc9ae6..3a0ec59355 100644 --- a/src/cmd/tools/read_commitlog/main/main.go +++ b/src/cmd/tools/read_commitlog/main/main.go @@ -28,11 +28,11 @@ import ( "sort" "time" - "github.com/m3db/m3/src/x/ident" - xtime "github.com/m3db/m3/src/x/time" - "github.com/pborman/getopt" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/ident" + xtime "github.com/m3db/m3/src/x/time" ) func main() { diff --git a/src/cmd/tools/read_data_files/main/main.go b/src/cmd/tools/read_data_files/main/main.go index 1c7e4cb65a..6b3dd666fe 100644 --- a/src/cmd/tools/read_data_files/main/main.go +++ b/src/cmd/tools/read_data_files/main/main.go @@ -31,6 +31,9 @@ import ( "strings" "time" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/persist" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) const ( diff --git a/src/cmd/tools/read_ids/main/main.go b/src/cmd/tools/read_ids/main/main.go index 0e57a1d436..875b0c658e 100644 --- a/src/cmd/tools/read_ids/main/main.go +++ b/src/cmd/tools/read_ids/main/main.go @@ -28,14 +28,14 @@ import ( "strings" "time" + tchannel "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" nchannel "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/node/channel" "github.com/m3db/m3/src/x/ident" xretry "github.com/m3db/m3/src/x/retry" - - tchannel "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" - "go.uber.org/zap" ) func main() { diff --git a/src/cmd/tools/read_index_files/main/main.go b/src/cmd/tools/read_index_files/main/main.go index 53ce6883e6..54614933f0 100644 --- a/src/cmd/tools/read_index_files/main/main.go +++ b/src/cmd/tools/read_index_files/main/main.go @@ -31,15 +31,15 @@ import ( "sort" "strconv" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/m3ninx/doc" m3ninxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) func main() { diff --git a/src/cmd/tools/read_index_ids/main/main.go b/src/cmd/tools/read_index_ids/main/main.go index 45ba5117f0..604a4035b4 100644 --- a/src/cmd/tools/read_index_ids/main/main.go +++ b/src/cmd/tools/read_index_ids/main/main.go @@ -26,13 +26,13 @@ import ( "log" "os" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/tools" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) func main() { diff --git a/src/cmd/tools/read_index_segments/main/main.go b/src/cmd/tools/read_index_segments/main/main.go index 3cfabc8d54..fe29df3504 100644 --- a/src/cmd/tools/read_index_segments/main/main.go +++ b/src/cmd/tools/read_index_segments/main/main.go @@ -31,15 +31,15 @@ import ( "sync" "time" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/query/util/json" "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" "github.com/m3db/m3/src/x/unsafe" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/tools/split_index_shards/main/main.go b/src/cmd/tools/split_index_shards/main/main.go index 07bcbda783..42865ca68e 100644 --- a/src/cmd/tools/split_index_shards/main/main.go +++ b/src/cmd/tools/split_index_shards/main/main.go @@ -32,6 +32,9 @@ import ( "strings" "time" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -39,9 +42,6 @@ import ( "github.com/m3db/m3/src/x/ident" xos "github.com/m3db/m3/src/x/os" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/tools/split_shards/main/main.go b/src/cmd/tools/split_shards/main/main.go index 083247981a..c97f249aab 100644 --- a/src/cmd/tools/split_shards/main/main.go +++ b/src/cmd/tools/split_shards/main/main.go @@ -34,15 +34,15 @@ import ( "strings" "time" + "github.com/pborman/getopt" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/sharding" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/getopt" - "go.uber.org/zap" ) var checkpointPattern = regexp.MustCompile(`/data/(\w+)/([0-9]+)/fileset-([0-9]+)-([0-9]+)-checkpoint.db$`) diff --git a/src/cmd/tools/verify_data_files/main/main.go b/src/cmd/tools/verify_data_files/main/main.go index 69a4836abf..a10aa611be 100644 --- a/src/cmd/tools/verify_data_files/main/main.go +++ b/src/cmd/tools/verify_data_files/main/main.go @@ -30,6 +30,10 @@ import ( "strconv" "unicode/utf8" + "github.com/pborman/getopt" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cmd/tools" "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" - - "github.com/pborman/getopt" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) func main() { diff --git a/src/cmd/tools/verify_data_files/main/main_test.go b/src/cmd/tools/verify_data_files/main/main_test.go index 2e5511ae0e..51a11afc98 100644 --- a/src/cmd/tools/verify_data_files/main/main_test.go +++ b/src/cmd/tools/verify_data_files/main/main_test.go @@ -28,6 +28,9 @@ import ( "time" "unicode/utf8" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) var ( diff --git a/src/cmd/tools/verify_ids/main/main.go b/src/cmd/tools/verify_ids/main/main.go index a0eb3a139b..40d2e6a7f4 100644 --- a/src/cmd/tools/verify_ids/main/main.go +++ b/src/cmd/tools/verify_ids/main/main.go @@ -36,6 +36,10 @@ import ( "text/tabwriter" "time" + "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + "golang.org/x/exp/slices" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" @@ -44,10 +48,6 @@ import ( "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/idx" - - "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" - "golang.org/x/exp/slices" ) const ( diff --git a/src/ctl/server/http/server.go b/src/ctl/server/http/server.go index b761de4bd5..2f5085d641 100644 --- a/src/ctl/server/http/server.go +++ b/src/ctl/server/http/server.go @@ -24,13 +24,13 @@ import ( "net/http" "sync" - _ "github.com/m3db/m3/src/ctl/generated/ui/statik" // Generated UI statik package - mserver "github.com/m3db/m3/src/ctl/server" - "github.com/m3db/m3/src/ctl/service" - "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "go.uber.org/zap" + + _ "github.com/m3db/m3/src/ctl/generated/ui/statik" // Generated UI statik package + mserver "github.com/m3db/m3/src/ctl/server" + "github.com/m3db/m3/src/ctl/service" ) const ( diff --git a/src/ctl/service/health/service.go b/src/ctl/service/health/service.go index ca966edeb8..8ac9e126d7 100644 --- a/src/ctl/service/health/service.go +++ b/src/ctl/service/health/service.go @@ -27,10 +27,10 @@ import ( "os" "time" + "github.com/gorilla/mux" + mservice "github.com/m3db/m3/src/ctl/service" "github.com/m3db/m3/src/x/instrument" - - "github.com/gorilla/mux" ) const ( diff --git a/src/ctl/service/health/service_test.go b/src/ctl/service/health/service_test.go index 3021429ca9..735cc42e53 100644 --- a/src/ctl/service/health/service_test.go +++ b/src/ctl/service/health/service_test.go @@ -27,10 +27,10 @@ import ( "os" "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/gorilla/mux" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/instrument" ) func TestHostName(t *testing.T) { diff --git a/src/ctl/service/r2/handler.go b/src/ctl/service/r2/handler.go index d7709f0c56..184f268cf9 100644 --- a/src/ctl/service/r2/handler.go +++ b/src/ctl/service/r2/handler.go @@ -24,10 +24,10 @@ import ( "fmt" "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/ctl/auth" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) type r2HandlerFunc func(http.ResponseWriter, *http.Request) error diff --git a/src/ctl/service/r2/io.go b/src/ctl/service/r2/io.go index 7b5f13368e..a6fa4fe2ad 100644 --- a/src/ctl/service/r2/io.go +++ b/src/ctl/service/r2/io.go @@ -28,9 +28,9 @@ import ( "reflect" "strings" - "github.com/m3db/m3/src/metrics/rules/view/changes" - validator "gopkg.in/go-playground/validator.v9" + + "github.com/m3db/m3/src/metrics/rules/view/changes" ) // TODO(dgromov): Make this return a list of validation errors diff --git a/src/ctl/service/r2/routes.go b/src/ctl/service/r2/routes.go index 9dd0e50805..eb68a82724 100644 --- a/src/ctl/service/r2/routes.go +++ b/src/ctl/service/r2/routes.go @@ -24,9 +24,9 @@ import ( "fmt" "net/http" - "github.com/m3db/m3/src/metrics/rules/view" - "github.com/gorilla/mux" + + "github.com/m3db/m3/src/metrics/rules/view" ) func fetchNamespaces(s *service, _ *http.Request) (data interface{}, err error) { diff --git a/src/ctl/service/r2/routes_test.go b/src/ctl/service/r2/routes_test.go index eb0b5ba823..c5ed11e5c8 100644 --- a/src/ctl/service/r2/routes_test.go +++ b/src/ctl/service/r2/routes_test.go @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/ctl/auth" "github.com/m3db/m3/src/ctl/service/r2/store" "github.com/m3db/m3/src/metrics/rules" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view/changes" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/gorilla/mux" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestHandleRoute(t *testing.T) { @@ -420,7 +420,7 @@ func (s mockStore) DeleteNamespace(namespaceID string, uOpts store.UpdateOptions return nil } -//nolint: unparam +// nolint: unparam func (s mockStore) FetchRuleSet(namespaceID string) (rules.RuleSet, error) { return newTestRuleSet(1), nil } diff --git a/src/ctl/service/r2/service.go b/src/ctl/service/r2/service.go index debfefbff1..edb08fce84 100644 --- a/src/ctl/service/r2/service.go +++ b/src/ctl/service/r2/service.go @@ -26,15 +26,15 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/ctl/auth" mservice "github.com/m3db/m3/src/ctl/service" "github.com/m3db/m3/src/ctl/service/r2/store" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/gorilla/mux" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/ctl/service/r2/service_test.go b/src/ctl/service/r2/service_test.go index f5f7117ebe..70e1ad7e59 100644 --- a/src/ctl/service/r2/service_test.go +++ b/src/ctl/service/r2/service_test.go @@ -23,9 +23,9 @@ import ( "net/http" "testing" - "github.com/m3db/m3/src/ctl/auth" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/ctl/auth" ) func TestDefaultAuthorizationTypeForHTTPMethodGet(t *testing.T) { diff --git a/src/ctl/service/r2/store/kv/store_test.go b/src/ctl/service/r2/store/kv/store_test.go index d1742d5c96..249a32569e 100644 --- a/src/ctl/service/r2/store/kv/store_test.go +++ b/src/ctl/service/r2/store/kv/store_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/ctl/service/r2" r2store "github.com/m3db/m3/src/ctl/service/r2/store" "github.com/m3db/m3/src/metrics/aggregation" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/metrics/rules/view/changes" "github.com/m3db/m3/src/x/clock" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestUpdateRuleSet(t *testing.T) { diff --git a/src/ctl/service/r2/store/stub/store.go b/src/ctl/service/r2/store/stub/store.go index f3f88c29a0..a9389df0f8 100644 --- a/src/ctl/service/r2/store/stub/store.go +++ b/src/ctl/service/r2/store/stub/store.go @@ -25,6 +25,8 @@ import ( "fmt" "time" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/ctl/service/r2" r2store "github.com/m3db/m3/src/ctl/service/r2/store" "github.com/m3db/m3/src/metrics/aggregation" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view/changes" "github.com/m3db/m3/src/metrics/x/bytes" "github.com/m3db/m3/src/x/instrument" - - "github.com/pborman/uuid" ) type mappingRuleHistories map[string][]view.MappingRule diff --git a/src/dbnode/client/aggregate_op_test.go b/src/dbnode/client/aggregate_op_test.go index cc75ac206c..cb8c9f4f5b 100644 --- a/src/dbnode/client/aggregate_op_test.go +++ b/src/dbnode/client/aggregate_op_test.go @@ -24,10 +24,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestAggregateOpPool(t *testing.T) { diff --git a/src/dbnode/client/aggregate_results_accumulator_merge_test.go b/src/dbnode/client/aggregate_results_accumulator_merge_test.go index 74952b249f..aeadfe9b40 100644 --- a/src/dbnode/client/aggregate_results_accumulator_merge_test.go +++ b/src/dbnode/client/aggregate_results_accumulator_merge_test.go @@ -23,12 +23,12 @@ package client import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/client/config_test.go b/src/dbnode/client/config_test.go index 3fd21e5dad..f0fac6ebf4 100644 --- a/src/dbnode/client/config_test.go +++ b/src/dbnode/client/config_test.go @@ -27,13 +27,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/topology" xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/retry" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestConfiguration(t *testing.T) { diff --git a/src/dbnode/client/connection_pool_test.go b/src/dbnode/client/connection_pool_test.go index ff35811653..0dce99c731 100644 --- a/src/dbnode/client/connection_pool_test.go +++ b/src/dbnode/client/connection_pool_test.go @@ -27,13 +27,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/dbnode/topology" - xclock "github.com/m3db/m3/src/x/clock" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/uber/tchannel-go" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/dbnode/topology" + xclock "github.com/m3db/m3/src/x/clock" ) const ( diff --git a/src/dbnode/client/errors.go b/src/dbnode/client/errors.go index fe0a4e5138..25199999a5 100644 --- a/src/dbnode/client/errors.go +++ b/src/dbnode/client/errors.go @@ -24,11 +24,11 @@ import ( "fmt" "sync" + "github.com/uber/tchannel-go" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" tterrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/uber/tchannel-go" ) // IsInternalServerError determines if the error is an internal server error. diff --git a/src/dbnode/client/errors_test.go b/src/dbnode/client/errors_test.go index a411a03cab..05af4a8c06 100644 --- a/src/dbnode/client/errors_test.go +++ b/src/dbnode/client/errors_test.go @@ -25,13 +25,13 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/uber/tchannel-go" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" "github.com/m3db/m3/src/dbnode/topology" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/stretchr/testify/assert" - "github.com/uber/tchannel-go" ) func TestConsistencyResultError(t *testing.T) { diff --git a/src/dbnode/client/fetch_state_pool.go b/src/dbnode/client/fetch_state_pool.go index 996da9cb7b..8394275a00 100644 --- a/src/dbnode/client/fetch_state_pool.go +++ b/src/dbnode/client/fetch_state_pool.go @@ -23,12 +23,11 @@ package client import ( "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/topology" - "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/sampler" - - "go.uber.org/zap" ) type fetchStatePool interface { @@ -41,7 +40,6 @@ type fetchStatePool interface { type fetchStatePoolImpl struct { pool pool.ObjectPool - instrumentOpts instrument.Options logger *zap.Logger logHostErrorSampler *sampler.Sampler } diff --git a/src/dbnode/client/fetch_state_pool_test.go b/src/dbnode/client/fetch_state_pool_test.go index 5f3209d3d2..7e0835f4a2 100644 --- a/src/dbnode/client/fetch_state_pool_test.go +++ b/src/dbnode/client/fetch_state_pool_test.go @@ -23,11 +23,11 @@ package client import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/m3db/m3/src/x/sampler" - "github.com/stretchr/testify/require" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/pool" + "github.com/m3db/m3/src/x/sampler" ) func TestFetchStatePool(t *testing.T) { diff --git a/src/dbnode/client/fetch_state_test.go b/src/dbnode/client/fetch_state_test.go index 401473c59d..6f310950a9 100644 --- a/src/dbnode/client/fetch_state_test.go +++ b/src/dbnode/client/fetch_state_test.go @@ -23,11 +23,11 @@ package client import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/m3db/m3/src/x/sampler" - "github.com/stretchr/testify/require" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/pool" + "github.com/m3db/m3/src/x/sampler" ) func TestFetchStatePoolInvalidInteraction(t *testing.T) { diff --git a/src/dbnode/client/fetch_tagged_op_test.go b/src/dbnode/client/fetch_tagged_op_test.go index 3b77931ced..54c05cbb88 100644 --- a/src/dbnode/client/fetch_tagged_op_test.go +++ b/src/dbnode/client/fetch_tagged_op_test.go @@ -24,10 +24,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestFetchTaggedOpPool(t *testing.T) { diff --git a/src/dbnode/client/fetch_tagged_results_accumulator_consistency_prop_test.go b/src/dbnode/client/fetch_tagged_results_accumulator_consistency_prop_test.go index 64155d0f65..fa2fb47751 100644 --- a/src/dbnode/client/fetch_tagged_results_accumulator_consistency_prop_test.go +++ b/src/dbnode/client/fetch_tagged_results_accumulator_consistency_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -31,15 +33,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/shard" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/dbnode/topology" - "github.com/m3db/m3/src/dbnode/topology/testutil" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/shard" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/dbnode/topology" + "github.com/m3db/m3/src/dbnode/topology/testutil" ) const maxNumHostsPropTest = 10 diff --git a/src/dbnode/client/fetch_tagged_results_accumulator_merge_test.go b/src/dbnode/client/fetch_tagged_results_accumulator_merge_test.go index 673a0c2506..4c41edcd84 100644 --- a/src/dbnode/client/fetch_tagged_results_accumulator_merge_test.go +++ b/src/dbnode/client/fetch_tagged_results_accumulator_merge_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -38,9 +41,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( @@ -374,7 +374,7 @@ func (ts testSerieses) nsplit(n int) []testSerieses { return groups } -//nolint: unparam +// nolint: unparam func (ts testSerieses) addDatapoints(numPerSeries int, start, end xtime.UnixNano) { dps := newTestDatapoints(numPerSeries, start, end) for i := range ts { diff --git a/src/dbnode/client/fetch_tagged_results_accumulator_misc_test.go b/src/dbnode/client/fetch_tagged_results_accumulator_misc_test.go index 6fdf1e7869..d2108a6cab 100644 --- a/src/dbnode/client/fetch_tagged_results_accumulator_misc_test.go +++ b/src/dbnode/client/fetch_tagged_results_accumulator_misc_test.go @@ -28,6 +28,11 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/require" ) func TestFetchTaggedResultsAccumulatorClearResetsState(t *testing.T) { diff --git a/src/dbnode/client/fetch_tagged_results_index_iterator_test.go b/src/dbnode/client/fetch_tagged_results_index_iterator_test.go index 14a94a5ddb..8d5c6725cd 100644 --- a/src/dbnode/client/fetch_tagged_results_index_iterator_test.go +++ b/src/dbnode/client/fetch_tagged_results_index_iterator_test.go @@ -23,11 +23,11 @@ package client import ( "testing" - "github.com/m3db/m3/src/x/serialize" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/serialize" ) func TestFetchTaggedResultsIndexIterator(t *testing.T) { diff --git a/src/dbnode/client/host_queue.go b/src/dbnode/client/host_queue.go index c600dd6389..080a19a9c2 100644 --- a/src/dbnode/client/host_queue.go +++ b/src/dbnode/client/host_queue.go @@ -29,15 +29,15 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber-go/tally" - "github.com/uber/tchannel-go/thrift" ) const _defaultHostQueueOpsArraySize = 8 diff --git a/src/dbnode/client/host_queue_aggregate_test.go b/src/dbnode/client/host_queue_aggregate_test.go index 517ae500e7..ec8e2d6a3e 100644 --- a/src/dbnode/client/host_queue_aggregate_test.go +++ b/src/dbnode/client/host_queue_aggregate_test.go @@ -26,13 +26,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - xtest "github.com/m3db/m3/src/x/test" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + xtest "github.com/m3db/m3/src/x/test" ) func TestHostQueueDrainOnCloseAggregate(t *testing.T) { diff --git a/src/dbnode/client/host_queue_fetch_batch_test.go b/src/dbnode/client/host_queue_fetch_batch_test.go index ef3138b527..4649dfb2b4 100644 --- a/src/dbnode/client/host_queue_fetch_batch_test.go +++ b/src/dbnode/client/host_queue_fetch_batch_test.go @@ -25,11 +25,11 @@ import ( "sync" "testing" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" ) func TestHostQueueFetchBatches(t *testing.T) { diff --git a/src/dbnode/client/host_queue_fetch_tagged_test.go b/src/dbnode/client/host_queue_fetch_tagged_test.go index cd69e0d927..593dc931ff 100644 --- a/src/dbnode/client/host_queue_fetch_tagged_test.go +++ b/src/dbnode/client/host_queue_fetch_tagged_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" ) func TestHostQueueDrainOnCloseFetchTagged(t *testing.T) { diff --git a/src/dbnode/client/host_queue_write_batch_test.go b/src/dbnode/client/host_queue_write_batch_test.go index 797ec178c7..f4495b1fa8 100644 --- a/src/dbnode/client/host_queue_write_batch_test.go +++ b/src/dbnode/client/host_queue_write_batch_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/x/ident" ) func TestHostQueueWriteErrorBeforeOpen(t *testing.T) { diff --git a/src/dbnode/client/host_queue_write_tagged_test.go b/src/dbnode/client/host_queue_write_tagged_test.go index 48d4d7f2f9..9ddc3bd4a7 100644 --- a/src/dbnode/client/host_queue_write_tagged_test.go +++ b/src/dbnode/client/host_queue_write_tagged_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/x/ident" ) func TestHostQueueWriteTaggedErrorBeforeOpen(t *testing.T) { diff --git a/src/dbnode/client/iterator_matcher.go b/src/dbnode/client/iterator_matcher.go index 8d499c1801..0fb791286a 100644 --- a/src/dbnode/client/iterator_matcher.go +++ b/src/dbnode/client/iterator_matcher.go @@ -23,9 +23,9 @@ package client import ( "fmt" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" + + "github.com/m3db/m3/src/x/ident" ) // TaggedIDsIteratorMatcher is a gomock.Matcher that matches TaggedIDsIterator. diff --git a/src/dbnode/client/iterator_matcher_test.go b/src/dbnode/client/iterator_matcher_test.go index 61687a6510..9744f33259 100644 --- a/src/dbnode/client/iterator_matcher_test.go +++ b/src/dbnode/client/iterator_matcher_test.go @@ -23,11 +23,11 @@ package client_test import ( "testing" - "github.com/m3db/m3/src/dbnode/client" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/client" + "github.com/m3db/m3/src/x/ident" ) func TestTaggedIDsIteratorMatcherMatches(t *testing.T) { diff --git a/src/dbnode/client/options.go b/src/dbnode/client/options.go index 614ffeef4e..cbfbe28e0b 100644 --- a/src/dbnode/client/options.go +++ b/src/dbnode/client/options.go @@ -26,6 +26,9 @@ import ( "runtime" "time" + "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/encoding/proto" @@ -46,9 +49,6 @@ import ( "github.com/m3db/m3/src/x/sampler" "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" ) const ( diff --git a/src/dbnode/client/received_blocks_new_map.go b/src/dbnode/client/received_blocks_new_map.go index 7a32344192..74f7cbd4b2 100644 --- a/src/dbnode/client/received_blocks_new_map.go +++ b/src/dbnode/client/received_blocks_new_map.go @@ -21,10 +21,10 @@ package client import ( + "github.com/cespare/xxhash/v2" + "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" - - "github.com/cespare/xxhash/v2" ) func newReceivedBlocksMap(pool pool.BytesPool) *receivedBlocksMap { diff --git a/src/dbnode/client/session.go b/src/dbnode/client/session.go index bb2ac91561..a22e97c7b5 100644 --- a/src/dbnode/client/session.go +++ b/src/dbnode/client/session.go @@ -32,6 +32,11 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "github.com/uber/tchannel-go/thrift" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/encoding" @@ -61,11 +66,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" tbinarypool "github.com/m3db/m3/src/x/thrift" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "github.com/uber/tchannel-go/thrift" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/src/dbnode/client/session_aggregate_test.go b/src/dbnode/client/session_aggregate_test.go index f8ba14a69b..3f4a2fc216 100644 --- a/src/dbnode/client/session_aggregate_test.go +++ b/src/dbnode/client/session_aggregate_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/topology" @@ -36,10 +40,6 @@ import ( xretry "github.com/m3db/m3/src/x/retry" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/client/session_fetch_bulk_blocks_test.go b/src/dbnode/client/session_fetch_bulk_blocks_test.go index 6582a88d36..92c4f88cb2 100644 --- a/src/dbnode/client/session_fetch_bulk_blocks_test.go +++ b/src/dbnode/client/session_fetch_bulk_blocks_test.go @@ -31,6 +31,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" @@ -50,10 +54,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/client/session_fetch_metadata_test.go b/src/dbnode/client/session_fetch_metadata_test.go index e92ccf1926..4c72bea99e 100644 --- a/src/dbnode/client/session_fetch_metadata_test.go +++ b/src/dbnode/client/session_fetch_metadata_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testHostBlock struct { diff --git a/src/dbnode/client/session_fetch_tagged_test.go b/src/dbnode/client/session_fetch_tagged_test.go index 5a305387fd..b90f06311d 100644 --- a/src/dbnode/client/session_fetch_tagged_test.go +++ b/src/dbnode/client/session_fetch_tagged_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/topology" @@ -38,10 +42,6 @@ import ( xretry "github.com/m3db/m3/src/x/retry" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/client/session_fetch_test.go b/src/dbnode/client/session_fetch_test.go index 6c16dc52a3..c8cd0dadad 100644 --- a/src/dbnode/client/session_fetch_test.go +++ b/src/dbnode/client/session_fetch_test.go @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -41,11 +46,6 @@ import ( "github.com/m3db/m3/src/x/ident" xretry "github.com/m3db/m3/src/x/retry" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) const ( diff --git a/src/dbnode/client/session_proto_test.go b/src/dbnode/client/session_proto_test.go index 2a1d6c56a1..f0ee9c682d 100644 --- a/src/dbnode/client/session_proto_test.go +++ b/src/dbnode/client/session_proto_test.go @@ -25,16 +25,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/encoding" - "github.com/m3db/m3/src/dbnode/testdata/prototest" - "github.com/m3db/m3/src/x/ident" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/dbnode/testdata/prototest" "github.com/m3db/m3/src/dbnode/ts" + "github.com/m3db/m3/src/x/ident" + xtime "github.com/m3db/m3/src/x/time" ) var ( diff --git a/src/dbnode/client/session_test.go b/src/dbnode/client/session_test.go index 1d11cfa187..9ffd126c98 100644 --- a/src/dbnode/client/session_test.go +++ b/src/dbnode/client/session_test.go @@ -30,6 +30,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -44,10 +48,6 @@ import ( "github.com/m3db/m3/src/x/sampler" "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/client/session_topology_test.go b/src/dbnode/client/session_topology_test.go index 4bd429665d..013a3c52bb 100644 --- a/src/dbnode/client/session_topology_test.go +++ b/src/dbnode/client/session_topology_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/cluster/shard" - "github.com/m3db/m3/src/dbnode/integration/fake" - "github.com/m3db/m3/src/dbnode/topology" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/cluster/shard" + "github.com/m3db/m3/src/dbnode/integration/fake" + "github.com/m3db/m3/src/dbnode/topology" ) type testHostQueues struct { diff --git a/src/dbnode/client/session_truncate_test.go b/src/dbnode/client/session_truncate_test.go index eaa711a695..e6aba12d0e 100644 --- a/src/dbnode/client/session_truncate_test.go +++ b/src/dbnode/client/session_truncate_test.go @@ -24,12 +24,12 @@ import ( "math/rand" "testing" - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/x/ident" ) func TestTruncate(t *testing.T) { diff --git a/src/dbnode/client/session_write_tagged_test.go b/src/dbnode/client/session_write_tagged_test.go index 4cd1f1befc..b172c27440 100644 --- a/src/dbnode/client/session_write_tagged_test.go +++ b/src/dbnode/client/session_write_tagged_test.go @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/topology" xmetrics "github.com/m3db/m3/src/dbnode/x/metrics" @@ -40,11 +45,6 @@ import ( xm3test "github.com/m3db/m3/src/x/test" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestSessionWriteTaggedNotOpenError(t *testing.T) { diff --git a/src/dbnode/client/session_write_test.go b/src/dbnode/client/session_write_test.go index 8fe6cd5640..b5ce823991 100644 --- a/src/dbnode/client/session_write_test.go +++ b/src/dbnode/client/session_write_test.go @@ -29,6 +29,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/topology" xmetrics "github.com/m3db/m3/src/dbnode/x/metrics" @@ -38,11 +43,6 @@ import ( xretry "github.com/m3db/m3/src/x/retry" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestSessionWriteNotOpenError(t *testing.T) { diff --git a/src/dbnode/client/types.go b/src/dbnode/client/types.go index a9e49c55b5..d2f016fd65 100644 --- a/src/dbnode/client/types.go +++ b/src/dbnode/client/types.go @@ -24,6 +24,9 @@ import ( gocontext "context" "time" + "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -43,9 +46,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" ) // Client can create sessions to write and read to a cluster. diff --git a/src/dbnode/client/write_state.go b/src/dbnode/client/write_state.go index 7512b59d56..e0e746ca59 100644 --- a/src/dbnode/client/write_state.go +++ b/src/dbnode/client/write_state.go @@ -25,6 +25,8 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/checked" @@ -33,8 +35,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/sampler" "github.com/m3db/m3/src/x/serialize" - - "go.uber.org/zap" ) type countTowardsConsistency int64 diff --git a/src/dbnode/client/write_tagged_test.go b/src/dbnode/client/write_tagged_test.go index 6b0c26a0ae..7856b8656a 100644 --- a/src/dbnode/client/write_tagged_test.go +++ b/src/dbnode/client/write_tagged_test.go @@ -25,16 +25,16 @@ import ( "sync" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" tterrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/checked" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // shard state tests diff --git a/src/dbnode/client/write_test.go b/src/dbnode/client/write_test.go index c55d6f411b..997413da09 100644 --- a/src/dbnode/client/write_test.go +++ b/src/dbnode/client/write_test.go @@ -25,16 +25,16 @@ import ( "sync" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" tterrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/checked" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // shard state tests diff --git a/src/dbnode/encoding/annotation_holder_test.go b/src/dbnode/encoding/annotation_holder_test.go index 735358603a..b433fe3167 100644 --- a/src/dbnode/encoding/annotation_holder_test.go +++ b/src/dbnode/encoding/annotation_holder_test.go @@ -24,9 +24,9 @@ import ( "bytes" "testing" - "github.com/m3db/m3/src/dbnode/ts" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/dbnode/ts" ) var annotationHolderTests = []struct { diff --git a/src/dbnode/encoding/iterators_test.go b/src/dbnode/encoding/iterators_test.go index 272d3487bd..4f9bcb2771 100644 --- a/src/dbnode/encoding/iterators_test.go +++ b/src/dbnode/encoding/iterators_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/encoding/m3tsz/decoder_benchmark_test.go b/src/dbnode/encoding/m3tsz/decoder_benchmark_test.go index 964c27b4c3..967069d8b5 100644 --- a/src/dbnode/encoding/m3tsz/decoder_benchmark_test.go +++ b/src/dbnode/encoding/m3tsz/decoder_benchmark_test.go @@ -25,10 +25,10 @@ import ( "math/rand" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/x/xio" - - "github.com/stretchr/testify/require" ) // BenchmarkM3TSZDecode-12 16867 69272 ns/op diff --git a/src/dbnode/encoding/m3tsz/encoder_test.go b/src/dbnode/encoding/m3tsz/encoder_test.go index a91d5fc325..aa76cb36b7 100644 --- a/src/dbnode/encoding/m3tsz/encoder_test.go +++ b/src/dbnode/encoding/m3tsz/encoder_test.go @@ -26,16 +26,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/context" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" ) var ( diff --git a/src/dbnode/encoding/m3tsz/iterator_test.go b/src/dbnode/encoding/m3tsz/iterator_test.go index 017c0a25f3..e3b47b723e 100644 --- a/src/dbnode/encoding/m3tsz/iterator_test.go +++ b/src/dbnode/encoding/m3tsz/iterator_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func getTestReaderIterator(rawBytes []byte) *readerIterator { diff --git a/src/dbnode/encoding/m3tsz/roundtrip_test.go b/src/dbnode/encoding/m3tsz/roundtrip_test.go index 867b8bb5d9..69fceab3f8 100644 --- a/src/dbnode/encoding/m3tsz/roundtrip_test.go +++ b/src/dbnode/encoding/m3tsz/roundtrip_test.go @@ -27,12 +27,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding/testgen" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/context" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestCountsRoundTrip(t *testing.T) { diff --git a/src/dbnode/encoding/m3tsz/timestamp_encoder.go b/src/dbnode/encoding/m3tsz/timestamp_encoder.go index bf153fff0b..4312c8184d 100644 --- a/src/dbnode/encoding/m3tsz/timestamp_encoder.go +++ b/src/dbnode/encoding/m3tsz/timestamp_encoder.go @@ -25,11 +25,11 @@ import ( "fmt" "time" + "github.com/cespare/xxhash/v2" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/cespare/xxhash/v2" ) // TimestampEncoder encapsulates the state required for a logical stream of diff --git a/src/dbnode/encoding/multi_reader_iterator_test.go b/src/dbnode/encoding/multi_reader_iterator_test.go index 3bbd6fc042..82be987145 100644 --- a/src/dbnode/encoding/multi_reader_iterator_test.go +++ b/src/dbnode/encoding/multi_reader_iterator_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/x/xio" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testMultiReader struct { diff --git a/src/dbnode/encoding/ostream_test.go b/src/dbnode/encoding/ostream_test.go index 77ca6894c0..33b47916d1 100644 --- a/src/dbnode/encoding/ostream_test.go +++ b/src/dbnode/encoding/ostream_test.go @@ -23,9 +23,9 @@ package encoding import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) var ( diff --git a/src/dbnode/encoding/proto/benchmarks_test.go b/src/dbnode/encoding/proto/benchmarks_test.go index 922a38704a..61c0eb86ec 100644 --- a/src/dbnode/encoding/proto/benchmarks_test.go +++ b/src/dbnode/encoding/proto/benchmarks_test.go @@ -26,6 +26,7 @@ import ( "time" "github.com/jhump/protoreflect/dynamic" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" diff --git a/src/dbnode/encoding/proto/common.go b/src/dbnode/encoding/proto/common.go index bbe0d77f06..dcc484d202 100644 --- a/src/dbnode/encoding/proto/common.go +++ b/src/dbnode/encoding/proto/common.go @@ -24,10 +24,10 @@ import ( "reflect" "sort" - "github.com/m3db/m3/src/dbnode/encoding/m3tsz" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/jhump/protoreflect/desc" + + "github.com/m3db/m3/src/dbnode/encoding/m3tsz" ) // Schema represents a schema for a protobuf message. diff --git a/src/dbnode/encoding/proto/corruption_prop_test.go b/src/dbnode/encoding/proto/corruption_prop_test.go index c58ae0f78a..80e76fab17 100644 --- a/src/dbnode/encoding/proto/corruption_prop_test.go +++ b/src/dbnode/encoding/proto/corruption_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2019 Uber Technologies, Inc. // diff --git a/src/dbnode/encoding/proto/encoder.go b/src/dbnode/encoding/proto/encoder.go index 935b868ad9..b55bdad58f 100644 --- a/src/dbnode/encoding/proto/encoder.go +++ b/src/dbnode/encoding/proto/encoder.go @@ -25,6 +25,9 @@ import ( "encoding/binary" "fmt" + "github.com/cespare/xxhash/v2" + "github.com/jhump/protoreflect/desc" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/cespare/xxhash/v2" - "github.com/jhump/protoreflect/desc" ) // Make sure encoder implements encoding.Encoder. @@ -872,7 +872,7 @@ func (enc *Encoder) addToBytesDict(fieldIdx int, state encoderBytesFieldDictStat // encodeBitset writes out a bitset in the form of: // -// varint(number of bits)|bitset +// varint(number of bits)|bitset // // I.E first it encodes a varint which specifies the number of following // bits to interpret as a bitset and then it encodes the provided values diff --git a/src/dbnode/encoding/proto/encoder_test.go b/src/dbnode/encoding/proto/encoder_test.go index 9725bd6c90..00c656133e 100644 --- a/src/dbnode/encoding/proto/encoder_test.go +++ b/src/dbnode/encoding/proto/encoder_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/jhump/protoreflect/desc" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/context" xtime "github.com/m3db/m3/src/x/time" - - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/jhump/protoreflect/desc" - "github.com/stretchr/testify/require" ) func TestCustomAndProtoFields(t *testing.T) { diff --git a/src/dbnode/encoding/proto/iterator.go b/src/dbnode/encoding/proto/iterator.go index 25ba78a5d4..325c145122 100644 --- a/src/dbnode/encoding/proto/iterator.go +++ b/src/dbnode/encoding/proto/iterator.go @@ -26,6 +26,9 @@ import ( "io" "math" + dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/jhump/protoreflect/desc" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/jhump/protoreflect/desc" ) const ( diff --git a/src/dbnode/encoding/proto/round_trip_prop_test.go b/src/dbnode/encoding/proto/round_trip_prop_test.go index d5ba037821..1be568a0e4 100644 --- a/src/dbnode/encoding/proto/round_trip_prop_test.go +++ b/src/dbnode/encoding/proto/round_trip_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2019 Uber Technologies, Inc. // @@ -31,12 +33,6 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/m3db/m3/src/dbnode/ts" - "github.com/m3db/m3/src/dbnode/x/xio" - "github.com/m3db/m3/src/x/context" - xtime "github.com/m3db/m3/src/x/time" - dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/desc/builder" @@ -45,6 +41,12 @@ import ( "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/dbnode/ts" + "github.com/m3db/m3/src/dbnode/x/xio" + "github.com/m3db/m3/src/x/context" + xtime "github.com/m3db/m3/src/x/time" ) var ( diff --git a/src/dbnode/encoding/proto/round_trip_test.go b/src/dbnode/encoding/proto/round_trip_test.go index 6b6b1b0be6..e1846d98bb 100644 --- a/src/dbnode/encoding/proto/round_trip_test.go +++ b/src/dbnode/encoding/proto/round_trip_test.go @@ -26,17 +26,17 @@ import ( "testing" "time" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/desc/protoparse" + "github.com/jhump/protoreflect/dynamic" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/jhump/protoreflect/desc" - "github.com/jhump/protoreflect/desc/protoparse" - "github.com/jhump/protoreflect/dynamic" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/encoding/series_iterator_accumulator_test.go b/src/dbnode/encoding/series_iterator_accumulator_test.go index 378a33b91f..24afa06e4b 100644 --- a/src/dbnode/encoding/series_iterator_accumulator_test.go +++ b/src/dbnode/encoding/series_iterator_accumulator_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testAccumulatorSeries struct { diff --git a/src/dbnode/encoding/series_iterator_split_into_blocks_test.go b/src/dbnode/encoding/series_iterator_split_into_blocks_test.go index 1c504f65ea..2dadc12dc9 100644 --- a/src/dbnode/encoding/series_iterator_split_into_blocks_test.go +++ b/src/dbnode/encoding/series_iterator_split_into_blocks_test.go @@ -18,13 +18,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -//TODO(arnikola) convert to example +// TODO(arnikola) convert to example package encoding_test import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type Series struct { diff --git a/src/dbnode/encoding/series_iterator_test.go b/src/dbnode/encoding/series_iterator_test.go index 4297739916..f593c22da2 100644 --- a/src/dbnode/encoding/series_iterator_test.go +++ b/src/dbnode/encoding/series_iterator_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testSeries struct { diff --git a/src/dbnode/environment/config_test.go b/src/dbnode/environment/config_test.go index 6ace9b043b..9ab4bae468 100644 --- a/src/dbnode/environment/config_test.go +++ b/src/dbnode/environment/config_test.go @@ -26,15 +26,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v2" + etcdclient "github.com/m3db/m3/src/cluster/client/etcd" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" ) var initTimeout = time.Minute diff --git a/src/dbnode/integration/admin_session_fetch_blocks_test.go b/src/dbnode/integration/admin_session_fetch_blocks_test.go index d3cbdf3d7f..9aab1050cb 100644 --- a/src/dbnode/integration/admin_session_fetch_blocks_test.go +++ b/src/dbnode/integration/admin_session_fetch_blocks_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -25,6 +26,8 @@ package integration import ( "testing" + "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/storage/block" @@ -32,8 +35,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestAdminSessionFetchBlocksFromPeers(t *testing.T) { diff --git a/src/dbnode/integration/bootstrap_after_buffer_rotation_regression_test.go b/src/dbnode/integration/bootstrap_after_buffer_rotation_regression_test.go index 20ec2d951f..c1864d8bcb 100644 --- a/src/dbnode/integration/bootstrap_after_buffer_rotation_regression_test.go +++ b/src/dbnode/integration/bootstrap_after_buffer_rotation_regression_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "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" @@ -37,8 +40,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) // TestBootstrapAfterBufferRotation was added as a regression test after we identified diff --git a/src/dbnode/integration/bootstrap_before_buffer_rotation_no_tick_regression_test.go b/src/dbnode/integration/bootstrap_before_buffer_rotation_no_tick_regression_test.go index 0a1c308eb3..ffdcdf7f12 100644 --- a/src/dbnode/integration/bootstrap_before_buffer_rotation_no_tick_regression_test.go +++ b/src/dbnode/integration/bootstrap_before_buffer_rotation_no_tick_regression_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "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" @@ -37,8 +40,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) // TestBootstrapBeforeBufferRotationNoTick was added as a regression test after we identified @@ -55,14 +56,16 @@ import ( // which hadn't already been ticked get drained, but the vast majority remain undrained. // Once the tick finishes, the node begins flushing the 12PM->2PM block because the main // requirements for performing a flush are as follows: -// 1) currentTime > blockStart.Add(blockSize).Add(bufferPast) -// 2) node is not bootstrapping (technically shard is not bootstrapping) -// 3) at least one complete tick has occurred since blockStart.Add(blockSize).Add(bufferPast) +// 1. currentTime > blockStart.Add(blockSize).Add(bufferPast) +// 2. node is not bootstrapping (technically shard is not bootstrapping) +// 3. at least one complete tick has occurred since blockStart.Add(blockSize).Add(bufferPast) +// // This flush will lose a large portion of the bootstrapped data because its still stuck in // the undrained series buffer 12PM->12PM bucket. As a result, it became clear that a four invariant // needed to be maintained: -// 4) at least one complete tick has occurred since bootstrap completed (can be the same tick -// that satisfies condition #3) +// 4. at least one complete tick has occurred since bootstrap completed (can be the same tick +// that satisfies condition #3) +// // This integration test ensures that we handle that situation properly by writing out // a commitlog file that has a single write in the active block, then it starts the node // and ensures that a tick starts before bootstrap begins and ends after bootstrap ends. diff --git a/src/dbnode/integration/bootstrap_helpers.go b/src/dbnode/integration/bootstrap_helpers.go index 99d3a176a8..534988a432 100644 --- a/src/dbnode/integration/bootstrap_helpers.go +++ b/src/dbnode/integration/bootstrap_helpers.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -25,14 +26,14 @@ package integration import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" "github.com/m3db/m3/src/dbnode/storage/bootstrap" "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/x/context" - - "github.com/stretchr/testify/require" ) func newTestBootstrapperSource( diff --git a/src/dbnode/integration/bootstrap_retries_test.go b/src/dbnode/integration/bootstrap_retries_test.go index ddd6549198..beceb027d1 100644 --- a/src/dbnode/integration/bootstrap_retries_test.go +++ b/src/dbnode/integration/bootstrap_retries_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage/bootstrap/bootstrapper" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestBootstrapRetriesDueToError(t *testing.T) { diff --git a/src/dbnode/integration/client.go b/src/dbnode/integration/client.go index 4252923bba..a4b5a5ef77 100644 --- a/src/dbnode/integration/client.go +++ b/src/dbnode/integration/client.go @@ -25,6 +25,9 @@ import ( "sync" "time" + "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/integration/generate" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" ) // TestTChannelClient is a test only TChannel client that exposes db methods. diff --git a/src/dbnode/integration/client_load_schema_test.go b/src/dbnode/integration/client_load_schema_test.go index 6b74758a1c..059cf6a58a 100644 --- a/src/dbnode/integration/client_load_schema_test.go +++ b/src/dbnode/integration/client_load_schema_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -28,13 +29,13 @@ import ( "path/filepath" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/ident" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/integration/cluster_add_one_node_test.go b/src/dbnode/integration/cluster_add_one_node_test.go index 1d04c92d25..6e1dda8b92 100644 --- a/src/dbnode/integration/cluster_add_one_node_test.go +++ b/src/dbnode/integration/cluster_add_one_node_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -28,6 +29,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -40,8 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) type idShard struct { diff --git a/src/dbnode/integration/commitlog_bootstrap_coldwrites_test.go b/src/dbnode/integration/commitlog_bootstrap_coldwrites_test.go index 0d5bbdf071..fd6a915a0a 100644 --- a/src/dbnode/integration/commitlog_bootstrap_coldwrites_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_coldwrites_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "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" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapColdWrites(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_helpers.go b/src/dbnode/integration/commitlog_bootstrap_helpers.go index cab97db2af..76fd4c91c0 100644 --- a/src/dbnode/integration/commitlog_bootstrap_helpers.go +++ b/src/dbnode/integration/commitlog_bootstrap_helpers.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -27,6 +28,8 @@ import ( "testing" "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/persist/fs/commitlog" @@ -34,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/integration/commitlog_bootstrap_index_perf_speed_test.go b/src/dbnode/integration/commitlog_bootstrap_index_perf_speed_test.go index e938e767e6..eca3116529 100644 --- a/src/dbnode/integration/commitlog_bootstrap_index_perf_speed_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_index_perf_speed_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -33,6 +34,10 @@ import ( "testing" "time" + "github.com/c2h5oh/datasize" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" @@ -43,10 +48,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/c2h5oh/datasize" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) // TestCommitLogIndexPerfSpeedBootstrap tests the performance of the commit log diff --git a/src/dbnode/integration/commitlog_bootstrap_index_test.go b/src/dbnode/integration/commitlog_bootstrap_index_test.go index df701d23e7..11264b9533 100644 --- a/src/dbnode/integration/commitlog_bootstrap_index_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_index_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,14 +27,14 @@ import ( "testing" "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" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) func TestCommitLogIndexBootstrap(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_merge_test.go b/src/dbnode/integration/commitlog_bootstrap_merge_test.go index a4bb55a3e7..7c32e08d35 100644 --- a/src/dbnode/integration/commitlog_bootstrap_merge_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_merge_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,16 +27,17 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) // Consider a database running with a single namespaces, and the following retention opts: // -// | BlockSize | Retention Period +// | BlockSize | Retention Period +// // ns1 | 2h | 8h // commitLog | 15m | 8h // @@ -43,8 +45,9 @@ import ( // // time (flowing left --> right): // time-label: t0 t1 t2 t3 -// ns1 . . [blocksize . is 2h] -// commitlog ,,,,,,,,, [blocksize , is 30min] +// +// ns1 . . [blocksize . is 2h] +// commitlog ,,,,,,,,, [blocksize , is 30min] // // The test creates the blocks below, and verifies the bootstrappers are able to merge the data // successfully. diff --git a/src/dbnode/integration/commitlog_bootstrap_multi_ns_test.go b/src/dbnode/integration/commitlog_bootstrap_multi_ns_test.go index 0a7c1532cf..f7696c981c 100644 --- a/src/dbnode/integration/commitlog_bootstrap_multi_ns_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_multi_ns_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapMultipleNamespaces(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_only_reads_required_files_test.go b/src/dbnode/integration/commitlog_bootstrap_only_reads_required_files_test.go index 5b946921d5..5eeaf10c8b 100644 --- a/src/dbnode/integration/commitlog_bootstrap_only_reads_required_files_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_only_reads_required_files_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,10 +27,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapOnlyReadsRequiredFiles(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_test.go b/src/dbnode/integration/commitlog_bootstrap_test.go index 8826584f6f..7ecafa00ea 100644 --- a/src/dbnode/integration/commitlog_bootstrap_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestCommitLogBootstrap(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go index ba97fa4936..7a24b756a9 100644 --- a/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_unowned_shard_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. @@ -27,6 +28,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/integration/fake" @@ -34,8 +37,6 @@ import ( "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/topology" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapUnownedShard(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_with_snapshots_after_restart_test.go b/src/dbnode/integration/commitlog_bootstrap_with_snapshots_after_restart_test.go index d4424733d9..1c7c4089fe 100644 --- a/src/dbnode/integration/commitlog_bootstrap_with_snapshots_after_restart_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_with_snapshots_after_restart_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "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/persist" @@ -35,8 +38,6 @@ import ( xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapWithSnapshotsAfterRestart(t *testing.T) { diff --git a/src/dbnode/integration/commitlog_bootstrap_with_snapshots_test.go b/src/dbnode/integration/commitlog_bootstrap_with_snapshots_test.go index be024c7835..47cb405789 100644 --- a/src/dbnode/integration/commitlog_bootstrap_with_snapshots_test.go +++ b/src/dbnode/integration/commitlog_bootstrap_with_snapshots_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) func TestCommitLogBootstrapWithSnapshots(t *testing.T) { diff --git a/src/dbnode/integration/disk_cleanup_deletes_inactive_directories_test.go b/src/dbnode/integration/disk_cleanup_deletes_inactive_directories_test.go index d5be368749..49c4487e98 100644 --- a/src/dbnode/integration/disk_cleanup_deletes_inactive_directories_test.go +++ b/src/dbnode/integration/disk_cleanup_deletes_inactive_directories_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,10 +27,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/sharding" - - "github.com/stretchr/testify/require" ) func TestDiskCleanupInactiveDirectories(t *testing.T) { diff --git a/src/dbnode/integration/disk_cleanup_helpers.go b/src/dbnode/integration/disk_cleanup_helpers.go index d524bb47ca..d6cfbe2f60 100644 --- a/src/dbnode/integration/disk_cleanup_helpers.go +++ b/src/dbnode/integration/disk_cleanup_helpers.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -27,6 +28,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" @@ -34,8 +37,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var errDataCleanupTimedOut = errors.New("cleaning up data files took too long") diff --git a/src/dbnode/integration/disk_cleanup_index_corrupted_test.go b/src/dbnode/integration/disk_cleanup_index_corrupted_test.go index dc465a1ada..f32d6e7232 100644 --- a/src/dbnode/integration/disk_cleanup_index_corrupted_test.go +++ b/src/dbnode/integration/disk_cleanup_index_corrupted_test.go @@ -31,14 +31,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/retention" xclock "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestDiskCleanupIndexCorrupted(t *testing.T) { diff --git a/src/dbnode/integration/disk_cleanup_index_test.go b/src/dbnode/integration/disk_cleanup_index_test.go index 7cb7d7aefa..800c722f9e 100644 --- a/src/dbnode/integration/disk_cleanup_index_test.go +++ b/src/dbnode/integration/disk_cleanup_index_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/retention" xclock "github.com/m3db/m3/src/x/clock" - - "github.com/stretchr/testify/require" ) func TestDiskCleanupIndex(t *testing.T) { diff --git a/src/dbnode/integration/disk_cleanup_test.go b/src/dbnode/integration/disk_cleanup_test.go index 53712d21e7..46a2f09c6c 100644 --- a/src/dbnode/integration/disk_cleanup_test.go +++ b/src/dbnode/integration/disk_cleanup_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestDiskCleanup(t *testing.T) { diff --git a/src/dbnode/integration/disk_coldflush_test.go b/src/dbnode/integration/disk_coldflush_test.go index 051facc35b..352f43f1f4 100644 --- a/src/dbnode/integration/disk_coldflush_test.go +++ b/src/dbnode/integration/disk_coldflush_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -26,13 +27,13 @@ import ( "testing" "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/persist/fs" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestDiskColdFlushSimple(t *testing.T) { diff --git a/src/dbnode/integration/disk_flush_helpers.go b/src/dbnode/integration/disk_flush_helpers.go index d18eadc2ce..80a3c3093c 100644 --- a/src/dbnode/integration/disk_flush_helpers.go +++ b/src/dbnode/integration/disk_flush_helpers.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -28,6 +29,9 @@ import ( "testing" "time" + "github.com/pborman/uuid" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/integration/generate" ns "github.com/m3db/m3/src/dbnode/namespace" @@ -39,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/ident/testutil" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/integration/disk_flush_multi_ns_test.go b/src/dbnode/integration/disk_flush_multi_ns_test.go index e676158697..4443347efb 100644 --- a/src/dbnode/integration/disk_flush_multi_ns_test.go +++ b/src/dbnode/integration/disk_flush_multi_ns_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,13 +27,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestDiskFlushMultipleNamespace(t *testing.T) { diff --git a/src/dbnode/integration/disk_flush_test.go b/src/dbnode/integration/disk_flush_test.go index 099a73e0fe..5a01856fdd 100644 --- a/src/dbnode/integration/disk_flush_test.go +++ b/src/dbnode/integration/disk_flush_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,10 +27,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/integration/generate" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestDiskFlushSimple(t *testing.T) { diff --git a/src/dbnode/integration/disk_snapshot_test.go b/src/dbnode/integration/disk_snapshot_test.go index 09fe4ac344..309adc3c15 100644 --- a/src/dbnode/integration/disk_snapshot_test.go +++ b/src/dbnode/integration/disk_snapshot_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,13 +27,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestDiskSnapshotSimple(t *testing.T) { diff --git a/src/dbnode/integration/dynamic_namespace_add_test.go b/src/dbnode/integration/dynamic_namespace_add_test.go index 01d00bc174..34994fb937 100644 --- a/src/dbnode/integration/dynamic_namespace_add_test.go +++ b/src/dbnode/integration/dynamic_namespace_add_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -27,15 +28,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/integration/etcd" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/block" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/golang/protobuf/proto" - "github.com/stretchr/testify/require" ) func TestDynamicNamespaceAdd(t *testing.T) { diff --git a/src/dbnode/integration/dynamic_namespace_delete_test.go b/src/dbnode/integration/dynamic_namespace_delete_test.go index 8d1291a455..8d0502cbaa 100644 --- a/src/dbnode/integration/dynamic_namespace_delete_test.go +++ b/src/dbnode/integration/dynamic_namespace_delete_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,16 +27,16 @@ import ( "testing" "time" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/integration/etcd" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" xmetrics "github.com/m3db/m3/src/dbnode/x/metrics" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/protobuf/proto" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestDynamicNamespaceDelete(t *testing.T) { diff --git a/src/dbnode/integration/encoder_limit_test.go b/src/dbnode/integration/encoder_limit_test.go index 89a0aa74b4..5a854f54fc 100644 --- a/src/dbnode/integration/encoder_limit_test.go +++ b/src/dbnode/integration/encoder_limit_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestEncoderLimit(t *testing.T) { diff --git a/src/dbnode/integration/fetch_tagged_quorum_test.go b/src/dbnode/integration/fetch_tagged_quorum_test.go index 2662daf713..ae4a39cb76 100644 --- a/src/dbnode/integration/fetch_tagged_quorum_test.go +++ b/src/dbnode/integration/fetch_tagged_quorum_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -38,9 +42,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFetchTaggedQuorumNormalOnlyOneUp(t *testing.T) { diff --git a/src/dbnode/integration/fs_bootstrap_index_test.go b/src/dbnode/integration/fs_bootstrap_index_test.go index 70e5afa7b8..844656c536 100644 --- a/src/dbnode/integration/fs_bootstrap_index_test.go +++ b/src/dbnode/integration/fs_bootstrap_index_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" @@ -36,9 +40,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestFilesystemBootstrapIndexWithIndexingEnabled(t *testing.T) { diff --git a/src/dbnode/integration/fs_bootstrap_index_volume_type_test.go b/src/dbnode/integration/fs_bootstrap_index_volume_type_test.go index 196b8cd128..0f045374a1 100644 --- a/src/dbnode/integration/fs_bootstrap_index_volume_type_test.go +++ b/src/dbnode/integration/fs_bootstrap_index_volume_type_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "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" @@ -34,8 +37,6 @@ import ( "github.com/m3db/m3/src/m3ninx/idx" idxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) func TestFilesystemBootstrapIndexVolumeTypes(t *testing.T) { diff --git a/src/dbnode/integration/fs_bootstrap_multi_ns_test.go b/src/dbnode/integration/fs_bootstrap_multi_ns_test.go index 95475bcc2f..5517210887 100644 --- a/src/dbnode/integration/fs_bootstrap_multi_ns_test.go +++ b/src/dbnode/integration/fs_bootstrap_multi_ns_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) func TestFilesystemBootstrapMultipleNamespaces(t *testing.T) { diff --git a/src/dbnode/integration/fs_bootstrap_tags_test.go b/src/dbnode/integration/fs_bootstrap_tags_test.go index 2a4021f607..df4c7755da 100644 --- a/src/dbnode/integration/fs_bootstrap_tags_test.go +++ b/src/dbnode/integration/fs_bootstrap_tags_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "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" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) func TestFilesystemBootstrapTagsWithIndexingDisabled(t *testing.T) { diff --git a/src/dbnode/integration/fs_bootstrap_test.go b/src/dbnode/integration/fs_bootstrap_test.go index a6451dd7bf..df0512c7cb 100644 --- a/src/dbnode/integration/fs_bootstrap_test.go +++ b/src/dbnode/integration/fs_bootstrap_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) func TestFilesystemBootstrap(t *testing.T) { diff --git a/src/dbnode/integration/fs_commitlog_mixed_mode_read_write_test.go b/src/dbnode/integration/fs_commitlog_mixed_mode_read_write_test.go index af39207cdd..3b65726270 100644 --- a/src/dbnode/integration/fs_commitlog_mixed_mode_read_write_test.go +++ b/src/dbnode/integration/fs_commitlog_mixed_mode_read_write_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -27,16 +28,16 @@ import ( "testing" "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" + "github.com/m3db/m3/src/dbnode/testdata/prototest" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/m3/src/dbnode/testdata/prototest" - "github.com/stretchr/testify/require" ) type annotationGenerator interface { diff --git a/src/dbnode/integration/fs_commitlog_snapshot_mixed_mode_read_write_prop_test.go b/src/dbnode/integration/fs_commitlog_snapshot_mixed_mode_read_write_prop_test.go index 3063adceb0..37116a3c78 100644 --- a/src/dbnode/integration/fs_commitlog_snapshot_mixed_mode_read_write_prop_test.go +++ b/src/dbnode/integration/fs_commitlog_snapshot_mixed_mode_read_write_prop_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -29,16 +30,16 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/x/context" - xtime "github.com/m3db/m3/src/x/time" - "go.uber.org/zap" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/require" + "go.uber.org/zap" + + "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/x/context" + xtime "github.com/m3db/m3/src/x/time" ) // Really small block sizes make certain operations take too long @@ -56,12 +57,12 @@ const ( // can properly bootstrap all the data from a combination of fileset files, // snapshotfiles, and commit log files. It varies the following inputs to // the system: -// 1) block size -// 2) buffer past -// 3) buffer future -// 4) number of datapoints -// 5) whether it waits for data files to be flushed before shutting down -// 6) whether it waits for snapshot files to be written before shutting down +// 1. block size +// 2. buffer past +// 3. buffer future +// 4. number of datapoints +// 5. whether it waits for data files to be flushed before shutting down +// 6. whether it waits for snapshot files to be written before shutting down // // It works by generating random datapoints, and then writing those data points // to the node in order. At randomly selected times during the write process, the diff --git a/src/dbnode/integration/fs_data_expiry_bootstrap_test.go b/src/dbnode/integration/fs_data_expiry_bootstrap_test.go index 4d020d183e..c5216466bf 100644 --- a/src/dbnode/integration/fs_data_expiry_bootstrap_test.go +++ b/src/dbnode/integration/fs_data_expiry_bootstrap_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,11 +27,11 @@ import ( "testing" "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" - - "github.com/stretchr/testify/require" ) func TestFilesystemDataExpiryBootstrap(t *testing.T) { diff --git a/src/dbnode/integration/index_active_block_rotate_test.go b/src/dbnode/integration/index_active_block_rotate_test.go index 225261493b..6a0acba573 100644 --- a/src/dbnode/integration/index_active_block_rotate_test.go +++ b/src/dbnode/integration/index_active_block_rotate_test.go @@ -30,14 +30,6 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/integration/generate" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/dbnode/storage/index/compaction" - xclock "github.com/m3db/m3/src/x/clock" - "github.com/m3db/m3/src/x/ident" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" @@ -45,6 +37,14 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" + + "github.com/m3db/m3/src/dbnode/integration/generate" + "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/dbnode/storage/index/compaction" + xclock "github.com/m3db/m3/src/x/clock" + "github.com/m3db/m3/src/x/ident" + xtime "github.com/m3db/m3/src/x/time" ) func TestIndexActiveBlockRotate(t *testing.T) { diff --git a/src/dbnode/integration/index_block_flush_test.go b/src/dbnode/integration/index_block_flush_test.go index 0d320b75cc..1a73bc4166 100644 --- a/src/dbnode/integration/index_block_flush_test.go +++ b/src/dbnode/integration/index_block_flush_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -26,6 +28,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/retention" @@ -35,11 +42,6 @@ import ( xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) /* diff --git a/src/dbnode/integration/index_block_orphaned_entry_test.go b/src/dbnode/integration/index_block_orphaned_entry_test.go index bc07b576a4..fa46a08c29 100644 --- a/src/dbnode/integration/index_block_orphaned_entry_test.go +++ b/src/dbnode/integration/index_block_orphaned_entry_test.go @@ -33,6 +33,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -42,10 +46,6 @@ import ( "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/integration/index_block_rotation_test.go b/src/dbnode/integration/index_block_rotation_test.go index a18370ee7c..d2c20f4ef8 100644 --- a/src/dbnode/integration/index_block_rotation_test.go +++ b/src/dbnode/integration/index_block_rotation_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -26,15 +28,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" xclock "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) /* diff --git a/src/dbnode/integration/index_helpers.go b/src/dbnode/integration/index_helpers.go index d6a3958076..2ffac4d244 100644 --- a/src/dbnode/integration/index_helpers.go +++ b/src/dbnode/integration/index_helpers.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -29,6 +31,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/storage/index" @@ -36,9 +41,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3/consolidators" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) // TestIndexWrites holds index writes for testing. diff --git a/src/dbnode/integration/index_multiple_block_query_test.go b/src/dbnode/integration/index_multiple_block_query_test.go index 77bd5cea25..8d1049e58d 100644 --- a/src/dbnode/integration/index_multiple_block_query_test.go +++ b/src/dbnode/integration/index_multiple_block_query_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -26,15 +28,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" xclock "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) /* diff --git a/src/dbnode/integration/index_multiple_node_high_concurrency_test.go b/src/dbnode/integration/index_multiple_node_high_concurrency_test.go index 04692340c7..65ff52bdfe 100644 --- a/src/dbnode/integration/index_multiple_node_high_concurrency_test.go +++ b/src/dbnode/integration/index_multiple_node_high_concurrency_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -29,16 +31,16 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/topology" xclock "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestIndexMultipleNodeHighConcurrency(t *testing.T) { diff --git a/src/dbnode/integration/index_single_node_high_concurrency_test.go b/src/dbnode/integration/index_single_node_high_concurrency_test.go index e2ce01cb3a..8a308f411b 100644 --- a/src/dbnode/integration/index_single_node_high_concurrency_test.go +++ b/src/dbnode/integration/index_single_node_high_concurrency_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -30,6 +32,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/index" @@ -39,11 +46,6 @@ import ( "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "go.uber.org/zap" ) func TestIndexSingleNodeHighConcurrencyManyTagsLowCardinality(t *testing.T) { diff --git a/src/dbnode/integration/index_warm_write_gap_test.go b/src/dbnode/integration/index_warm_write_gap_test.go index 2bf2df8c8d..142521ae87 100644 --- a/src/dbnode/integration/index_warm_write_gap_test.go +++ b/src/dbnode/integration/index_warm_write_gap_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2020 Uber Technologies, Inc. // @@ -26,15 +28,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" xclock "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) /* diff --git a/src/dbnode/integration/integration.go b/src/dbnode/integration/integration.go index c3b15d92fe..6576c33ccd 100644 --- a/src/dbnode/integration/integration.go +++ b/src/dbnode/integration/integration.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/integration/generate" @@ -53,10 +57,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xretry "github.com/m3db/m3/src/x/retry" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/integration/integration_data_verify.go b/src/dbnode/integration/integration_data_verify.go index 819a9d0a0d..89bbb64c6d 100644 --- a/src/dbnode/integration/integration_data_verify.go +++ b/src/dbnode/integration/integration_data_verify.go @@ -30,6 +30,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/storage" @@ -38,9 +41,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "go.uber.org/zap" ) type readableSeries struct { diff --git a/src/dbnode/integration/integration_index_verify.go b/src/dbnode/integration/integration_index_verify.go index 71c3985bd5..a8763c290e 100644 --- a/src/dbnode/integration/integration_index_verify.go +++ b/src/dbnode/integration/integration_index_verify.go @@ -24,12 +24,12 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type verifyQueryMetadataResultsOptions struct { diff --git a/src/dbnode/integration/ns_admin_integration_test.go b/src/dbnode/integration/ns_admin_integration_test.go index b22a9ba84e..363148242c 100644 --- a/src/dbnode/integration/ns_admin_integration_test.go +++ b/src/dbnode/integration/ns_admin_integration_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -25,12 +26,13 @@ package integration import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/integration/etcd" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/namespace/kvadmin" "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" ) const ( @@ -71,7 +73,7 @@ func deployNamespace(t *testing.T) (kv.Store, kvadmin.NamespaceMetadataAdminServ require.NoError(t, err) // Must start the embedded server before closing. require.NoError(t, kv.Start()) - cleanup := func() {require.NoError(t, kv.Close())} + cleanup := func() { require.NoError(t, kv.Close()) } c, err := kv.ConfigServiceClient() require.NoError(t, err) @@ -126,4 +128,3 @@ func TestNamespaceAdmin_LoadSchemaFromEtcd(t *testing.T) { require.NoError(t, err) require.EqualValues(t, deployID, actualDesc.DeployId()) } - diff --git a/src/dbnode/integration/options.go b/src/dbnode/integration/options.go index 09f1f3a187..cf346fc2d2 100644 --- a/src/dbnode/integration/options.go +++ b/src/dbnode/integration/options.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go index 9c7e1f5c60..8009f9ffa3 100644 --- a/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go +++ b/src/dbnode/integration/peers_bootstrap_high_concurrency_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -27,6 +28,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" @@ -36,9 +40,6 @@ import ( "github.com/m3db/m3/src/x/ident" 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 TestPeersBootstrapHighConcurrencyBatch16Workers64(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go index 67e5f6e5c3..ee8e22dfb8 100644 --- a/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_aggregate_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "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" @@ -34,8 +37,6 @@ import ( idxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestPeersBootstrapIndexAggregateQuery(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_index_test.go b/src/dbnode/integration/peers_bootstrap_index_test.go index ba562924e9..7dc49dc478 100644 --- a/src/dbnode/integration/peers_bootstrap_index_test.go +++ b/src/dbnode/integration/peers_bootstrap_index_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + indexpb "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" @@ -38,8 +41,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestPeersBootstrapIndexWithIndexingEnabled(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_merge_local_test.go b/src/dbnode/integration/peers_bootstrap_merge_local_test.go index 0c344a71a0..74ed5eb050 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_local_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_local_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,14 +27,14 @@ import ( "testing" "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" xmetrics "github.com/m3db/m3/src/dbnode/x/metrics" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestPeersBootstrapMergeLocal(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go index 4fc98e0bc4..77c1794810 100644 --- a/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go +++ b/src/dbnode/integration/peers_bootstrap_merge_peer_blocks_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,13 +27,13 @@ import ( "testing" "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" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestPeersBootstrapMergePeerBlocks(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_node_down_test.go b/src/dbnode/integration/peers_bootstrap_node_down_test.go index c6d9873390..91c3897e46 100644 --- a/src/dbnode/integration/peers_bootstrap_node_down_test.go +++ b/src/dbnode/integration/peers_bootstrap_node_down_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "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" ) func TestPeersBootstrapNodeDown(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_none_available_test.go b/src/dbnode/integration/peers_bootstrap_none_available_test.go index afc0aec446..6a626da0b6 100644 --- a/src/dbnode/integration/peers_bootstrap_none_available_test.go +++ b/src/dbnode/integration/peers_bootstrap_none_available_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" @@ -35,9 +39,6 @@ import ( "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // TestPeersBootstrapNoneAvailable makes sure that a cluster with the peer bootstrapper enabled can still turn on diff --git a/src/dbnode/integration/peers_bootstrap_partial_data_test.go b/src/dbnode/integration/peers_bootstrap_partial_data_test.go index 8394e7c540..7e4e580c35 100644 --- a/src/dbnode/integration/peers_bootstrap_partial_data_test.go +++ b/src/dbnode/integration/peers_bootstrap_partial_data_test.go @@ -27,13 +27,13 @@ import ( "testing" "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" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) // This test simulates a case where node fails / reboots while fetching data from peers. diff --git a/src/dbnode/integration/peers_bootstrap_select_best_test.go b/src/dbnode/integration/peers_bootstrap_select_best_test.go index fe31190cb5..116aec5e47 100644 --- a/src/dbnode/integration/peers_bootstrap_select_best_test.go +++ b/src/dbnode/integration/peers_bootstrap_select_best_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,13 +27,13 @@ import ( "testing" "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" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestPeersBootstrapSelectBest(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_simple_test.go b/src/dbnode/integration/peers_bootstrap_simple_test.go index 9b951b8737..9d5ce2791b 100644 --- a/src/dbnode/integration/peers_bootstrap_simple_test.go +++ b/src/dbnode/integration/peers_bootstrap_simple_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "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" ) func TestPeersBootstrapSimple(t *testing.T) { diff --git a/src/dbnode/integration/peers_bootstrap_single_node_test.go b/src/dbnode/integration/peers_bootstrap_single_node_test.go index 4c8671a59a..9ef3905f37 100644 --- a/src/dbnode/integration/peers_bootstrap_single_node_test.go +++ b/src/dbnode/integration/peers_bootstrap_single_node_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2018 Uber Technologies, Inc. @@ -26,6 +27,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/integration/generate" @@ -36,8 +39,6 @@ import ( "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) // TestPeersBootstrapSingleNodeUninitialized makes sure that we can include the peer bootstrapper diff --git a/src/dbnode/integration/query_cancellation_client_test.go b/src/dbnode/integration/query_cancellation_client_test.go index f3ed434453..8b12082d0c 100644 --- a/src/dbnode/integration/query_cancellation_client_test.go +++ b/src/dbnode/integration/query_cancellation_client_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2020 Uber Technologies, Inc. // @@ -30,6 +32,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber/tchannel-go/thrift" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" @@ -37,10 +43,6 @@ import ( "github.com/m3db/m3/src/m3ninx/idx" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "github.com/uber/tchannel-go/thrift" - "go.uber.org/zap" ) func TestQueryCancellationAndDeadlinesClient(t *testing.T) { diff --git a/src/dbnode/integration/query_limit_test.go b/src/dbnode/integration/query_limit_test.go index 059901a855..84df867af2 100644 --- a/src/dbnode/integration/query_limit_test.go +++ b/src/dbnode/integration/query_limit_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. diff --git a/src/dbnode/integration/repair_force_only_compare_test.go b/src/dbnode/integration/repair_force_only_compare_test.go index 1b92a94b7d..cedca9ed83 100644 --- a/src/dbnode/integration/repair_force_only_compare_test.go +++ b/src/dbnode/integration/repair_force_only_compare_test.go @@ -27,15 +27,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/integration/generate" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/repair" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestRepairForceAndOnlyCompare(t *testing.T) { diff --git a/src/dbnode/integration/repair_test.go b/src/dbnode/integration/repair_test.go index 8d47f99185..8d5292fa49 100644 --- a/src/dbnode/integration/repair_test.go +++ b/src/dbnode/integration/repair_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2019 Uber Technologies, Inc. @@ -26,14 +27,14 @@ import ( "testing" "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" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestRepairDisjointSeries(t *testing.T) { diff --git a/src/dbnode/integration/roundtrip_test.go b/src/dbnode/integration/roundtrip_test.go index 9f9ad6379e..c792fdb12f 100644 --- a/src/dbnode/integration/roundtrip_test.go +++ b/src/dbnode/integration/roundtrip_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "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/testdata/prototest" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type setTestOptions func(t *testing.T, testOpts TestOptions) TestOptions diff --git a/src/dbnode/integration/run_custom_background_process_test.go b/src/dbnode/integration/run_custom_background_process_test.go index 30dca638a0..325779fd5b 100644 --- a/src/dbnode/integration/run_custom_background_process_test.go +++ b/src/dbnode/integration/run_custom_background_process_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2020 Uber Technologies, Inc. @@ -26,12 +27,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/storage" - xclock "github.com/m3db/m3/src/x/clock" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/atomic" + + "github.com/m3db/m3/src/dbnode/storage" + xclock "github.com/m3db/m3/src/x/clock" ) type testBackgroundProcess struct { diff --git a/src/dbnode/integration/series_wired_list_panic_test.go b/src/dbnode/integration/series_wired_list_panic_test.go index 2bff50b1d1..e2123b2408 100644 --- a/src/dbnode/integration/series_wired_list_panic_test.go +++ b/src/dbnode/integration/series_wired_list_panic_test.go @@ -28,6 +28,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" @@ -37,8 +39,6 @@ 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 ( diff --git a/src/dbnode/integration/serve.go b/src/dbnode/integration/serve.go index cd39c1ab4b..9d600198a8 100644 --- a/src/dbnode/integration/serve.go +++ b/src/dbnode/integration/serve.go @@ -26,6 +26,8 @@ import ( "net/http" "strings" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" hjcluster "github.com/m3db/m3/src/dbnode/network/server/httpjson/cluster" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/topology" xretry "github.com/m3db/m3/src/x/retry" - - "go.uber.org/zap" ) // TestShardSetOptions is a set of test shard set options. diff --git a/src/dbnode/integration/shallow_copy_single_test.go b/src/dbnode/integration/shallow_copy_single_test.go index d58cb7559c..a8db40e238 100644 --- a/src/dbnode/integration/shallow_copy_single_test.go +++ b/src/dbnode/integration/shallow_copy_single_test.go @@ -28,6 +28,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -36,9 +39,6 @@ import ( xenc "github.com/m3db/m3/src/dbnode/x/encoding" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestShallowCopySingleSeries(t *testing.T) { diff --git a/src/dbnode/integration/truncate_namespace_test.go b/src/dbnode/integration/truncate_namespace_test.go index 2dcc6c47ab..6130d39947 100644 --- a/src/dbnode/integration/truncate_namespace_test.go +++ b/src/dbnode/integration/truncate_namespace_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -25,13 +26,13 @@ package integration import ( "testing" + "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" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestTruncateNamespace(t *testing.T) { diff --git a/src/dbnode/integration/write_quorum_test.go b/src/dbnode/integration/write_quorum_test.go index 98e589570a..2bbe8f24a8 100644 --- a/src/dbnode/integration/write_quorum_test.go +++ b/src/dbnode/integration/write_quorum_test.go @@ -27,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNormalQuorumOnlyOneUp(t *testing.T) { diff --git a/src/dbnode/integration/write_read_high_concurrency_test.go b/src/dbnode/integration/write_read_high_concurrency_test.go index a90dee7295..f73eb0950a 100644 --- a/src/dbnode/integration/write_read_high_concurrency_test.go +++ b/src/dbnode/integration/write_read_high_concurrency_test.go @@ -1,4 +1,6 @@ +//go:build integration // +build integration + // // Copyright (c) 2019 Uber Technologies, Inc. // @@ -28,6 +30,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -35,9 +40,6 @@ import ( xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) // TestWriteReadHighConcurrencyTestMultiNS stress tests the conccurent write and read pathways in M3DB by spinning diff --git a/src/dbnode/integration/write_read_timezone_test.go b/src/dbnode/integration/write_read_timezone_test.go index 3c0c2be548..4747ac81f8 100644 --- a/src/dbnode/integration/write_read_timezone_test.go +++ b/src/dbnode/integration/write_read_timezone_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -27,10 +28,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) type readWriteTZCase struct { diff --git a/src/dbnode/integration/write_tagged_quorum_test.go b/src/dbnode/integration/write_tagged_quorum_test.go index b4bd7c307c..af3fa7ff32 100644 --- a/src/dbnode/integration/write_tagged_quorum_test.go +++ b/src/dbnode/integration/write_tagged_quorum_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2016 Uber Technologies, Inc. @@ -26,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" @@ -39,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestWriteTaggedNormalQuorumOnlyOneUp(t *testing.T) { diff --git a/src/dbnode/namespace/config_test.go b/src/dbnode/namespace/config_test.go index a403dfa0b1..9575fe072e 100644 --- a/src/dbnode/namespace/config_test.go +++ b/src/dbnode/namespace/config_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/x/ident" ) func TestRegistryConfig(t *testing.T) { diff --git a/src/dbnode/namespace/convert.go b/src/dbnode/namespace/convert.go index d993f0c55a..1ed40c50fe 100644 --- a/src/dbnode/namespace/convert.go +++ b/src/dbnode/namespace/convert.go @@ -27,13 +27,13 @@ import ( "sync" "time" + "github.com/gogo/protobuf/proto" + protobuftypes "github.com/gogo/protobuf/types" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/gogo/protobuf/proto" - protobuftypes "github.com/gogo/protobuf/types" ) var ( diff --git a/src/dbnode/namespace/convert_prop_test.go b/src/dbnode/namespace/convert_prop_test.go index f92bef2ae3..c180f9d984 100644 --- a/src/dbnode/namespace/convert_prop_test.go +++ b/src/dbnode/namespace/convert_prop_test.go @@ -22,19 +22,19 @@ package namespace_test import ( "fmt" - "github.com/stretchr/testify/require" "math/rand" "os" "testing" "time" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/x/ident" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/x/ident" ) const ( diff --git a/src/dbnode/namespace/convert_test.go b/src/dbnode/namespace/convert_test.go index 3f31b5fc6c..6a500f29bf 100644 --- a/src/dbnode/namespace/convert_test.go +++ b/src/dbnode/namespace/convert_test.go @@ -24,15 +24,15 @@ import ( "testing" "time" + protobuftypes "github.com/gogo/protobuf/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - protobuftypes "github.com/gogo/protobuf/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/namespace/dynamic.go b/src/dbnode/namespace/dynamic.go index 201769eee5..97428e5260 100644 --- a/src/dbnode/namespace/dynamic.go +++ b/src/dbnode/namespace/dynamic.go @@ -25,12 +25,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/namespace/dynamic_test.go b/src/dbnode/namespace/dynamic_test.go index 2dd5403012..b24a8c63ba 100644 --- a/src/dbnode/namespace/dynamic_test.go +++ b/src/dbnode/namespace/dynamic_test.go @@ -25,17 +25,17 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/client" - "github.com/m3db/m3/src/cluster/kv" - nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" - "github.com/m3db/m3/src/x/instrument" - xtime "github.com/m3db/m3/src/x/time" - "github.com/fortytw2/leaktest" "github.com/golang/mock/gomock" "github.com/golang/protobuf/proto" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/cluster/client" + "github.com/m3db/m3/src/cluster/kv" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" + "github.com/m3db/m3/src/x/instrument" + xtime "github.com/m3db/m3/src/x/time" ) func newTestSetup(t *testing.T, ctrl *gomock.Controller, watchable kv.ValueWatchable) (DynamicOptions, *kv.MockStore) { diff --git a/src/dbnode/namespace/map_test.go b/src/dbnode/namespace/map_test.go index e3eff6891f..c6460f5679 100644 --- a/src/dbnode/namespace/map_test.go +++ b/src/dbnode/namespace/map_test.go @@ -23,10 +23,10 @@ package namespace import ( "testing" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" ) func TestMapEmpty(t *testing.T) { diff --git a/src/dbnode/namespace/metadata_test.go b/src/dbnode/namespace/metadata_test.go index 9311238d17..28706d91d9 100644 --- a/src/dbnode/namespace/metadata_test.go +++ b/src/dbnode/namespace/metadata_test.go @@ -24,11 +24,11 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/retention" + "github.com/m3db/m3/src/x/ident" ) func TestMetadataEqualsTrue(t *testing.T) { diff --git a/src/dbnode/namespace/namespace_watch.go b/src/dbnode/namespace/namespace_watch.go index bd4378e991..b2a0ad8777 100644 --- a/src/dbnode/namespace/namespace_watch.go +++ b/src/dbnode/namespace/namespace_watch.go @@ -25,10 +25,10 @@ import ( "sync" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/uber-go/tally" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/instrument" ) var ( diff --git a/src/dbnode/namespace/namespace_watch_test.go b/src/dbnode/namespace/namespace_watch_test.go index 27a9a5db04..07a486d767 100644 --- a/src/dbnode/namespace/namespace_watch_test.go +++ b/src/dbnode/namespace/namespace_watch_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/fortytw2/leaktest" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/instrument" ) func newTestNamespaceWatch(t *testing.T, ctrl *gomock.Controller, updater NamespaceUpdater) ( @@ -55,7 +55,7 @@ func TestNamespaceWatchStartStop(t *testing.T) { leaktest.CheckTimeout(t, time.Second)() }() - noopUpdater := func(Map) error {return nil} + noopUpdater := func(Map) error { return nil } dbWatch, mockWatch := newTestNamespaceWatch(t, ctrl, noopUpdater) mockWatch.EXPECT().C().Return(ch).AnyTimes() @@ -77,7 +77,7 @@ func TestNamespaceWatchStopWithoutStart(t *testing.T) { leaktest.CheckTimeout(t, time.Second)() }() - noopUpdater := func(Map) error {return nil} + noopUpdater := func(Map) error { return nil } dbWatch, _ := newTestNamespaceWatch(t, ctrl, noopUpdater) require.Error(t, dbWatch.Stop()) require.NoError(t, dbWatch.Close()) @@ -95,7 +95,7 @@ func TestNamespaceWatchUpdatePropagation(t *testing.T) { mockMap := NewMockMap(ctrl) mockMap.EXPECT().Metadatas().Return([]Metadata{}).AnyTimes() - noopUpdater := func(Map) error {return nil} + noopUpdater := func(Map) error { return nil } dbWatch, mockWatch := newTestNamespaceWatch(t, ctrl, noopUpdater) mockWatch.EXPECT().Get().Return(mockMap).AnyTimes() mockWatch.EXPECT().C().Return(ch).AnyTimes() diff --git a/src/dbnode/namespace/options_test.go b/src/dbnode/namespace/options_test.go index bafd4e3349..e3878d1526 100644 --- a/src/dbnode/namespace/options_test.go +++ b/src/dbnode/namespace/options_test.go @@ -25,10 +25,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/retention" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/retention" ) func TestOptionsEquals(t *testing.T) { diff --git a/src/dbnode/namespace/schema.go b/src/dbnode/namespace/schema.go index 8ad49b0720..e5488bfbda 100644 --- a/src/dbnode/namespace/schema.go +++ b/src/dbnode/namespace/schema.go @@ -27,14 +27,14 @@ import ( "os" "strings" - nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/protobuf/proto" dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/desc/protoparse" + + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" + xerrors "github.com/m3db/m3/src/x/errors" + "github.com/m3db/m3/src/x/ident" ) var ( @@ -306,12 +306,13 @@ func marshalFileDescriptors(fdList []*desc.FileDescriptor) ([][]byte, error) { // protoFile: name of the top level proto file. // msgName: name of the top level proto message. // contents: map of name to proto strings. -// Except for the top level proto file, other imported proto files' key must be exactly the same -// as how they are imported in the import statement: -// E.g. if import.proto is imported as below -// import "mainpkg/imported.proto"; -// Then the map key for improted.proto must be "mainpkg/imported.proto" -// See src/dbnode/namesapce/kvadmin test for example. +// +// Except for the top level proto file, other imported proto files' key must be exactly the same +// as how they are imported in the import statement: +// E.g. if import.proto is imported as below +// import "mainpkg/imported.proto"; +// Then the map key for improted.proto must be "mainpkg/imported.proto" +// See src/dbnode/namesapce/kvadmin test for example. func AppendSchemaOptions(schemaOpt *nsproto.SchemaOptions, protoFile, msgName string, contents map[string]string, deployID string) (*nsproto.SchemaOptions, error) { // Verify schema options schemaHist, err := LoadSchemaHistory(schemaOpt) diff --git a/src/dbnode/namespace/schema_registry.go b/src/dbnode/namespace/schema_registry.go index 08e8829cbb..f5ce6080ca 100644 --- a/src/dbnode/namespace/schema_registry.go +++ b/src/dbnode/namespace/schema_registry.go @@ -24,11 +24,11 @@ import ( "fmt" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/x/ident" xresource "github.com/m3db/m3/src/x/resource" xwatch "github.com/m3db/m3/src/x/watch" - - "go.uber.org/zap" ) func newSchemaHistoryNotFoundError(nsIDStr string) error { diff --git a/src/dbnode/namespace/schema_registry_test.go b/src/dbnode/namespace/schema_registry_test.go index 979bdae0cf..1d0cb2b01f 100644 --- a/src/dbnode/namespace/schema_registry_test.go +++ b/src/dbnode/namespace/schema_registry_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" ) type mockListener struct { diff --git a/src/dbnode/namespace/schema_registry_updater.go b/src/dbnode/namespace/schema_registry_updater.go index 245103ca1a..1cd4d78890 100644 --- a/src/dbnode/namespace/schema_registry_updater.go +++ b/src/dbnode/namespace/schema_registry_updater.go @@ -23,9 +23,9 @@ package namespace import ( "fmt" - xerrors "github.com/m3db/m3/src/x/errors" - "go.uber.org/zap" + + xerrors "github.com/m3db/m3/src/x/errors" ) // UpdateSchemaRegistry updates schema registry with namespace updates. diff --git a/src/dbnode/namespace/schema_test.go b/src/dbnode/namespace/schema_test.go index 77eb1f7f4b..ae65db4658 100644 --- a/src/dbnode/namespace/schema_test.go +++ b/src/dbnode/namespace/schema_test.go @@ -23,10 +23,10 @@ package namespace import ( "testing" + "github.com/stretchr/testify/require" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/namespace/types.go b/src/dbnode/namespace/types.go index e9db4e21c7..ecfc91528d 100644 --- a/src/dbnode/namespace/types.go +++ b/src/dbnode/namespace/types.go @@ -23,13 +23,13 @@ package namespace import ( "time" + protobuftypes "github.com/gogo/protobuf/types" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xresource "github.com/m3db/m3/src/x/resource" - - protobuftypes "github.com/gogo/protobuf/types" ) // Options controls namespace behavior. diff --git a/src/dbnode/network/server/httpjson/context.go b/src/dbnode/network/server/httpjson/context.go index 01067e0a06..5c3d4369e6 100644 --- a/src/dbnode/network/server/httpjson/context.go +++ b/src/dbnode/network/server/httpjson/context.go @@ -21,11 +21,11 @@ package httpjson import ( - m3dbcontext "github.com/m3db/m3/src/x/context" - apachethrift "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" "github.com/uber/tchannel-go/thrift" "golang.org/x/net/context" + + m3dbcontext "github.com/m3db/m3/src/x/context" ) const ( diff --git a/src/dbnode/network/server/httpjson/handlers.go b/src/dbnode/network/server/httpjson/handlers.go index dc9f2ad62e..c3147a6c5c 100644 --- a/src/dbnode/network/server/httpjson/handlers.go +++ b/src/dbnode/network/server/httpjson/handlers.go @@ -30,11 +30,11 @@ import ( "strconv" "strings" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/m3db/m3/src/x/headers" - apachethrift "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" "github.com/uber/tchannel-go/thrift" + + xerrors "github.com/m3db/m3/src/x/errors" + "github.com/m3db/m3/src/x/headers" ) var ( diff --git a/src/dbnode/network/server/httpjson/handlers_test.go b/src/dbnode/network/server/httpjson/handlers_test.go index a01263ce88..6fac8d7372 100644 --- a/src/dbnode/network/server/httpjson/handlers_test.go +++ b/src/dbnode/network/server/httpjson/handlers_test.go @@ -30,16 +30,16 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + apachethrift "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" + "golang.org/x/net/context" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/cluster" "github.com/m3db/m3/src/x/headers" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - apachethrift "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" - "golang.org/x/net/context" ) var ( diff --git a/src/dbnode/network/server/tchannelthrift/cluster/server.go b/src/dbnode/network/server/tchannelthrift/cluster/server.go index 746fe9aea0..718fc81226 100644 --- a/src/dbnode/network/server/tchannelthrift/cluster/server.go +++ b/src/dbnode/network/server/tchannelthrift/cluster/server.go @@ -21,14 +21,14 @@ package cluster import ( + "github.com/uber/tchannel-go" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" ns "github.com/m3db/m3/src/dbnode/network/server" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift" "github.com/m3db/m3/src/x/context" xresource "github.com/m3db/m3/src/x/resource" - - "github.com/uber/tchannel-go" ) const ( diff --git a/src/dbnode/network/server/tchannelthrift/cluster/service.go b/src/dbnode/network/server/tchannelthrift/cluster/service.go index fbd0cb12b1..d09440bb59 100644 --- a/src/dbnode/network/server/tchannelthrift/cluster/service.go +++ b/src/dbnode/network/server/tchannelthrift/cluster/service.go @@ -25,6 +25,8 @@ import ( "fmt" "sync" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -37,8 +39,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber/tchannel-go/thrift" ) type service struct { diff --git a/src/dbnode/network/server/tchannelthrift/cluster/service_test.go b/src/dbnode/network/server/tchannelthrift/cluster/service_test.go index a723285874..b55de4d71c 100644 --- a/src/dbnode/network/server/tchannelthrift/cluster/service_test.go +++ b/src/dbnode/network/server/tchannelthrift/cluster/service_test.go @@ -25,16 +25,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/topology" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber/tchannel-go/thrift" ) func TestSessionOpts(t *testing.T) { diff --git a/src/dbnode/network/server/tchannelthrift/context.go b/src/dbnode/network/server/tchannelthrift/context.go index ce75971574..7e5313f1ac 100644 --- a/src/dbnode/network/server/tchannelthrift/context.go +++ b/src/dbnode/network/server/tchannelthrift/context.go @@ -24,11 +24,11 @@ import ( stdctx "context" "time" - "github.com/m3db/m3/src/x/context" - "github.com/uber/tchannel-go" apachethrift "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/x/context" ) const ( diff --git a/src/dbnode/network/server/tchannelthrift/convert/convert_test.go b/src/dbnode/network/server/tchannelthrift/convert/convert_test.go index 53e2d5779a..6a2f0588b3 100644 --- a/src/dbnode/network/server/tchannelthrift/convert/convert_test.go +++ b/src/dbnode/network/server/tchannelthrift/convert/convert_test.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/convert" tterrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func mustToRPCTime(t *testing.T, ts xtime.UnixNano) int64 { diff --git a/src/dbnode/network/server/tchannelthrift/node/options.go b/src/dbnode/network/server/tchannelthrift/node/options.go index 956c5b2ce7..8dedacde94 100644 --- a/src/dbnode/network/server/tchannelthrift/node/options.go +++ b/src/dbnode/network/server/tchannelthrift/node/options.go @@ -21,11 +21,11 @@ package node import ( - "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/x/instrument" - "github.com/uber/tchannel-go" "github.com/uber/tchannel-go/thrift" + + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/x/instrument" ) // NewTChanChannelFn creates a tchan channel. diff --git a/src/dbnode/network/server/tchannelthrift/node/server.go b/src/dbnode/network/server/tchannelthrift/node/server.go index cf985cd79f..07c1e31a60 100644 --- a/src/dbnode/network/server/tchannelthrift/node/server.go +++ b/src/dbnode/network/server/tchannelthrift/node/server.go @@ -21,12 +21,12 @@ package node import ( + "github.com/uber/tchannel-go" + ns "github.com/m3db/m3/src/dbnode/network/server" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/node/channel" "github.com/m3db/m3/src/x/context" - - "github.com/uber/tchannel-go" ) type server struct { diff --git a/src/dbnode/network/server/tchannelthrift/node/service.go b/src/dbnode/network/server/tchannelthrift/node/service.go index 43302c081e..c28ffd6ce1 100644 --- a/src/dbnode/network/server/tchannelthrift/node/service.go +++ b/src/dbnode/network/server/tchannelthrift/node/service.go @@ -29,6 +29,11 @@ import ( "sync" "time" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "github.com/uber/tchannel-go/thrift" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/namespace" @@ -60,11 +65,6 @@ import ( "github.com/m3db/m3/src/x/serialize" tbinarypool "github.com/m3db/m3/src/x/thrift" xtime "github.com/m3db/m3/src/x/time" - - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "github.com/uber/tchannel-go/thrift" - "go.uber.org/zap" ) var ( @@ -440,9 +440,10 @@ func (s *service) Bootstrapped(ctx thrift.Context) (*rpc.NodeBootstrappedResult_ // BootstrappedInPlacementOrNoPlacement is designed to be used with cluster // management tools like k8s that expected an endpoint that will return // success if the node either: -// 1) Has no cluster placement set yet. -// 2) Is bootstrapped and durable, meaning it is bootstrapped and is able -// to bootstrap the shards it owns from it's own local disk. +// 1. Has no cluster placement set yet. +// 2. Is bootstrapped and durable, meaning it is bootstrapped and is able +// to bootstrap the shards it owns from it's own local disk. +// // This is useful in addition to the Bootstrapped RPC method as it helps // progress node addition/removal/modifications when no placement is set // at all and therefore the node has not been able to bootstrap yet. diff --git a/src/dbnode/network/server/tchannelthrift/node/service_test.go b/src/dbnode/network/server/tchannelthrift/node/service_test.go index 88dccc831c..23bfd32fcf 100644 --- a/src/dbnode/network/server/tchannelthrift/node/service_test.go +++ b/src/dbnode/network/server/tchannelthrift/node/service_test.go @@ -30,6 +30,13 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber/tchannel-go/thrift" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift" @@ -55,13 +62,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber/tchannel-go/thrift" ) // Create opts once to avoid recreating a lot of default pools, etc diff --git a/src/dbnode/persist/fs/bloom_filter.go b/src/dbnode/persist/fs/bloom_filter.go index 09f6e2612d..cd480b8bff 100644 --- a/src/dbnode/persist/fs/bloom_filter.go +++ b/src/dbnode/persist/fs/bloom_filter.go @@ -24,6 +24,7 @@ import ( "os" "github.com/m3db/bloom/v4" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/x/mmap" ) diff --git a/src/dbnode/persist/fs/clone/cloner_test.go b/src/dbnode/persist/fs/clone/cloner_test.go index d5988a12af..99fe7d0d19 100644 --- a/src/dbnode/persist/fs/clone/cloner_test.go +++ b/src/dbnode/persist/fs/clone/cloner_test.go @@ -29,13 +29,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/persist/fs/commitlog/commit_log.go b/src/dbnode/persist/fs/commitlog/commit_log.go index cb9516f393..85b97f8e37 100644 --- a/src/dbnode/persist/fs/commitlog/commit_log.go +++ b/src/dbnode/persist/fs/commitlog/commit_log.go @@ -27,6 +27,9 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/ts" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/x/context" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/persist/fs/commitlog/commit_log_conc_test.go b/src/dbnode/persist/fs/commitlog/commit_log_conc_test.go index 4bb54d8dfc..b6451ecd42 100644 --- a/src/dbnode/persist/fs/commitlog/commit_log_conc_test.go +++ b/src/dbnode/persist/fs/commitlog/commit_log_conc_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -26,11 +28,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/context" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) // TestCommitLogActiveLogsConcurrency makes sure that the diff --git a/src/dbnode/persist/fs/commitlog/commit_log_test.go b/src/dbnode/persist/fs/commitlog/commit_log_test.go index cec9059465..44b2ab0076 100644 --- a/src/dbnode/persist/fs/commitlog/commit_log_test.go +++ b/src/dbnode/persist/fs/commitlog/commit_log_test.go @@ -33,7 +33,10 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" "github.com/m3db/bitset" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -44,10 +47,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) type mockTime struct { diff --git a/src/dbnode/persist/fs/commitlog/files_test.go b/src/dbnode/persist/fs/commitlog/files_test.go index c0f7b7c5f6..7306ceaaf4 100644 --- a/src/dbnode/persist/fs/commitlog/files_test.go +++ b/src/dbnode/persist/fs/commitlog/files_test.go @@ -27,9 +27,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/persist/fs" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/persist/fs" ) func TestFiles(t *testing.T) { diff --git a/src/dbnode/persist/fs/commitlog/iterator.go b/src/dbnode/persist/fs/commitlog/iterator.go index b6cd94fef6..49c72ccb3e 100644 --- a/src/dbnode/persist/fs/commitlog/iterator.go +++ b/src/dbnode/persist/fs/commitlog/iterator.go @@ -26,10 +26,10 @@ import ( "io" "os" - "github.com/m3db/m3/src/dbnode/persist" - "github.com/uber-go/tally" "go.uber.org/zap" + + "github.com/m3db/m3/src/dbnode/persist" ) var ( diff --git a/src/dbnode/persist/fs/commitlog/read_write_prop_test.go b/src/dbnode/persist/fs/commitlog/read_write_prop_test.go index 68c9e5b0b9..9642256b43 100644 --- a/src/dbnode/persist/fs/commitlog/read_write_prop_test.go +++ b/src/dbnode/persist/fs/commitlog/read_write_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -34,20 +36,19 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/pool" - "github.com/m3db/m3/src/x/serialize" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/commands" + "github.com/leanovate/gopter/gen" + "github.com/stretchr/testify/require" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xos "github.com/m3db/m3/src/x/os" + "github.com/m3db/m3/src/x/pool" + "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/commands" - "github.com/leanovate/gopter/gen" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/persist/fs/commitlog/reader.go b/src/dbnode/persist/fs/commitlog/reader.go index a4f0878ad4..876abafa0f 100644 --- a/src/dbnode/persist/fs/commitlog/reader.go +++ b/src/dbnode/persist/fs/commitlog/reader.go @@ -27,6 +27,8 @@ import ( "io" "os" + "go.uber.org/atomic" + "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" "github.com/m3db/m3/src/dbnode/persist/schema" "github.com/m3db/m3/src/dbnode/ts" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/atomic" ) var ( diff --git a/src/dbnode/persist/fs/commitlog/writer.go b/src/dbnode/persist/fs/commitlog/writer.go index cbb0a5d839..635fa76194 100644 --- a/src/dbnode/persist/fs/commitlog/writer.go +++ b/src/dbnode/persist/fs/commitlog/writer.go @@ -28,6 +28,7 @@ import ( "os" "github.com/m3db/bitset" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" diff --git a/src/dbnode/persist/fs/files.go b/src/dbnode/persist/fs/files.go index 5deb04febb..b157c5e2be 100644 --- a/src/dbnode/persist/fs/files.go +++ b/src/dbnode/persist/fs/files.go @@ -32,6 +32,8 @@ import ( "strings" "time" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/persist" @@ -42,8 +44,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" ) var ( @@ -1749,7 +1749,7 @@ func FilesetPathFromTimeAndIndex(prefix string, t xtime.UnixNano, index int, suf // function, the caller expects there to be a legacy or non-legacy file, and // thus returns an error if neither exist. Note that this function does not // check for the volume's complete checkpoint file. -//nolint: unparam +// nolint: unparam func isFirstVolumeLegacy(prefix string, t xtime.UnixNano, suffix string) (bool, error) { // Check non-legacy path first to optimize for newer files. path := FilesetPathFromTimeAndIndex(prefix, t, 0, suffix) diff --git a/src/dbnode/persist/fs/files_test.go b/src/dbnode/persist/fs/files_test.go index 4ff4724c42..2c8f66e99a 100644 --- a/src/dbnode/persist/fs/files_test.go +++ b/src/dbnode/persist/fs/files_test.go @@ -33,6 +33,10 @@ import ( "testing" "time" + "github.com/pborman/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xresource "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( @@ -1327,7 +1327,7 @@ func createCommitLogFiles(t *testing.T, iter int) string { return dir } -//nolint: unparam +// nolint: unparam func writeOutTestSnapshot( t *testing.T, filePathPrefix string, shard uint32, blockStart xtime.UnixNano, volume int) { diff --git a/src/dbnode/persist/fs/index_lookup.go b/src/dbnode/persist/fs/index_lookup.go index fdcca7f483..50065f9a5e 100644 --- a/src/dbnode/persist/fs/index_lookup.go +++ b/src/dbnode/persist/fs/index_lookup.go @@ -68,12 +68,13 @@ func (il *nearestIndexOffsetLookup) concurrentClone() (*nearestIndexOffsetLookup } // getNearestIndexFileOffset returns either: -// 1. The offset in the index file for the specified series -// 2. The offset in the index file for the the series in the summaries file -// that satisfies the following two constraints: -// 1. Is closest to the desired series in the index file -// 2. Is BEFORE the desired series in the index file (because we -// we scan the index file sequentially in a forward-moving manner) +// 1. The offset in the index file for the specified series +// 2. The offset in the index file for the the series in the summaries file +// that satisfies the following two constraints: +// 1. Is closest to the desired series in the index file +// 2. Is BEFORE the desired series in the index file (because we +// we scan the index file sequentially in a forward-moving manner) +// // In other words, the returned offset can always be used as a starting point to // begin scanning the index file for the desired series. func (il *nearestIndexOffsetLookup) getNearestIndexFileOffset( diff --git a/src/dbnode/persist/fs/index_lookup_prop_test.go b/src/dbnode/persist/fs/index_lookup_prop_test.go index 5ce5cfc304..ffa64d139d 100644 --- a/src/dbnode/persist/fs/index_lookup_prop_test.go +++ b/src/dbnode/persist/fs/index_lookup_prop_test.go @@ -1,3 +1,4 @@ +//go:build big // +build big // Copyright (c) 2017 Uber Technologies, Inc. @@ -30,6 +31,11 @@ import ( "reflect" "testing" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" @@ -37,11 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/mmap" xtime "github.com/m3db/m3/src/x/time" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/assert" ) func TestIndexLookupWriteRead(t *testing.T) { diff --git a/src/dbnode/persist/fs/index_lookup_test.go b/src/dbnode/persist/fs/index_lookup_test.go index 62145751ae..a84efe2e76 100644 --- a/src/dbnode/persist/fs/index_lookup_test.go +++ b/src/dbnode/persist/fs/index_lookup_test.go @@ -29,13 +29,13 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" "github.com/m3db/m3/src/dbnode/persist/schema" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/mmap" - - "github.com/stretchr/testify/require" ) func TestNewNearestIndexOffsetDetectsUnsortedFiles(t *testing.T) { diff --git a/src/dbnode/persist/fs/index_read.go b/src/dbnode/persist/fs/index_read.go index 72fc72d3d0..450a2c0ca1 100644 --- a/src/dbnode/persist/fs/index_read.go +++ b/src/dbnode/persist/fs/index_read.go @@ -27,14 +27,14 @@ import ( "io/ioutil" "os" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/persist" idxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/mmap" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/persist/fs/index_read_write_test.go b/src/dbnode/persist/fs/index_read_write_test.go index 3b0929124a..3fec2788fd 100644 --- a/src/dbnode/persist/fs/index_read_write_test.go +++ b/src/dbnode/persist/fs/index_read_write_test.go @@ -33,14 +33,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" idxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func shardsSet(shards ...uint32) map[uint32]struct{} { diff --git a/src/dbnode/persist/fs/index_write.go b/src/dbnode/persist/fs/index_write.go index dd0dbe08f4..b1c027b16d 100644 --- a/src/dbnode/persist/fs/index_write.go +++ b/src/dbnode/persist/fs/index_write.go @@ -29,6 +29,8 @@ import ( "os" "time" + protobuftypes "github.com/gogo/protobuf/types" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/persist" @@ -36,8 +38,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" xos "github.com/m3db/m3/src/x/os" xtime "github.com/m3db/m3/src/x/time" - - protobuftypes "github.com/gogo/protobuf/types" ) const ( diff --git a/src/dbnode/persist/fs/index_write_test.go b/src/dbnode/persist/fs/index_write_test.go index 690323fb97..0dd55e3c6f 100644 --- a/src/dbnode/persist/fs/index_write_test.go +++ b/src/dbnode/persist/fs/index_write_test.go @@ -27,14 +27,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" idxpersist "github.com/m3db/m3/src/m3ninx/persist" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestSnapshotIndexWriter(t *testing.T) { diff --git a/src/dbnode/persist/fs/merger_test.go b/src/dbnode/persist/fs/merger_test.go index dd0d471326..33d00b5cd5 100644 --- a/src/dbnode/persist/fs/merger_test.go +++ b/src/dbnode/persist/fs/merger_test.go @@ -28,6 +28,9 @@ import ( "time" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" @@ -42,8 +45,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/persist/fs/migration/migration_test.go b/src/dbnode/persist/fs/migration/migration_test.go index 99f9db03f2..5144830f74 100644 --- a/src/dbnode/persist/fs/migration/migration_test.go +++ b/src/dbnode/persist/fs/migration/migration_test.go @@ -29,6 +29,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -41,8 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestToVersion1_1Run(t *testing.T) { diff --git a/src/dbnode/persist/fs/migration/task_options_test.go b/src/dbnode/persist/fs/migration/task_options_test.go index 0fd42f53cf..bcb97cfb79 100644 --- a/src/dbnode/persist/fs/migration/task_options_test.go +++ b/src/dbnode/persist/fs/migration/task_options_test.go @@ -25,12 +25,12 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" ) func defaultTestOptions(t *testing.T, ctrl *gomock.Controller) TaskOptions { diff --git a/src/dbnode/persist/fs/msgpack/decoder.go b/src/dbnode/persist/fs/msgpack/decoder.go index 692e3e2430..6a58fc1656 100644 --- a/src/dbnode/persist/fs/msgpack/decoder.go +++ b/src/dbnode/persist/fs/msgpack/decoder.go @@ -25,11 +25,11 @@ import ( "fmt" "io" + "gopkg.in/vmihailenco/msgpack.v2" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/schema" "github.com/m3db/m3/src/x/pool" - - "gopkg.in/vmihailenco/msgpack.v2" ) var ( diff --git a/src/dbnode/persist/fs/msgpack/decoder_fast.go b/src/dbnode/persist/fs/msgpack/decoder_fast.go index 46782b337c..110193242f 100644 --- a/src/dbnode/persist/fs/msgpack/decoder_fast.go +++ b/src/dbnode/persist/fs/msgpack/decoder_fast.go @@ -24,9 +24,9 @@ import ( "fmt" "math" - "github.com/m3db/m3/src/dbnode/persist/schema" - "gopkg.in/vmihailenco/msgpack.v2/codes" + + "github.com/m3db/m3/src/dbnode/persist/schema" ) const ( diff --git a/src/dbnode/persist/fs/msgpack/decoder_test.go b/src/dbnode/persist/fs/msgpack/decoder_test.go index 8a3d1f1e1e..52e0ca19e0 100644 --- a/src/dbnode/persist/fs/msgpack/decoder_test.go +++ b/src/dbnode/persist/fs/msgpack/decoder_test.go @@ -23,8 +23,9 @@ package msgpack import ( "testing" - "github.com/m3db/m3/src/dbnode/digest" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/digest" ) func testGenEncodeNumObjectFieldsForFn( diff --git a/src/dbnode/persist/fs/msgpack/encoder.go b/src/dbnode/persist/fs/msgpack/encoder.go index 1745dcf696..d15d5a9882 100644 --- a/src/dbnode/persist/fs/msgpack/encoder.go +++ b/src/dbnode/persist/fs/msgpack/encoder.go @@ -23,10 +23,10 @@ package msgpack import ( "bytes" + "gopkg.in/vmihailenco/msgpack.v2" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist/schema" - - "gopkg.in/vmihailenco/msgpack.v2" ) type encodeVersionFn func(value int) diff --git a/src/dbnode/persist/fs/msgpack/encoder_decoder_prop_test.go b/src/dbnode/persist/fs/msgpack/encoder_decoder_prop_test.go index 99d6391271..1f467a79e7 100644 --- a/src/dbnode/persist/fs/msgpack/encoder_decoder_prop_test.go +++ b/src/dbnode/persist/fs/msgpack/encoder_decoder_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -31,12 +33,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/persist/schema" - "github.com/m3db/m3/src/x/errors" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" + + "github.com/m3db/m3/src/dbnode/persist/schema" + "github.com/m3db/m3/src/x/errors" ) const minSuccessfulTests = 100000 diff --git a/src/dbnode/persist/fs/msgpack/encoder_fast.go b/src/dbnode/persist/fs/msgpack/encoder_fast.go index 16d6b00e9c..680d40019e 100644 --- a/src/dbnode/persist/fs/msgpack/encoder_fast.go +++ b/src/dbnode/persist/fs/msgpack/encoder_fast.go @@ -23,9 +23,9 @@ package msgpack import ( "math" - "github.com/m3db/m3/src/dbnode/persist/schema" - "gopkg.in/vmihailenco/msgpack.v2/codes" + + "github.com/m3db/m3/src/dbnode/persist/schema" ) // EncodeLogEntryFast encodes a commit log entry with no buffering and using optimized helper @@ -45,7 +45,6 @@ import ( // Before modifying this function, please run the BenchmarkLogEntryEncoderFast benchmark as a small // degradation in this functions performance can have a substantial impact on M3DB. // -// // Also note that there are extensive prop tests for this function in the encoder_decoder_prop_test.go // file which verify its correctness. func EncodeLogEntryFast(b []byte, entry schema.LogEntry) ([]byte, error) { diff --git a/src/dbnode/persist/fs/msgpack/encoder_test.go b/src/dbnode/persist/fs/msgpack/encoder_test.go index 775f01cf6a..a586f197f0 100644 --- a/src/dbnode/persist/fs/msgpack/encoder_test.go +++ b/src/dbnode/persist/fs/msgpack/encoder_test.go @@ -24,9 +24,9 @@ import ( "errors" "testing" - "github.com/m3db/m3/src/dbnode/persist/schema" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/persist/schema" ) var ( diff --git a/src/dbnode/persist/fs/msgpack/roundtrip_test.go b/src/dbnode/persist/fs/msgpack/roundtrip_test.go index 4e9007d958..6e7e9e01fc 100644 --- a/src/dbnode/persist/fs/msgpack/roundtrip_test.go +++ b/src/dbnode/persist/fs/msgpack/roundtrip_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/schema" xtest "github.com/m3db/m3/src/x/test" xhash "github.com/m3db/m3/src/x/test/hash" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/persist/fs/persist_manager.go b/src/dbnode/persist/fs/persist_manager.go index 5a604b0b97..9d3942c52f 100644 --- a/src/dbnode/persist/fs/persist_manager.go +++ b/src/dbnode/persist/fs/persist_manager.go @@ -26,6 +26,10 @@ import ( "sync" "time" + "github.com/pborman/uuid" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/ratelimit" "github.com/m3db/m3/src/dbnode/runtime" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" xresource "github.com/m3db/m3/src/x/resource" - - "github.com/pborman/uuid" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/persist/fs/persist_manager_test.go b/src/dbnode/persist/fs/persist_manager_test.go index fbc7f5f3aa..d317a73988 100644 --- a/src/dbnode/persist/fs/persist_manager_test.go +++ b/src/dbnode/persist/fs/persist_manager_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/ts" @@ -40,10 +44,6 @@ import ( m3test "github.com/m3db/m3/src/x/test" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPersistenceManagerPrepareDataFileExistsNoDelete(t *testing.T) { diff --git a/src/dbnode/persist/fs/read.go b/src/dbnode/persist/fs/read.go index 82e1e74b0b..d401c51fb7 100644 --- a/src/dbnode/persist/fs/read.go +++ b/src/dbnode/persist/fs/read.go @@ -29,6 +29,8 @@ import ( "sort" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" @@ -40,8 +42,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/persist/fs/read_test.go b/src/dbnode/persist/fs/read_test.go index e053653e2f..1003cb7b64 100644 --- a/src/dbnode/persist/fs/read_test.go +++ b/src/dbnode/persist/fs/read_test.go @@ -30,6 +30,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/persist/fs/read_write_test.go b/src/dbnode/persist/fs/read_write_test.go index f3330f6c2d..cf7c987325 100644 --- a/src/dbnode/persist/fs/read_write_test.go +++ b/src/dbnode/persist/fs/read_write_test.go @@ -29,17 +29,17 @@ import ( "testing" "time" + "github.com/m3db/bloom/v4" + "github.com/pborman/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/bloom/v4" - "github.com/pborman/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( @@ -173,7 +173,7 @@ var readTestTypes = []readTestType{ readTestTypeMetadata, } -//nolint: unparam +// nolint: unparam func readTestData(t *testing.T, r DataFileSetReader, shard uint32, timestamp xtime.UnixNano, entries []testEntry) { readTestDataWithStreamingOpt(t, r, shard, timestamp, entries, false) diff --git a/src/dbnode/persist/fs/retriever.go b/src/dbnode/persist/fs/retriever.go index a29ef42027..9929b4e4cf 100644 --- a/src/dbnode/persist/fs/retriever.go +++ b/src/dbnode/persist/fs/retriever.go @@ -39,6 +39,9 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/dbnode/storage/block" @@ -49,9 +52,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/persist/fs/retriever_test.go b/src/dbnode/persist/fs/retriever_test.go index 0d4f42de18..1869bc6ba1 100644 --- a/src/dbnode/persist/fs/retriever_test.go +++ b/src/dbnode/persist/fs/retriever_test.go @@ -33,6 +33,10 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/uber-go/tally" "github.com/m3db/m3/src/cluster/shard" @@ -52,11 +56,6 @@ import ( "github.com/m3db/m3/src/x/pool" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testBlockRetrieverOptions struct { diff --git a/src/dbnode/persist/fs/seek.go b/src/dbnode/persist/fs/seek.go index 0c29ab3a8f..fb41ca0522 100644 --- a/src/dbnode/persist/fs/seek.go +++ b/src/dbnode/persist/fs/seek.go @@ -29,6 +29,8 @@ import ( "os" "time" + "gopkg.in/vmihailenco/msgpack.v2" + "github.com/m3db/m3/src/dbnode/digest" xmsgpack "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" "github.com/m3db/m3/src/dbnode/persist/schema" @@ -39,8 +41,6 @@ import ( "github.com/m3db/m3/src/x/mmap" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "gopkg.in/vmihailenco/msgpack.v2" ) var ( @@ -377,14 +377,14 @@ func (s *seeker) SeekByIndexEntry( // SeekIndexEntry performs the following steps: // -// 1. Go to the indexLookup and it will give us an offset that is a good starting -// point for scanning the index file. -// 2. Reset an offsetFileReader with the index fd and an offset (so that calls to Read() will -// begin at the offset provided by the offset lookup). -// 3. Reset a decoder with fileDecoderStream (offsetFileReader wrapped in a bufio.Reader). -// 4. Call DecodeIndexEntry in a tight loop (which will advance our position in the -// offsetFileReader internally) until we've either found the entry we're looking for or gone so -// far we know it does not exist. +// 1. Go to the indexLookup and it will give us an offset that is a good starting +// point for scanning the index file. +// 2. Reset an offsetFileReader with the index fd and an offset (so that calls to Read() will +// begin at the offset provided by the offset lookup). +// 3. Reset a decoder with fileDecoderStream (offsetFileReader wrapped in a bufio.Reader). +// 4. Call DecodeIndexEntry in a tight loop (which will advance our position in the +// offsetFileReader internally) until we've either found the entry we're looking for or gone so +// far we know it does not exist. func (s *seeker) SeekIndexEntry( id ident.ID, resources ReusableSeekerResources, diff --git a/src/dbnode/persist/fs/seek_manager.go b/src/dbnode/persist/fs/seek_manager.go index 87bf316937..8a41e5a164 100644 --- a/src/dbnode/persist/fs/seek_manager.go +++ b/src/dbnode/persist/fs/seek_manager.go @@ -27,6 +27,8 @@ import ( "syscall" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/sharding" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/x/pool" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) const ( @@ -496,18 +496,18 @@ func (m *seekerManager) markBorrowedSeekerAsReturned( // The bulk of the complexity of this function is caused by the desire to avoid the hot-swap from // causing any latency spikes. To accomplish this, the following is performed: // -// 1. Open the new seeker outside the context of any locks. -// 2. Acquire a lock on the seekers that need to be swapped and rotate the existing "active" seekers -// to be "inactive" and set the newly opened seekers as "active". This operation is extremely cheap -// and ensures that all subsequent reads will use the seekers for the latest volume instead of the -// previous. In addition, this phase also creates a waitgroup for the inactive seekers that will be -// be used to "wait" for all of the existing seekers that are currently borrowed to be returned. -// 3. Release the lock so that reads can continue uninterrupted and call waitgroup.Wait() to wait for all -// the currently borrowed "inactive" seekers (if any) to be returned. -// 4. Every call to Return() for an "inactive" seeker will check if it's the last borrowed inactive seeker, -// and if so, will close all the inactive seekers and call wg.Done() which will notify the goroutine -// running the UpdateOpenLease() function that all inactive seekers have been returned and closed at -// which point the function will return successfully. +// 1. Open the new seeker outside the context of any locks. +// 2. Acquire a lock on the seekers that need to be swapped and rotate the existing "active" seekers +// to be "inactive" and set the newly opened seekers as "active". This operation is extremely cheap +// and ensures that all subsequent reads will use the seekers for the latest volume instead of the +// previous. In addition, this phase also creates a waitgroup for the inactive seekers that will be +// be used to "wait" for all of the existing seekers that are currently borrowed to be returned. +// 3. Release the lock so that reads can continue uninterrupted and call waitgroup.Wait() to wait for all +// the currently borrowed "inactive" seekers (if any) to be returned. +// 4. Every call to Return() for an "inactive" seeker will check if it's the last borrowed inactive seeker, +// and if so, will close all the inactive seekers and call wg.Done() which will notify the goroutine +// running the UpdateOpenLease() function that all inactive seekers have been returned and closed at +// which point the function will return successfully. func (m *seekerManager) UpdateOpenLease( descriptor block.LeaseDescriptor, state block.LeaseState, diff --git a/src/dbnode/persist/fs/seek_manager_test.go b/src/dbnode/persist/fs/seek_manager_test.go index 327a192ad2..5f149cde41 100644 --- a/src/dbnode/persist/fs/seek_manager_test.go +++ b/src/dbnode/persist/fs/seek_manager_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/sharding" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/persist/fs/seek_test.go b/src/dbnode/persist/fs/seek_test.go index f74dadadae..1bb35f5914 100644 --- a/src/dbnode/persist/fs/seek_test.go +++ b/src/dbnode/persist/fs/seek_test.go @@ -28,12 +28,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/schema" "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func newTestSeeker(filePathPrefix string) DataFileSetSeeker { diff --git a/src/dbnode/persist/fs/snapshot_metadata_read.go b/src/dbnode/persist/fs/snapshot_metadata_read.go index 208619226c..e563253908 100644 --- a/src/dbnode/persist/fs/snapshot_metadata_read.go +++ b/src/dbnode/persist/fs/snapshot_metadata_read.go @@ -24,11 +24,11 @@ import ( "fmt" "os" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/snapshot" "github.com/m3db/m3/src/dbnode/persist" - - "github.com/pborman/uuid" ) // NewSnapshotMetadataReader returns a new SnapshotMetadataReader. diff --git a/src/dbnode/persist/fs/snapshot_metadata_read_write_test.go b/src/dbnode/persist/fs/snapshot_metadata_read_write_test.go index 22611b7416..3b4376c63a 100644 --- a/src/dbnode/persist/fs/snapshot_metadata_read_write_test.go +++ b/src/dbnode/persist/fs/snapshot_metadata_read_write_test.go @@ -25,10 +25,10 @@ import ( "path/filepath" "testing" - "github.com/m3db/m3/src/dbnode/persist" - "github.com/pborman/uuid" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/persist" ) func TestSnapshotMetadataWriteAndRead(t *testing.T) { diff --git a/src/dbnode/persist/fs/snapshot_metadata_write.go b/src/dbnode/persist/fs/snapshot_metadata_write.go index c23abb59a9..954fe98a4e 100644 --- a/src/dbnode/persist/fs/snapshot_metadata_write.go +++ b/src/dbnode/persist/fs/snapshot_metadata_write.go @@ -24,12 +24,12 @@ import ( "fmt" "os" + "github.com/gogo/protobuf/proto" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/snapshot" "github.com/m3db/m3/src/dbnode/persist" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/gogo/protobuf/proto" ) type cleanupFn func() error diff --git a/src/dbnode/persist/fs/streaming_write.go b/src/dbnode/persist/fs/streaming_write.go index f0657e9994..cff96c2ff6 100644 --- a/src/dbnode/persist/fs/streaming_write.go +++ b/src/dbnode/persist/fs/streaming_write.go @@ -27,12 +27,12 @@ import ( "math" "time" + "github.com/m3db/bloom/v4" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/bloom/v4" ) // StreamingWriter writes into data fileset without intermediate buffering. diff --git a/src/dbnode/persist/fs/streaming_write_test.go b/src/dbnode/persist/fs/streaming_write_test.go index 5ba7394147..94cb484305 100644 --- a/src/dbnode/persist/fs/streaming_write_test.go +++ b/src/dbnode/persist/fs/streaming_write_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) type testStreamingEntry struct { diff --git a/src/dbnode/persist/fs/write.go b/src/dbnode/persist/fs/write.go index 3ff630dd54..ac46e8484a 100644 --- a/src/dbnode/persist/fs/write.go +++ b/src/dbnode/persist/fs/write.go @@ -29,6 +29,9 @@ import ( "sort" "time" + "github.com/m3db/bloom/v4" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/msgpack" @@ -39,9 +42,6 @@ import ( xresource "github.com/m3db/m3/src/x/resource" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/bloom/v4" - "github.com/pborman/uuid" ) const ( diff --git a/src/dbnode/persist/fs/write_test.go b/src/dbnode/persist/fs/write_test.go index af134a72f7..117c48275e 100644 --- a/src/dbnode/persist/fs/write_test.go +++ b/src/dbnode/persist/fs/write_test.go @@ -26,10 +26,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/require" ) // TestWriteReuseAfterError was added as a regression test after it was diff --git a/src/dbnode/persist/types.go b/src/dbnode/persist/types.go index 846d808e44..1dbb3b648c 100644 --- a/src/dbnode/persist/types.go +++ b/src/dbnode/persist/types.go @@ -24,6 +24,8 @@ import ( "errors" "fmt" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/m3ninx/doc" @@ -31,8 +33,6 @@ import ( idxpersist "github.com/m3db/m3/src/m3ninx/persist" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" ) var errReusableTagIteratorRequired = errors.New("reusable tags iterator is required") diff --git a/src/dbnode/server/server.go b/src/dbnode/server/server.go index 3a91c27bdd..6ce0977f24 100644 --- a/src/dbnode/server/server.go +++ b/src/dbnode/server/server.go @@ -36,6 +36,15 @@ import ( "sync" "time" + "github.com/m3dbx/vellum/levenshtein" + "github.com/m3dbx/vellum/levenshtein2" + "github.com/m3dbx/vellum/regexp" + "github.com/opentracing/opentracing-go" + "github.com/uber-go/tally" + "github.com/uber/tchannel-go" + "go.etcd.io/etcd/server/v3/embed" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/client/etcd" "github.com/m3db/m3/src/cluster/generated/proto/commonpb" @@ -93,15 +102,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" tbinarypool "github.com/m3db/m3/src/x/thrift" - - "github.com/m3dbx/vellum/levenshtein" - "github.com/m3dbx/vellum/levenshtein2" - "github.com/m3dbx/vellum/regexp" - "github.com/opentracing/opentracing-go" - "github.com/uber-go/tally" - "github.com/uber/tchannel-go" - "go.etcd.io/etcd/server/v3/embed" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/sharding/shardset.go b/src/dbnode/sharding/shardset.go index 8d40430609..d2aa7df779 100644 --- a/src/dbnode/sharding/shardset.go +++ b/src/dbnode/sharding/shardset.go @@ -24,9 +24,10 @@ import ( "errors" "math" + murmur3 "github.com/m3db/stackmurmur3/v2" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/ident" - "github.com/m3db/stackmurmur3/v2" ) var ( diff --git a/src/dbnode/sharding/shardset_test.go b/src/dbnode/sharding/shardset_test.go index 1b16193a74..9614968904 100644 --- a/src/dbnode/sharding/shardset_test.go +++ b/src/dbnode/sharding/shardset_test.go @@ -23,9 +23,10 @@ package sharding import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" ) func TestShardSet(t *testing.T) { diff --git a/src/dbnode/storage/block/block_proto_test.go b/src/dbnode/storage/block/block_proto_test.go index bb500b9d09..9949580596 100644 --- a/src/dbnode/storage/block/block_proto_test.go +++ b/src/dbnode/storage/block/block_proto_test.go @@ -25,14 +25,14 @@ import ( "time" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/testdata/prototest" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/block/block_test.go b/src/dbnode/storage/block/block_test.go index 17717e323a..c423c6784e 100644 --- a/src/dbnode/storage/block/block_test.go +++ b/src/dbnode/storage/block/block_test.go @@ -25,18 +25,18 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func testDatabaseBlock(ctrl *gomock.Controller) *dbBlock { diff --git a/src/dbnode/storage/block/lease_test.go b/src/dbnode/storage/block/lease_test.go index 2da43d67fb..94513edeac 100644 --- a/src/dbnode/storage/block/lease_test.go +++ b/src/dbnode/storage/block/lease_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestRegisterLeaser(t *testing.T) { diff --git a/src/dbnode/storage/block/result_pool_test.go b/src/dbnode/storage/block/result_pool_test.go index 549e1e6584..6ab62afb6b 100644 --- a/src/dbnode/storage/block/result_pool_test.go +++ b/src/dbnode/storage/block/result_pool_test.go @@ -23,11 +23,11 @@ package block import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func testResultPoolOptions(size int) pool.ObjectPoolOptions { diff --git a/src/dbnode/storage/block/result_test.go b/src/dbnode/storage/block/result_test.go index 6789ec15a6..81dc121e21 100644 --- a/src/dbnode/storage/block/result_test.go +++ b/src/dbnode/storage/block/result_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/ident" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" + xtime "github.com/m3db/m3/src/x/time" ) func TestSortFetchBlockResultByTimeAscending(t *testing.T) { diff --git a/src/dbnode/storage/block/wired_list.go b/src/dbnode/storage/block/wired_list.go index 56ca37b35a..ca73671d7d 100644 --- a/src/dbnode/storage/block/wired_list.go +++ b/src/dbnode/storage/block/wired_list.go @@ -55,12 +55,12 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/storage/block/wired_list_test.go b/src/dbnode/storage/block/wired_list_test.go index a1999c5540..6551e75e18 100644 --- a/src/dbnode/storage/block/wired_list_test.go +++ b/src/dbnode/storage/block/wired_list_test.go @@ -25,6 +25,10 @@ import ( "fmt" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/ts" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) // The tests in this file use Start and Stop a lot to ensure diff --git a/src/dbnode/storage/bootstrap/bootstrapper/base.go b/src/dbnode/storage/bootstrap/bootstrapper/base.go index bd04b910dd..6af2e42e0b 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/base.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/base.go @@ -23,12 +23,12 @@ package bootstrapper import ( "fmt" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/dbnode/storage/bootstrap" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/x/context" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/base_test.go b/src/dbnode/storage/bootstrap/bootstrapper/base_test.go index 156d953c63..127eee9f9e 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/base_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/base_test.go @@ -24,6 +24,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/bootstrap" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" @@ -31,10 +35,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source.go index aa0cdb8b65..8f79be469b 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source.go @@ -29,6 +29,11 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go" + "github.com/uber-go/tally" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -45,11 +50,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/opentracing/opentracing-go" - "github.com/uber-go/tally" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" ) const ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_proto_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_proto_test.go index 14b6e15ec0..c3b78405d1 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_proto_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_proto_test.go @@ -23,11 +23,11 @@ package commitlog import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/testdata/prototest" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_test.go index 6ae6ae2341..c1b1c7dba5 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_data_test.go @@ -27,6 +27,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -44,9 +47,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_index_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_index_test.go index 8f9e65c7bc..f405e4f064 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_index_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_index_test.go @@ -24,6 +24,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var namespaceOptions = namespace.NewOptions() diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go index 1fe0114e95..311dbddc05 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2017 Uber Technologies, Inc. // @@ -34,6 +36,12 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + murmur3 "github.com/m3db/stackmurmur3/v2" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/encoding" @@ -52,12 +60,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/leanovate/gopter/prop" - murmur3 "github.com/m3db/stackmurmur3/v2" - "github.com/stretchr/testify/require" ) const maxShards = 1024 diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_test.go index 7c84818ffe..1ba347b007 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/runtime" @@ -34,8 +36,6 @@ import ( tu "github.com/m3db/m3/src/dbnode/topology/testutil" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator.go index 5dcbe60ba3..5caab9c434 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator.go @@ -23,6 +23,8 @@ package migrator import ( "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -32,8 +34,6 @@ import ( "github.com/m3db/m3/src/dbnode/tracepoint" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) type worker struct { diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator_test.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator_test.go index e9c22fe201..94bcb9ff83 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/migrator_test.go @@ -23,6 +23,9 @@ package migrator import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/migration" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestMigratorRun(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/options_test.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/options_test.go index ee2b7d5586..6b25098944 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/options_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/migrator/options_test.go @@ -23,14 +23,14 @@ package migrator import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/migration" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/storage/bootstrap" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestOptionsValidateStorageOptions(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/source.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/source.go index 88d814509d..acc1f4fcb6 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/source.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/source.go @@ -26,6 +26,12 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -51,12 +57,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/opentracing/opentracing-go" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) type runType int diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/source_data_test.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/source_data_test.go index 9733589fd1..78b95b1e27 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/source_data_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/source_data_test.go @@ -31,6 +31,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -54,9 +57,6 @@ import ( "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/fs/source_index_bench_test.go b/src/dbnode/storage/bootstrap/bootstrapper/fs/source_index_bench_test.go index 29cac0f33a..81c7b8aa95 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/fs/source_index_bench_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/fs/source_index_bench_test.go @@ -32,6 +32,10 @@ import ( "testing" "time" + "github.com/davecgh/go-spew/spew" + "github.com/pkg/profile" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/dbnode/storage/series" xtime "github.com/m3db/m3/src/x/time" - - "github.com/davecgh/go-spew/spew" - "github.com/pkg/profile" - "github.com/stretchr/testify/require" ) // BenchmarkBootstrapIndex allows for testing indexing bootstrap time with the diff --git a/src/dbnode/storage/bootstrap/bootstrapper/noop_test.go b/src/dbnode/storage/bootstrap/bootstrapper/noop_test.go index 776112cb49..702b08da2e 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/noop_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/noop_test.go @@ -23,10 +23,10 @@ package bootstrapper import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/bootstrap" - - "github.com/stretchr/testify/require" ) func TestNoOpNoneBootstrapperBootstrapProvider(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/bootstrapper/peers/peers_test.go b/src/dbnode/storage/bootstrap/bootstrapper/peers/peers_test.go index d223877d8f..dd9b79e100 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/peers/peers_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/peers/peers_test.go @@ -23,6 +23,10 @@ package peers import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -30,10 +34,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/storage/index/compaction" "github.com/m3db/m3/src/m3ninx/index/segment/fst" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNewPeersBootstrapperInvalidOpts(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/bootstrapper/peers/source.go b/src/dbnode/storage/bootstrap/bootstrapper/peers/source.go index 05291ac69e..dae8a3b889 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/peers/source.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/peers/source.go @@ -391,10 +391,11 @@ type seriesBlocks struct { // fetchBootstrapBlocksFromPeers loops through all the provided ranges for a given shard and // fetches all the bootstrap blocks from the appropriate peers. -// Persistence enabled case: Immediately add the results to the bootstrap result -// Persistence disabled case: Don't add the results yet, but push a flush into the -// persistenceQueue. The persistenceQueue worker will eventually -// add the results once its performed the flush. +// +// Persistence enabled case: Immediately add the results to the bootstrap result +// Persistence disabled case: Don't add the results yet, but push a flush into the +// persistenceQueue. The persistenceQueue worker will eventually +// add the results once its performed the flush. func (s *peersSource) fetchBootstrapBlocksFromPeers( shard uint32, ranges xtime.Ranges, diff --git a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_data_test.go b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_data_test.go index d68817113e..928d1647a6 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_data_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_data_test.go @@ -26,6 +26,10 @@ import ( "sync" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -45,10 +49,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_index_test.go b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_index_test.go index b84796fec2..3337e59855 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_index_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_index_test.go @@ -27,6 +27,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( @@ -125,7 +125,7 @@ func TestBootstrapIndex(t *testing.T) { } } -//nolint +// nolint func testBootstrapIndex(t *testing.T, test testOptions) { ctrl := gomock.NewController(t) defer ctrl.Finish() diff --git a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_test.go b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_test.go index f5fe604f5c..6b10d7bd9d 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/peers/source_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/peers/source_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/persist/fs" m3dbruntime "github.com/m3db/m3/src/dbnode/runtime" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/storage/bootstrap/bootstrapper/readers.go b/src/dbnode/storage/bootstrap/bootstrapper/readers.go index d6ed64f3ea..ed48397ee7 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/readers.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/readers.go @@ -24,6 +24,11 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go" + opentracinglog "github.com/opentracing/opentracing-go/log" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/runtime" @@ -31,11 +36,6 @@ import ( "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/x/clock" xtime "github.com/m3db/m3/src/x/time" - - "github.com/opentracing/opentracing-go" - opentracinglog "github.com/opentracing/opentracing-go/log" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) // TimeWindowReaders are grouped by data block. diff --git a/src/dbnode/storage/bootstrap/bootstrapper/uninitialized/source_test.go b/src/dbnode/storage/bootstrap/bootstrapper/uninitialized/source_test.go index 686ba26239..eb2272a1e2 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/uninitialized/source_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/uninitialized/source_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/cache_test.go b/src/dbnode/storage/bootstrap/cache_test.go index 366a7e3c03..61b7346b43 100644 --- a/src/dbnode/storage/bootstrap/cache_test.go +++ b/src/dbnode/storage/bootstrap/cache_test.go @@ -27,6 +27,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/bootstrap/process.go b/src/dbnode/storage/bootstrap/process.go index fef1032fe3..ca9cc2518e 100644 --- a/src/dbnode/storage/bootstrap/process.go +++ b/src/dbnode/storage/bootstrap/process.go @@ -26,6 +26,10 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go/log" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -36,10 +40,6 @@ import ( "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/context" xtime "github.com/m3db/m3/src/x/time" - - "github.com/opentracing/opentracing-go/log" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) var ( diff --git a/src/dbnode/storage/bootstrap/process_test.go b/src/dbnode/storage/bootstrap/process_test.go index 41ed901dec..c15e4bd881 100644 --- a/src/dbnode/storage/bootstrap/process_test.go +++ b/src/dbnode/storage/bootstrap/process_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestBootstrapProcessRunActiveBlockAdvanced(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/result/result_data_test.go b/src/dbnode/storage/bootstrap/result/result_data_test.go index ce58c55eed..df1ba87e03 100644 --- a/src/dbnode/storage/bootstrap/result/result_data_test.go +++ b/src/dbnode/storage/bootstrap/result/result_data_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "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/checked" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var testBlockSize = 2 * time.Hour diff --git a/src/dbnode/storage/bootstrap/result/result_index_test.go b/src/dbnode/storage/bootstrap/result/result_index_test.go index aa625ba03e..eb2dc74141 100644 --- a/src/dbnode/storage/bootstrap/result/result_index_test.go +++ b/src/dbnode/storage/bootstrap/result/result_index_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/m3ninx/index/segment" idxpersist "github.com/m3db/m3/src/m3ninx/persist" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestIndexResultMergeMergesExistingSegments(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/result/shard_ranges_test.go b/src/dbnode/storage/bootstrap/result/shard_ranges_test.go index e12a6ff7c2..19b027ec95 100644 --- a/src/dbnode/storage/bootstrap/result/shard_ranges_test.go +++ b/src/dbnode/storage/bootstrap/result/shard_ranges_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + xtime "github.com/m3db/m3/src/x/time" ) func TestShardTimeRangesAdd(t *testing.T) { diff --git a/src/dbnode/storage/bootstrap/util.go b/src/dbnode/storage/bootstrap/util.go index 92c823388d..df879f64cb 100644 --- a/src/dbnode/storage/bootstrap/util.go +++ b/src/dbnode/storage/bootstrap/util.go @@ -28,6 +28,10 @@ import ( "sort" "sync" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // ReadersForID is a slice of readers that share a series ID. diff --git a/src/dbnode/storage/bootstrap_instrumentation_test.go b/src/dbnode/storage/bootstrap_instrumentation_test.go index ec8e556538..84ac56a302 100644 --- a/src/dbnode/storage/bootstrap_instrumentation_test.go +++ b/src/dbnode/storage/bootstrap_instrumentation_test.go @@ -25,11 +25,11 @@ import ( "strings" "testing" - "github.com/m3db/m3/src/dbnode/storage/bootstrap" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/stretchr/testify/assert" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/dbnode/storage/bootstrap" + xerrors "github.com/m3db/m3/src/x/errors" ) func TestBootstrapRetryMetricReason(t *testing.T) { diff --git a/src/dbnode/storage/cleanup.go b/src/dbnode/storage/cleanup.go index 9d94c9a3d2..8487711482 100644 --- a/src/dbnode/storage/cleanup.go +++ b/src/dbnode/storage/cleanup.go @@ -25,6 +25,10 @@ import ( "sort" "sync" + "github.com/pborman/uuid" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" @@ -33,10 +37,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" - "github.com/uber-go/tally" - "go.uber.org/zap" ) type ( @@ -381,30 +381,30 @@ func (m *cleanupManager) cleanupCompactedNamespaceDataFiles(shards []databaseSha // According to the snapshotting / commitlog rotation logic, the files that are required for a complete // recovery are: // -// 1. The most recent (highest index) snapshot metadata files. -// 2. All snapshot files whose associated snapshot ID matches the snapshot ID of the most recent snapshot -// metadata file. -// 3. All commitlog files whose index is larger than or equal to the index of the commitlog identifier stored -// in the most recent snapshot metadata file. This is because the snapshotting and commitlog rotation process -// guarantees that the most recent snapshot contains all data stored in commitlogs that were created before -// the rotation / snapshot process began. +// 1. The most recent (highest index) snapshot metadata files. +// 2. All snapshot files whose associated snapshot ID matches the snapshot ID of the most recent snapshot +// metadata file. +// 3. All commitlog files whose index is larger than or equal to the index of the commitlog identifier stored +// in the most recent snapshot metadata file. This is because the snapshotting and commitlog rotation process +// guarantees that the most recent snapshot contains all data stored in commitlogs that were created before +// the rotation / snapshot process began. // // cleanupSnapshotsAndCommitlogs accomplishes this goal by performing the following steps: // -// 1. List all the snapshot metadata files on disk. -// 2. Identify the most recent one (highest index). -// 3. For every namespace/shard/block combination, delete all snapshot -// files that match one of the following criteria: -// 1. Snapshot files whose associated snapshot ID does not match the snapshot ID of the most recent -// snapshot metadata file. -// 2. Snapshot files that are corrupt. -// 4. Delete all snapshot metadata files prior to the most recent once. -// 5. Delete corrupt snapshot metadata files. -// 6. List all the commitlog files on disk. -// 7. List all the commitlog files that are being actively written to. -// 8. Delete all commitlog files whose index is lower than the index of the commitlog file referenced in the -// most recent snapshot metadata file (ignoring any commitlog files being actively written to.) -// 9. Delete all corrupt commitlog files (ignoring any commitlog files being actively written to.) +// 1. List all the snapshot metadata files on disk. +// 2. Identify the most recent one (highest index). +// 3. For every namespace/shard/block combination, delete all snapshot +// files that match one of the following criteria: +// 1. Snapshot files whose associated snapshot ID does not match the snapshot ID of the most recent +// snapshot metadata file. +// 2. Snapshot files that are corrupt. +// 4. Delete all snapshot metadata files prior to the most recent once. +// 5. Delete corrupt snapshot metadata files. +// 6. List all the commitlog files on disk. +// 7. List all the commitlog files that are being actively written to. +// 8. Delete all commitlog files whose index is lower than the index of the commitlog file referenced in the +// most recent snapshot metadata file (ignoring any commitlog files being actively written to.) +// 9. Delete all corrupt commitlog files (ignoring any commitlog files being actively written to.) // // This process is also modeled formally in TLA+ in the file `SnapshotsSpec.tla`. func (m *cleanupManager) cleanupSnapshotsAndCommitlogs(namespaces []databaseNamespace) (finalErr error) { diff --git a/src/dbnode/storage/cleanup_test.go b/src/dbnode/storage/cleanup_test.go index 00ba77a537..2033637f55 100644 --- a/src/dbnode/storage/cleanup_test.go +++ b/src/dbnode/storage/cleanup_test.go @@ -27,6 +27,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/pborman/uuid" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/pborman/uuid" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( diff --git a/src/dbnode/storage/cluster/cluster_test.go b/src/dbnode/storage/cluster/cluster_test.go index 43e4a8a516..2aed179889 100644 --- a/src/dbnode/storage/cluster/cluster_test.go +++ b/src/dbnode/storage/cluster/cluster_test.go @@ -24,14 +24,14 @@ import ( "fmt" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) type restoreFn func() diff --git a/src/dbnode/storage/cluster/database.go b/src/dbnode/storage/cluster/database.go index 0e082be647..e67ef11308 100644 --- a/src/dbnode/storage/cluster/database.go +++ b/src/dbnode/storage/cluster/database.go @@ -26,12 +26,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/topology" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( @@ -167,8 +168,8 @@ func (d *clusterDB) Close() error { // it is safe to continue a deploy or performing topology changes. In that case, // we only need to determine two things: // -// 1. Is the node bootstrapped? -// 2. Are all of its shards available? +// 1. Is the node bootstrapped? +// 2. Are all of its shards available? // // If so, then the node has finished bootstrapping and will be able to recover // all of its data (assuming the default bootstrapper configuration of diff --git a/src/dbnode/storage/cluster/database_test.go b/src/dbnode/storage/cluster/database_test.go index 1fa7464767..38ce7080b0 100644 --- a/src/dbnode/storage/cluster/database_test.go +++ b/src/dbnode/storage/cluster/database_test.go @@ -25,15 +25,15 @@ import ( "sync" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/dbnode/storage" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/dbnode/topology/testutil" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var testOpts = storage.DefaultTestOptions() diff --git a/src/dbnode/storage/coldflush.go b/src/dbnode/storage/coldflush.go index 9e341241f2..ac8529d9a5 100644 --- a/src/dbnode/storage/coldflush.go +++ b/src/dbnode/storage/coldflush.go @@ -23,14 +23,14 @@ package storage import ( "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/dbnode/persist" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) type coldFlushManager struct { diff --git a/src/dbnode/storage/coldflush_test.go b/src/dbnode/storage/coldflush_test.go index 8c06139f08..d9705e4469 100644 --- a/src/dbnode/storage/coldflush_test.go +++ b/src/dbnode/storage/coldflush_test.go @@ -26,11 +26,12 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist" "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" ) func TestColdFlushManagerFlushAlreadyInProgress(t *testing.T) { diff --git a/src/dbnode/storage/database.go b/src/dbnode/storage/database.go index d07bb8657f..8a58e07a28 100644 --- a/src/dbnode/storage/database.go +++ b/src/dbnode/storage/database.go @@ -28,6 +28,10 @@ import ( "sync/atomic" "time" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/generated/proto/annotation" @@ -50,10 +54,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xopentracing "github.com/m3db/m3/src/x/opentracing" xtime "github.com/m3db/m3/src/x/time" - - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( @@ -1155,13 +1155,13 @@ func (d *db) IsBootstrapped() bool { } // IsBootstrappedAndDurable should only return true if the following conditions are met: -// 1. The database is bootstrapped. -// 2. The last successful snapshot began AFTER the last bootstrap completed. +// 1. The database is bootstrapped. +// 2. The last successful snapshot began AFTER the last bootstrap completed. // // Those two conditions should be sufficient to ensure that after a placement change the // node will be able to bootstrap any and all data from its local disk, however, for posterity // we also perform the following check: -// 3. The last bootstrap completed AFTER the shardset was last assigned. +// 3. The last bootstrap completed AFTER the shardset was last assigned. func (d *db) IsBootstrappedAndDurable() bool { isBootstrapped := d.mediator.IsBootstrapped() if !isBootstrapped { diff --git a/src/dbnode/storage/database_bootstrapped_test.go b/src/dbnode/storage/database_bootstrapped_test.go index ba61648a74..b1c12371e1 100644 --- a/src/dbnode/storage/database_bootstrapped_test.go +++ b/src/dbnode/storage/database_bootstrapped_test.go @@ -24,9 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" ) func TestDatabaseIsBootstrappedAndDurable(t *testing.T) { diff --git a/src/dbnode/storage/database_test.go b/src/dbnode/storage/database_test.go index 1749e2dafa..d49454169f 100644 --- a/src/dbnode/storage/database_test.go +++ b/src/dbnode/storage/database_test.go @@ -29,6 +29,14 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/generated/proto/annotation" @@ -58,14 +66,6 @@ import ( xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( diff --git a/src/dbnode/storage/entry.go b/src/dbnode/storage/entry.go index 9aa54f2854..5e0967ad6f 100644 --- a/src/dbnode/storage/entry.go +++ b/src/dbnode/storage/entry.go @@ -25,6 +25,9 @@ import ( "sync/atomic" "time" + "github.com/uber-go/tally" + xatomic "go.uber.org/atomic" + "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/storage/bootstrap" "github.com/m3db/m3/src/dbnode/storage/index" @@ -37,9 +40,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - xatomic "go.uber.org/atomic" ) // IndexWriter accepts index inserts. diff --git a/src/dbnode/storage/entry_blackbox_test.go b/src/dbnode/storage/entry_blackbox_test.go index 5969718d9b..595ef49ab5 100644 --- a/src/dbnode/storage/entry_blackbox_test.go +++ b/src/dbnode/storage/entry_blackbox_test.go @@ -26,18 +26,18 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/storage/series" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/tallytest" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( diff --git a/src/dbnode/storage/flush.go b/src/dbnode/storage/flush.go index 7e35aa0c97..61322e9ce6 100644 --- a/src/dbnode/storage/flush.go +++ b/src/dbnode/storage/flush.go @@ -25,17 +25,17 @@ import ( "fmt" "sync" + "github.com/pborman/uuid" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pborman/uuid" - "github.com/uber-go/tally" - "go.uber.org/atomic" - "go.uber.org/zap" ) var errFlushOperationsInProgress = errors.New("flush operations already in progress") diff --git a/src/dbnode/storage/flush_test.go b/src/dbnode/storage/flush_test.go index 552cb19cb2..f8605ef463 100644 --- a/src/dbnode/storage/flush_test.go +++ b/src/dbnode/storage/flush_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var testCommitlogFile = persist.CommitLogFile{ diff --git a/src/dbnode/storage/forward_index_dice_test.go b/src/dbnode/storage/forward_index_dice_test.go index 188588f204..f748e6298e 100644 --- a/src/dbnode/storage/forward_index_dice_test.go +++ b/src/dbnode/storage/forward_index_dice_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/retention" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func optionsWithIndexValues( diff --git a/src/dbnode/storage/fs.go b/src/dbnode/storage/fs.go index 7c247b0a65..61a59e97f2 100644 --- a/src/dbnode/storage/fs.go +++ b/src/dbnode/storage/fs.go @@ -23,11 +23,11 @@ package storage import ( "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) type fileOpStatus int diff --git a/src/dbnode/storage/fs_merge_with_mem_test.go b/src/dbnode/storage/fs_merge_with_mem_test.go index d8f87f72e3..e1c488a1c0 100644 --- a/src/dbnode/storage/fs_merge_with_mem_test.go +++ b/src/dbnode/storage/fs_merge_with_mem_test.go @@ -24,6 +24,10 @@ import ( "errors" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "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/storage/series" @@ -33,10 +37,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type dirtyData struct { diff --git a/src/dbnode/storage/index.go b/src/dbnode/storage/index.go index b29fa3a2e9..a9e81de463 100644 --- a/src/dbnode/storage/index.go +++ b/src/dbnode/storage/index.go @@ -32,6 +32,13 @@ import ( "sync" "time" + "github.com/m3db/bitset" + "github.com/opentracing/opentracing-go" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -64,13 +71,6 @@ import ( xopentracing "github.com/m3db/m3/src/x/opentracing" xresource "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/bitset" - "github.com/opentracing/opentracing-go" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/atomic" - "go.uber.org/zap" ) var ( @@ -1854,7 +1854,7 @@ func (i *nsIndex) newBlockQueryIterFn( return block.QueryIter(ctx, query) } -//nolint: dupl +// nolint: dupl func (i *nsIndex) execBlockQueryFn( ctx context.Context, block index.Block, diff --git a/src/dbnode/storage/index/aggregate_results_new_map.go b/src/dbnode/storage/index/aggregate_results_new_map.go index cdb576533f..350edec122 100644 --- a/src/dbnode/storage/index/aggregate_results_new_map.go +++ b/src/dbnode/storage/index/aggregate_results_new_map.go @@ -21,9 +21,9 @@ package index import ( - "github.com/m3db/m3/src/x/ident" - "github.com/cespare/xxhash/v2" + + "github.com/m3db/m3/src/x/ident" ) const ( diff --git a/src/dbnode/storage/index/aggregate_values_new_map.go b/src/dbnode/storage/index/aggregate_values_new_map.go index 70b80e2a47..5bef22ceec 100644 --- a/src/dbnode/storage/index/aggregate_values_new_map.go +++ b/src/dbnode/storage/index/aggregate_values_new_map.go @@ -21,9 +21,9 @@ package index import ( - "github.com/m3db/m3/src/x/ident" - "github.com/cespare/xxhash/v2" + + "github.com/m3db/m3/src/x/ident" ) const ( diff --git a/src/dbnode/storage/index/block.go b/src/dbnode/storage/index/block.go index 2f1d3ee28c..6a66268ff6 100644 --- a/src/dbnode/storage/index/block.go +++ b/src/dbnode/storage/index/block.go @@ -30,6 +30,10 @@ import ( "sync" "time" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/dbnode/storage/limits" @@ -48,10 +52,6 @@ import ( xresource "github.com/m3db/m3/src/x/resource" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/storage/index/block_bench_test.go b/src/dbnode/storage/index/block_bench_test.go index cf45df6b91..11f2839dfd 100644 --- a/src/dbnode/storage/index/block_bench_test.go +++ b/src/dbnode/storage/index/block_bench_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/pkg/profile" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/pkg/profile" - "github.com/stretchr/testify/require" ) func BenchmarkBlockWrite(b *testing.B) { diff --git a/src/dbnode/storage/index/block_prop_test.go b/src/dbnode/storage/index/block_prop_test.go index f7d1ed47aa..e8b5c8901b 100644 --- a/src/dbnode/storage/index/block_prop_test.go +++ b/src/dbnode/storage/index/block_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2019 Uber Technologies, Inc. // @@ -31,6 +33,12 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/dbnode/storage/limits" @@ -47,12 +55,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/tallytest" xtime "github.com/m3db/m3/src/x/time" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var testBlockSize = time.Hour diff --git a/src/dbnode/storage/index/block_test.go b/src/dbnode/storage/index/block_test.go index fc90de9049..19c4efa88f 100644 --- a/src/dbnode/storage/index/block_test.go +++ b/src/dbnode/storage/index/block_test.go @@ -28,6 +28,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/opentracing/opentracing-go" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" @@ -48,15 +57,6 @@ import ( "github.com/m3db/m3/src/x/resource" "github.com/m3db/m3/src/x/tallytest" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/opentracing/opentracing-go" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/storage/index/compaction/compactor_test.go b/src/dbnode/storage/index/compaction/compactor_test.go index 2ebfe1b087..3c6d4f978d 100644 --- a/src/dbnode/storage/index/compaction/compactor_test.go +++ b/src/dbnode/storage/index/compaction/compactor_test.go @@ -24,6 +24,8 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/builder" @@ -31,8 +33,6 @@ import ( "github.com/m3db/m3/src/m3ninx/index/segment/mem" "github.com/m3db/m3/src/x/mmap" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/index/compaction/plan_test.go b/src/dbnode/storage/index/compaction/plan_test.go index cb3e808982..51e1f9b3f9 100644 --- a/src/dbnode/storage/index/compaction/plan_test.go +++ b/src/dbnode/storage/index/compaction/plan_test.go @@ -26,9 +26,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/storage/index/segments" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/storage/index/segments" ) func TestDefaultOptsValidate(t *testing.T) { diff --git a/src/dbnode/storage/index/convert/convert_benchmark_test.go b/src/dbnode/storage/index/convert/convert_benchmark_test.go index 90781ed7ac..c5182d888d 100644 --- a/src/dbnode/storage/index/convert/convert_benchmark_test.go +++ b/src/dbnode/storage/index/convert/convert_benchmark_test.go @@ -44,6 +44,7 @@ type idWithTags struct { } // Samples of series IDs with corresponding tags. Taken from metrics generated by promremotebench. +// //nolint:lll var samples = []struct { id string diff --git a/src/dbnode/storage/index/convert/convert_test.go b/src/dbnode/storage/index/convert/convert_test.go index a5fa01fa96..bcf1b40e81 100644 --- a/src/dbnode/storage/index/convert/convert_test.go +++ b/src/dbnode/storage/index/convert/convert_test.go @@ -25,6 +25,9 @@ import ( "testing" "unicode/utf8" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/index/convert" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/x/checked" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/index/convert/tag_resolver_test.go b/src/dbnode/storage/index/convert/tag_resolver_test.go index 3a39cb1579..8d66b06f94 100644 --- a/src/dbnode/storage/index/convert/tag_resolver_test.go +++ b/src/dbnode/storage/index/convert/tag_resolver_test.go @@ -24,10 +24,10 @@ import ( "encoding/base64" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) //nolint:lll diff --git a/src/dbnode/storage/index/fields_terms_iterator_prop_test.go b/src/dbnode/storage/index/fields_terms_iterator_prop_test.go index c9dde4be9d..a1b6235e01 100644 --- a/src/dbnode/storage/index/fields_terms_iterator_prop_test.go +++ b/src/dbnode/storage/index/fields_terms_iterator_prop_test.go @@ -1,3 +1,4 @@ +//go:build big // +build big // Copyright (c) 2019 Uber Technologies, Inc. diff --git a/src/dbnode/storage/index/filter_fields_iterator_test.go b/src/dbnode/storage/index/filter_fields_iterator_test.go index 05cb15a081..74ade9c92f 100644 --- a/src/dbnode/storage/index/filter_fields_iterator_test.go +++ b/src/dbnode/storage/index/filter_fields_iterator_test.go @@ -23,10 +23,10 @@ package index import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index/segment" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestNewFilterFieldsIteratorError(t *testing.T) { diff --git a/src/dbnode/storage/index/mutable_segments.go b/src/dbnode/storage/index/mutable_segments.go index 2338d3cd5b..7ba6e6e7cf 100644 --- a/src/dbnode/storage/index/mutable_segments.go +++ b/src/dbnode/storage/index/mutable_segments.go @@ -29,6 +29,11 @@ import ( "sync" "time" + bitmap "github.com/m3dbx/pilosa/roaring" + "github.com/uber-go/tally" + "go.uber.org/zap" + "golang.org/x/sync/errgroup" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/index/compaction" "github.com/m3db/m3/src/dbnode/storage/index/segments" @@ -51,11 +56,6 @@ import ( xresource "github.com/m3db/m3/src/x/resource" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - bitmap "github.com/m3dbx/pilosa/roaring" - "github.com/uber-go/tally" - "go.uber.org/zap" - "golang.org/x/sync/errgroup" ) var ( diff --git a/src/dbnode/storage/index/mutable_segments_test.go b/src/dbnode/storage/index/mutable_segments_test.go index c44e7f8505..711c5f9561 100644 --- a/src/dbnode/storage/index/mutable_segments_test.go +++ b/src/dbnode/storage/index/mutable_segments_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/search" @@ -33,10 +37,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) type testMutableSegmentsResult struct { diff --git a/src/dbnode/storage/index/postings_list_cache.go b/src/dbnode/storage/index/postings_list_cache.go index cce2d65a25..954f9dbfdb 100644 --- a/src/dbnode/storage/index/postings_list_cache.go +++ b/src/dbnode/storage/index/postings_list_cache.go @@ -25,14 +25,14 @@ import ( "math" "time" + "github.com/pborman/uuid" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/m3ninx/generated/proto/querypb" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/x/instrument" - - "github.com/pborman/uuid" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var errInstrumentOptions = errors.New("no instrument options set") diff --git a/src/dbnode/storage/index/postings_list_cache_lru.go b/src/dbnode/storage/index/postings_list_cache_lru.go index 488ec45879..fc6f218841 100644 --- a/src/dbnode/storage/index/postings_list_cache_lru.go +++ b/src/dbnode/storage/index/postings_list_cache_lru.go @@ -34,12 +34,12 @@ import ( // that were resolved by running a given query against a particular segment for a given // field and pattern type (term vs regexp). Normally a key in the LRU would look like: // -// type key struct { -// segmentUUID uuid.UUID -// field string -// pattern string -// patternType PatternType -// } +// type key struct { +// segmentUUID uuid.UUID +// field string +// pattern string +// patternType PatternType +// } // // However, some of the postings lists that we will store in the LRU have a fixed lifecycle // because they reference mmap'd byte slices which will eventually be unmap'd. To prevent diff --git a/src/dbnode/storage/index/postings_list_cache_test.go b/src/dbnode/storage/index/postings_list_cache_test.go index 6ed3d4ac39..040aa93c62 100644 --- a/src/dbnode/storage/index/postings_list_cache_test.go +++ b/src/dbnode/storage/index/postings_list_cache_test.go @@ -27,12 +27,12 @@ import ( "sync" "testing" + "github.com/pborman/uuid" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" "github.com/m3db/m3/src/x/instrument" - - "github.com/pborman/uuid" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/storage/index/query_matcher.go b/src/dbnode/storage/index/query_matcher.go index b3eb4b710b..686d100ffa 100644 --- a/src/dbnode/storage/index/query_matcher.go +++ b/src/dbnode/storage/index/query_matcher.go @@ -23,9 +23,9 @@ package index import ( "fmt" - "github.com/m3db/m3/src/m3ninx/idx" - "github.com/golang/mock/gomock" + + "github.com/m3db/m3/src/m3ninx/idx" ) // QueryMatcher is a gomock.Matcher that matches index.Query diff --git a/src/dbnode/storage/index/query_matcher_test.go b/src/dbnode/storage/index/query_matcher_test.go index e0448d8936..b757a3b2ee 100644 --- a/src/dbnode/storage/index/query_matcher_test.go +++ b/src/dbnode/storage/index/query_matcher_test.go @@ -23,10 +23,10 @@ package index_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/idx" - - "github.com/stretchr/testify/require" ) func TestQueryMatcherTermQuery(t *testing.T) { diff --git a/src/dbnode/storage/index/read_through_segment.go b/src/dbnode/storage/index/read_through_segment.go index b4c273e7eb..8a79fbb789 100644 --- a/src/dbnode/storage/index/read_through_segment.go +++ b/src/dbnode/storage/index/read_through_segment.go @@ -24,13 +24,13 @@ import ( "errors" "sync" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/search" - - "github.com/pborman/uuid" ) var ( diff --git a/src/dbnode/storage/index/read_through_segment_test.go b/src/dbnode/storage/index/read_through_segment_test.go index 2b2f0828b6..869be5bd21 100644 --- a/src/dbnode/storage/index/read_through_segment_test.go +++ b/src/dbnode/storage/index/read_through_segment_test.go @@ -24,14 +24,14 @@ import ( "regexp/syntax" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/fst" "github.com/m3db/m3/src/m3ninx/postings/roaring" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/index/results_test.go b/src/dbnode/storage/index/results_test.go index 864a8bf50f..50f38e559b 100644 --- a/src/dbnode/storage/index/results_test.go +++ b/src/dbnode/storage/index/results_test.go @@ -24,6 +24,9 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + idxconvert "github.com/m3db/m3/src/dbnode/storage/index/convert" "github.com/m3db/m3/src/dbnode/test" "github.com/m3db/m3/src/m3ninx/doc" @@ -31,9 +34,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/index/types.go b/src/dbnode/storage/index/types.go index e95c53f8f6..9600c0118d 100644 --- a/src/dbnode/storage/index/types.go +++ b/src/dbnode/storage/index/types.go @@ -25,6 +25,8 @@ import ( "sort" "time" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" "github.com/m3db/m3/src/dbnode/storage/index/compaction" @@ -42,8 +44,6 @@ import ( "github.com/m3db/m3/src/x/mmap" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - opentracinglog "github.com/opentracing/opentracing-go/log" ) // InsertMode specifies whether inserts are synchronous or asynchronous. diff --git a/src/dbnode/storage/index_block_test.go b/src/dbnode/storage/index_block_test.go index 126951940c..860a42c58e 100644 --- a/src/dbnode/storage/index_block_test.go +++ b/src/dbnode/storage/index_block_test.go @@ -27,6 +27,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + opentracing "github.com/opentracing/opentracing-go" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/sharding" @@ -43,12 +49,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/golang/mock/gomock" - opentracing "github.com/opentracing/opentracing-go" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/index_insert_queue.go b/src/dbnode/storage/index_insert_queue.go index 9fc06981e5..27720593ef 100644 --- a/src/dbnode/storage/index_insert_queue.go +++ b/src/dbnode/storage/index_insert_queue.go @@ -26,13 +26,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/ts/writes" "github.com/m3db/m3/src/x/clock" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber-go/tally" ) var ( diff --git a/src/dbnode/storage/index_insert_queue_test.go b/src/dbnode/storage/index_insert_queue_test.go index 0cb815f048..cf9b5b6eb6 100644 --- a/src/dbnode/storage/index_insert_queue_test.go +++ b/src/dbnode/storage/index_insert_queue_test.go @@ -27,6 +27,11 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/m3ninx/doc" @@ -34,11 +39,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func newTestIndexInsertQueue( diff --git a/src/dbnode/storage/index_query_concurrent_test.go b/src/dbnode/storage/index_query_concurrent_test.go index d95a8ffc58..8ac970c73f 100644 --- a/src/dbnode/storage/index_query_concurrent_test.go +++ b/src/dbnode/storage/index_query_concurrent_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -30,6 +32,12 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/dbnode/storage/index/convert" "github.com/m3db/m3/src/dbnode/storage/limits/permits" @@ -42,12 +50,6 @@ import ( "github.com/m3db/m3/src/x/resource" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) func TestNamespaceIndexHighConcurrentQueriesWithoutTimeouts(t *testing.T) { diff --git a/src/dbnode/storage/index_queue_forward_write_test.go b/src/dbnode/storage/index_queue_forward_write_test.go index c5554bd0c1..a9c0d03b88 100644 --- a/src/dbnode/storage/index_queue_forward_write_test.go +++ b/src/dbnode/storage/index_queue_forward_write_test.go @@ -26,6 +26,11 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/storage/index" @@ -43,11 +48,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func generateOptionsNowAndBlockSize() (Options, xtime.UnixNano, time.Duration) { diff --git a/src/dbnode/storage/index_queue_test.go b/src/dbnode/storage/index_queue_test.go index 216ab7f425..efe73cf67f 100644 --- a/src/dbnode/storage/index_queue_test.go +++ b/src/dbnode/storage/index_queue_test.go @@ -26,6 +26,12 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" m3dberrors "github.com/m3db/m3/src/dbnode/storage/errors" "github.com/m3db/m3/src/dbnode/storage/index" @@ -40,12 +46,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func testNamespaceIndexOptions() index.Options { diff --git a/src/dbnode/storage/index_test.go b/src/dbnode/storage/index_test.go index 2b83aba35e..dcbab36514 100644 --- a/src/dbnode/storage/index_test.go +++ b/src/dbnode/storage/index_test.go @@ -30,6 +30,12 @@ import ( "testing" "time" + protobuftypes "github.com/gogo/protobuf/types" + "github.com/golang/mock/gomock" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + indexpb "github.com/m3db/m3/src/dbnode/generated/proto/index" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -46,12 +52,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - protobuftypes "github.com/gogo/protobuf/types" - "github.com/golang/mock/gomock" - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNamespaceIndexCleanupExpiredFilesets(t *testing.T) { diff --git a/src/dbnode/storage/lease_verifier_test.go b/src/dbnode/storage/lease_verifier_test.go index d86486fe68..c8534c1273 100644 --- a/src/dbnode/storage/lease_verifier_test.go +++ b/src/dbnode/storage/lease_verifier_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/limits/permits/fixed_permits.go b/src/dbnode/storage/limits/permits/fixed_permits.go index 5a97d0d9d9..ecd48732aa 100644 --- a/src/dbnode/storage/limits/permits/fixed_permits.go +++ b/src/dbnode/storage/limits/permits/fixed_permits.go @@ -21,10 +21,10 @@ package permits import ( + "go.uber.org/zap" + "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) type fixedPermits struct { diff --git a/src/dbnode/storage/limits/permits/fixed_permits_test.go b/src/dbnode/storage/limits/permits/fixed_permits_test.go index 96b63290e1..2606d5d003 100644 --- a/src/dbnode/storage/limits/permits/fixed_permits_test.go +++ b/src/dbnode/storage/limits/permits/fixed_permits_test.go @@ -24,10 +24,10 @@ import ( stdctx "context" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestFixedPermits(t *testing.T) { diff --git a/src/dbnode/storage/limits/permits/lookback_limit_permit_test.go b/src/dbnode/storage/limits/permits/lookback_limit_permit_test.go index 81fad75f31..1a3536eb14 100644 --- a/src/dbnode/storage/limits/permits/lookback_limit_permit_test.go +++ b/src/dbnode/storage/limits/permits/lookback_limit_permit_test.go @@ -23,11 +23,11 @@ package permits import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/limits" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestLookbackLimitPermit(t *testing.T) { diff --git a/src/dbnode/storage/limits/permits/permit.go b/src/dbnode/storage/limits/permits/permit.go index 7d7c2e0218..daa9e2b991 100644 --- a/src/dbnode/storage/limits/permits/permit.go +++ b/src/dbnode/storage/limits/permits/permit.go @@ -21,10 +21,10 @@ package permits import ( - "github.com/m3db/m3/src/x/instrument" - "go.uber.org/atomic" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/instrument" ) // permit tracks the quota used by a caller and provides basic sanity checks that a caller diff --git a/src/dbnode/storage/limits/query_limits_test.go b/src/dbnode/storage/limits/query_limits_test.go index e60f14d4af..6f79c21e77 100644 --- a/src/dbnode/storage/limits/query_limits_test.go +++ b/src/dbnode/storage/limits/query_limits_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + xclock "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/tallytest" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func testQueryLimitOptions( diff --git a/src/dbnode/storage/mediator.go b/src/dbnode/storage/mediator.go index 0e0780138f..af52dcd76d 100644 --- a/src/dbnode/storage/mediator.go +++ b/src/dbnode/storage/mediator.go @@ -25,14 +25,14 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/persist/fs/commitlog" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) type ( @@ -218,8 +218,8 @@ func (m *mediator) Close() error { // The mediator mediates the relationship between ticks and warm flushes/snapshots. // // For example, the requirements to perform a flush are: -// 1) currentTime > blockStart.Add(blockSize).Add(bufferPast) -// 2) node is not bootstrapping (technically shard is not bootstrapping) +// 1. currentTime > blockStart.Add(blockSize).Add(bufferPast) +// 2. node is not bootstrapping (technically shard is not bootstrapping) // // Similarly, there is logic in the Tick flow for removing shard flush states from a map so that it doesn't // grow infinitely for nodes that are not restarted. If the Tick path measured the current time when it made that @@ -357,7 +357,8 @@ func (m *mediator) IsOpen() bool { // with a consistent view of time as the tick it is on. They don't necessarily need to start on the same tick. See the // diagram below for an example case. // -// ____________ ___________ _________________ +// ____________ ___________ _________________ +// // | Flush (t0) | | Tick (t0) | | Cold Flush (t0) | // | | | | | | // | | |___________| | | @@ -367,11 +368,13 @@ func (m *mediator) IsOpen() bool { // | | |___________| | | // | | ___________ | | // |____________| | Tick (t0) | | | -// barrier.wait() | | | | -// |___________| | | -// mediatorTime = t1 | | -// barrier.release() | | -// ____________ ___________ | | +// +// barrier.wait() | | | | +// |___________| | | +// mediatorTime = t1 | | +// barrier.release() | | +// ____________ ___________ | | +// // | Flush (t1) | | Tick (t1) | |_________________| // | | | | barrier.wait() // | | |___________| @@ -380,26 +383,28 @@ func (m *mediator) IsOpen() bool { // | | ___________ _________________ // | | | Tick (t2) | | Cold Flush (t2) | // |____________| | | | | -// barrier.wait() |___________| | | -// mediatorTime = t3 | | -// barrier.release() | | -// ____________ ___________ | | -// | Flush (t3) | | Tick (t3) | | | -// | | | | | | -// | | |___________| | | -// | | ___________ | | -// | | | Tick (t3) | | | -// | | | | | | -// | | |___________| | | -// | | ___________ | | -// |____________| | Tick (t3) | |_________________| -// barrier.wait() | | barrier.wait() -// |___________| -// mediatorTime = t4 -// barrier.release() -// ____________ ___________ _________________ -// | Flush (t4) | | Tick (t4) | | Cold Flush (t4) | -// | | | | | | +// +// barrier.wait() |___________| | | +// mediatorTime = t3 | | +// barrier.release() | | +// ____________ ___________ | | +// | Flush (t3) | | Tick (t3) | | | +// | | | | | | +// | | |___________| | | +// | | ___________ | | +// | | | Tick (t3) | | | +// | | | | | | +// | | |___________| | | +// | | ___________ | | +// |____________| | Tick (t3) | |_________________| +// barrier.wait() | | barrier.wait() +// |___________| +// mediatorTime = t4 +// barrier.release() +// ____________ ___________ _________________ +// | Flush (t4) | | Tick (t4) | | Cold Flush (t4) | +// | | | | | | +// // ------------------------------------------------------------ type mediatorTimeBarrier struct { sync.Mutex diff --git a/src/dbnode/storage/mediator_test.go b/src/dbnode/storage/mediator_test.go index b55d3955cc..5feb5b9577 100644 --- a/src/dbnode/storage/mediator_test.go +++ b/src/dbnode/storage/mediator_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" - xclock "github.com/m3db/m3/src/x/clock" - xtest "github.com/m3db/m3/src/x/test" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "go.uber.org/atomic" + + xclock "github.com/m3db/m3/src/x/clock" + xtest "github.com/m3db/m3/src/x/test" ) func TestDatabaseMediatorOpenClose(t *testing.T) { diff --git a/src/dbnode/storage/namespace.go b/src/dbnode/storage/namespace.go index 67e46004c6..36be46ebda 100644 --- a/src/dbnode/storage/namespace.go +++ b/src/dbnode/storage/namespace.go @@ -29,6 +29,10 @@ import ( "sync" "time" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" "github.com/m3db/m3/src/dbnode/persist/fs" @@ -54,10 +58,6 @@ import ( xresource "github.com/m3db/m3/src/x/resource" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/storage/namespace_bootstrap_data_accumulator_test.go b/src/dbnode/storage/namespace_bootstrap_data_accumulator_test.go index aaa422d923..dde2a57133 100644 --- a/src/dbnode/storage/namespace_bootstrap_data_accumulator_test.go +++ b/src/dbnode/storage/namespace_bootstrap_data_accumulator_test.go @@ -24,12 +24,12 @@ import ( "errors" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/bootstrap" "github.com/m3db/m3/src/dbnode/storage/series" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/storage/namespace_readers.go b/src/dbnode/storage/namespace_readers.go index 6e7fe53f40..cad8b1db32 100644 --- a/src/dbnode/storage/namespace_readers.go +++ b/src/dbnode/storage/namespace_readers.go @@ -23,6 +23,9 @@ package storage import ( "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/sharding" @@ -30,9 +33,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // namespaceReaderManager maintains a pool of closed readers which can be diff --git a/src/dbnode/storage/namespace_readers_test.go b/src/dbnode/storage/namespace_readers_test.go index c49b644f05..1c0d932d74 100644 --- a/src/dbnode/storage/namespace_readers_test.go +++ b/src/dbnode/storage/namespace_readers_test.go @@ -24,6 +24,10 @@ import ( "errors" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist/fs" "github.com/m3db/m3/src/dbnode/storage/block" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestNamespaceReadersGet(t *testing.T) { diff --git a/src/dbnode/storage/namespace_test.go b/src/dbnode/storage/namespace_test.go index 6ed10a762e..672623f59c 100644 --- a/src/dbnode/storage/namespace_test.go +++ b/src/dbnode/storage/namespace_test.go @@ -28,6 +28,14 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -51,14 +59,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/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( diff --git a/src/dbnode/storage/repair.go b/src/dbnode/storage/repair.go index f9472ab51d..009afc2e6a 100644 --- a/src/dbnode/storage/repair.go +++ b/src/dbnode/storage/repair.go @@ -30,6 +30,10 @@ import ( "sync/atomic" "time" + "github.com/jhump/protoreflect/dynamic" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" @@ -44,10 +48,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/jhump/protoreflect/dynamic" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/storage/repair/metadata_pool_test.go b/src/dbnode/storage/repair/metadata_pool_test.go index e194edaa39..bd7a2cd373 100644 --- a/src/dbnode/storage/repair/metadata_pool_test.go +++ b/src/dbnode/storage/repair/metadata_pool_test.go @@ -23,10 +23,10 @@ package repair import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestReplicaMetadataSlicePoolResetOnPut(t *testing.T) { diff --git a/src/dbnode/storage/repair/metadata_test.go b/src/dbnode/storage/repair/metadata_test.go index 0a4632d205..a780038972 100644 --- a/src/dbnode/storage/repair/metadata_test.go +++ b/src/dbnode/storage/repair/metadata_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/storage/block" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func testReplicaMetadataSlicePool() ReplicaMetadataSlicePool { diff --git a/src/dbnode/storage/repair_test.go b/src/dbnode/storage/repair_test.go index 09f367e20b..18ad9f8c4f 100644 --- a/src/dbnode/storage/repair_test.go +++ b/src/dbnode/storage/repair_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestDatabaseRepairerStartStop(t *testing.T) { diff --git a/src/dbnode/storage/series/buffer.go b/src/dbnode/storage/series/buffer.go index b4d0cedf14..96f25ba33c 100644 --- a/src/dbnode/storage/series/buffer.go +++ b/src/dbnode/storage/series/buffer.go @@ -27,6 +27,9 @@ import ( "sync/atomic" "time" + "github.com/cespare/xxhash/v2" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/cespare/xxhash/v2" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/storage/series/buffer_proto_test.go b/src/dbnode/storage/series/buffer_proto_test.go index a67e1145c5..af42fc7049 100644 --- a/src/dbnode/storage/series/buffer_proto_test.go +++ b/src/dbnode/storage/series/buffer_proto_test.go @@ -24,11 +24,10 @@ import ( "testing" "time" + "github.com/m3db/m3/src/dbnode/namespace" m3dbruntime "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/testdata/prototest" "github.com/m3db/m3/src/x/ident" - - "github.com/m3db/m3/src/dbnode/namespace" ) var ( diff --git a/src/dbnode/storage/series/buffer_test.go b/src/dbnode/storage/series/buffer_test.go index 3740ed0bd2..60bf50270b 100644 --- a/src/dbnode/storage/series/buffer_test.go +++ b/src/dbnode/storage/series/buffer_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -41,10 +45,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var testID = ident.StringID("foo") diff --git a/src/dbnode/storage/series/series_all_test.go b/src/dbnode/storage/series/series_all_test.go index 0292c2269d..5d2fc44b19 100644 --- a/src/dbnode/storage/series/series_all_test.go +++ b/src/dbnode/storage/series/series_all_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/davecgh/go-spew/spew" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/x/xio" xtime "github.com/m3db/m3/src/x/time" - - "github.com/davecgh/go-spew/spew" - "github.com/stretchr/testify/require" ) var timeDistantFuture = xtime.Now().Add(10 * 365 * 24 * time.Hour) diff --git a/src/dbnode/storage/series/series_parallel_test.go b/src/dbnode/storage/series/series_parallel_test.go index 806116128d..1c73a6759c 100644 --- a/src/dbnode/storage/series/series_parallel_test.go +++ b/src/dbnode/storage/series/series_parallel_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2016 Uber Technologies, Inc. // @@ -27,6 +29,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "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" @@ -34,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // TestSeriesWriteReadParallel is a regression test that was added to capture diff --git a/src/dbnode/storage/series/series_test.go b/src/dbnode/storage/series/series_test.go index 6aba5f214f..bf3b28450d 100644 --- a/src/dbnode/storage/series/series_test.go +++ b/src/dbnode/storage/series/series_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -41,10 +45,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func newSeriesTestOptions() Options { diff --git a/src/dbnode/storage/series/types.go b/src/dbnode/storage/series/types.go index d03333c1d1..f6d3d2bda6 100644 --- a/src/dbnode/storage/series/types.go +++ b/src/dbnode/storage/series/types.go @@ -23,6 +23,8 @@ package series import ( "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) // DatabaseSeriesOptions is a set of options for creating a database series. diff --git a/src/dbnode/storage/series/util.go b/src/dbnode/storage/series/util.go index 765973698e..2821598d2b 100644 --- a/src/dbnode/storage/series/util.go +++ b/src/dbnode/storage/series/util.go @@ -24,10 +24,9 @@ import ( "time" "github.com/m3db/m3/src/dbnode/encoding" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/x/xio" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/m3/src/dbnode/namespace" ) // ValuesByTime is a sortable slice of DecodedTestValue. diff --git a/src/dbnode/storage/series_resolver_test.go b/src/dbnode/storage/series_resolver_test.go index 55d2d87ea9..66c2113d0b 100644 --- a/src/dbnode/storage/series_resolver_test.go +++ b/src/dbnode/storage/series_resolver_test.go @@ -25,10 +25,10 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestResolveError(t *testing.T) { diff --git a/src/dbnode/storage/series_wired_list_interaction_test.go b/src/dbnode/storage/series_wired_list_interaction_test.go index ef242c7080..3831875b45 100644 --- a/src/dbnode/storage/series_wired_list_interaction_test.go +++ b/src/dbnode/storage/series_wired_list_interaction_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/storage/block" @@ -37,9 +40,6 @@ import ( "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // TestSeriesWiredListConcurrentInteractions was added as a regression test diff --git a/src/dbnode/storage/shard.go b/src/dbnode/storage/shard.go index 3a95823e8d..8b4ddabda7 100644 --- a/src/dbnode/storage/shard.go +++ b/src/dbnode/storage/shard.go @@ -29,6 +29,11 @@ import ( "sync" "time" + "github.com/gogo/protobuf/proto" + "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/generated/proto/pagetoken" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -55,11 +60,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xresource "github.com/m3db/m3/src/x/resource" xtime "github.com/m3db/m3/src/x/time" - - "github.com/gogo/protobuf/proto" - "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/storage/shard_fetch_blocks_metadata_test.go b/src/dbnode/storage/shard_fetch_blocks_metadata_test.go index 10c4ddabe1..cf609abb61 100644 --- a/src/dbnode/storage/shard_fetch_blocks_metadata_test.go +++ b/src/dbnode/storage/shard_fetch_blocks_metadata_test.go @@ -28,6 +28,11 @@ import ( "testing" "time" + "github.com/gogo/protobuf/proto" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/digest" "github.com/m3db/m3/src/dbnode/generated/proto/pagetoken" "github.com/m3db/m3/src/dbnode/persist" @@ -38,11 +43,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/gogo/protobuf/proto" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestShardFetchBlocksMetadataV2WithSeriesCachePolicyCacheAll(t *testing.T) { diff --git a/src/dbnode/storage/shard_foreachentry_prop_test.go b/src/dbnode/storage/shard_foreachentry_prop_test.go index bcbcb7863f..1b6d39be02 100644 --- a/src/dbnode/storage/shard_foreachentry_prop_test.go +++ b/src/dbnode/storage/shard_foreachentry_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // @@ -30,15 +32,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/dbnode/namespace" - "github.com/m3db/m3/src/x/context" - "github.com/m3db/m3/src/x/ident" - xtime "github.com/m3db/m3/src/x/time" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/namespace" + "github.com/m3db/m3/src/x/context" + "github.com/m3db/m3/src/x/ident" + xtime "github.com/m3db/m3/src/x/time" ) func TestShardConcurrentForEaches(t *testing.T) { diff --git a/src/dbnode/storage/shard_index_test.go b/src/dbnode/storage/shard_index_test.go index 583dd1d7dc..45e892c32c 100644 --- a/src/dbnode/storage/shard_index_test.go +++ b/src/dbnode/storage/shard_index_test.go @@ -25,6 +25,11 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/storage/index" @@ -35,11 +40,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestShardInsertNamespaceIndex(t *testing.T) { diff --git a/src/dbnode/storage/shard_insert_queue.go b/src/dbnode/storage/shard_insert_queue.go index 084a75e048..4440556a85 100644 --- a/src/dbnode/storage/shard_insert_queue.go +++ b/src/dbnode/storage/shard_insert_queue.go @@ -26,6 +26,10 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/storage/series" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/x/ident" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/atomic" - "go.uber.org/zap" ) const ( diff --git a/src/dbnode/storage/shard_race_prop_test.go b/src/dbnode/storage/shard_race_prop_test.go index 9abb85c8d7..3f0f5321c4 100644 --- a/src/dbnode/storage/shard_race_prop_test.go +++ b/src/dbnode/storage/shard_race_prop_test.go @@ -28,6 +28,12 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/dbnode/storage/block" @@ -36,12 +42,6 @@ import ( "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestShardTickReadFnRace(t *testing.T) { diff --git a/src/dbnode/storage/shard_test.go b/src/dbnode/storage/shard_test.go index 2064527869..e84cc8cdcf 100644 --- a/src/dbnode/storage/shard_test.go +++ b/src/dbnode/storage/shard_test.go @@ -32,6 +32,11 @@ import ( "time" "unsafe" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/persist" @@ -52,11 +57,6 @@ import ( "github.com/m3db/m3/src/x/pool" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) type testIncreasingIndex struct { diff --git a/src/dbnode/storage/tick.go b/src/dbnode/storage/tick.go index 849039b1b5..466762c654 100644 --- a/src/dbnode/storage/tick.go +++ b/src/dbnode/storage/tick.go @@ -25,13 +25,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/runtime" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/context" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) const ( diff --git a/src/dbnode/storage/tick_test.go b/src/dbnode/storage/tick_test.go index b9ca464045..062d6826f5 100644 --- a/src/dbnode/storage/tick_test.go +++ b/src/dbnode/storage/tick_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/context" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestTickManagerTickNormalFlow(t *testing.T) { diff --git a/src/dbnode/storage/util.go b/src/dbnode/storage/util.go index 81997725ae..6836c1777d 100644 --- a/src/dbnode/storage/util.go +++ b/src/dbnode/storage/util.go @@ -97,9 +97,9 @@ func DefaultTestOptions() Options { // numIntervals returns the number of intervals between [start, end] for a given // windowSize. // NB: edge conditions: -// - returns 0 if window <= 0 ; -// - returns 0 if end is before start; -// - returns 1 if end == start +// - returns 0 if window <= 0 ; +// - returns 0 if end is before start; +// - returns 1 if end == start func numIntervals(startInclusive, endInclusive xtime.UnixNano, window time.Duration) int { if window <= 0 || endInclusive.Before(startInclusive) { return 0 diff --git a/src/dbnode/testdata/prototest/fixture.go b/src/dbnode/testdata/prototest/fixture.go index fb68861535..2a54cebd77 100644 --- a/src/dbnode/testdata/prototest/fixture.go +++ b/src/dbnode/testdata/prototest/fixture.go @@ -30,8 +30,9 @@ import ( "github.com/jhump/protoreflect/desc" "github.com/jhump/protoreflect/dynamic" - "github.com/m3db/m3/src/dbnode/namespace" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/dbnode/namespace" ) const ( diff --git a/src/dbnode/testdata/prototest/pools.go b/src/dbnode/testdata/prototest/pools.go index 2abdba0e5a..a690f374e0 100644 --- a/src/dbnode/testdata/prototest/pools.go +++ b/src/dbnode/testdata/prototest/pools.go @@ -23,11 +23,10 @@ package prototest import ( "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/proto" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/x/xio" "github.com/m3db/m3/src/x/pool" xtime "github.com/m3db/m3/src/x/time" - - "github.com/m3db/m3/src/dbnode/namespace" ) var ( diff --git a/src/dbnode/topology/dynamic.go b/src/dbnode/topology/dynamic.go index 2c9d06251b..61a2cf388a 100644 --- a/src/dbnode/topology/dynamic.go +++ b/src/dbnode/topology/dynamic.go @@ -24,14 +24,14 @@ import ( "errors" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/sharding" xwatch "github.com/m3db/m3/src/x/watch" - - "go.uber.org/zap" ) var ( diff --git a/src/dbnode/topology/dynamic_test.go b/src/dbnode/topology/dynamic_test.go index 6109116e7b..175c6819a1 100644 --- a/src/dbnode/topology/dynamic_test.go +++ b/src/dbnode/topology/dynamic_test.go @@ -25,13 +25,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/client" - "github.com/m3db/m3/src/cluster/services" - "github.com/m3db/m3/src/cluster/shard" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/client" + "github.com/m3db/m3/src/cluster/services" + "github.com/m3db/m3/src/cluster/shard" ) func testSetup(ctrl *gomock.Controller) (DynamicOptions, *testWatch) { diff --git a/src/dbnode/topology/host_test.go b/src/dbnode/topology/host_test.go index 2e1990b5c0..d323a53611 100644 --- a/src/dbnode/topology/host_test.go +++ b/src/dbnode/topology/host_test.go @@ -23,12 +23,12 @@ package topology import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/assert" ) func TestNewHostShardSetFromServiceInstance(t *testing.T) { diff --git a/src/dbnode/topology/map_test.go b/src/dbnode/topology/map_test.go index 47be5cba54..f23bd7d637 100644 --- a/src/dbnode/topology/map_test.go +++ b/src/dbnode/topology/map_test.go @@ -23,12 +23,12 @@ package topology import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/dbnode/sharding" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func newTestShardSet( diff --git a/src/dbnode/ts/segment.go b/src/dbnode/ts/segment.go index 285fed4920..d014c62314 100644 --- a/src/dbnode/ts/segment.go +++ b/src/dbnode/ts/segment.go @@ -23,10 +23,10 @@ package ts import ( "bytes" + "github.com/m3db/stackadler32" + "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/pool" - - "github.com/m3db/stackadler32" ) // Segment represents a binary blob consisting of two byte slices and diff --git a/src/dbnode/ts/segment_test.go b/src/dbnode/ts/segment_test.go index e633fab70c..e36095975b 100644 --- a/src/dbnode/ts/segment_test.go +++ b/src/dbnode/ts/segment_test.go @@ -23,10 +23,10 @@ package ts import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/assert" ) var ( diff --git a/src/dbnode/ts/writes/write_batch_test.go b/src/dbnode/ts/writes/write_batch_test.go index 40899a0394..e2da8e6e8c 100644 --- a/src/dbnode/ts/writes/write_batch_test.go +++ b/src/dbnode/ts/writes/write_batch_test.go @@ -27,13 +27,13 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/dbnode/x/encoding/shallow_cloner_test.go b/src/dbnode/x/encoding/shallow_cloner_test.go index 1f921fec5a..1a4186fbea 100644 --- a/src/dbnode/x/encoding/shallow_cloner_test.go +++ b/src/dbnode/x/encoding/shallow_cloner_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + enc "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/ts" @@ -36,9 +39,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestCloneMultiReaderIterator(t *testing.T) { diff --git a/src/dbnode/x/m3em/node/node.go b/src/dbnode/x/m3em/node/node.go index b64c476fff..affb8ccd15 100644 --- a/src/dbnode/x/m3em/node/node.go +++ b/src/dbnode/x/m3em/node/node.go @@ -24,12 +24,12 @@ import ( "fmt" "sync" + tchannel "github.com/uber/tchannel-go" + "github.com/uber/tchannel-go/thrift" + m3dbrpc "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" m3dbchannel "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/node/channel" "github.com/m3db/m3/src/m3em/node" - - tchannel "github.com/uber/tchannel-go" - "github.com/uber/tchannel-go/thrift" ) type m3emNode struct { diff --git a/src/dbnode/x/m3em/node/node_test.go b/src/dbnode/x/m3em/node/node_test.go index 27aa387ccf..af180778b1 100644 --- a/src/dbnode/x/m3em/node/node_test.go +++ b/src/dbnode/x/m3em/node/node_test.go @@ -23,13 +23,13 @@ package m3db import ( "testing" - m3dbrpc "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" - "github.com/m3db/m3/src/m3em/generated/proto/m3em" - "github.com/m3db/m3/src/m3em/node" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "google.golang.org/grpc" + + m3dbrpc "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" + "github.com/m3db/m3/src/m3em/generated/proto/m3em" + "github.com/m3db/m3/src/m3em/node" ) func newTestOptions() Options { diff --git a/src/dbnode/x/xio/null.go b/src/dbnode/x/xio/null.go index 146b12519f..0aedbab0e0 100644 --- a/src/dbnode/x/xio/null.go +++ b/src/dbnode/x/xio/null.go @@ -29,9 +29,9 @@ type nullSegmentReader struct{} func (r nullSegmentReader) Read64() (word uint64, n byte, err error) { return 0, 0, nil } func (r nullSegmentReader) Peek64() (word uint64, n byte, err error) { return 0, 0, nil } -func (r nullSegmentReader) Segment() (ts.Segment, error) { return ts.Segment{}, nil } -func (r nullSegmentReader) Reset(_ ts.Segment) {} -func (r nullSegmentReader) Finalize() {} +func (r nullSegmentReader) Segment() (ts.Segment, error) { return ts.Segment{}, nil } +func (r nullSegmentReader) Reset(_ ts.Segment) {} +func (r nullSegmentReader) Finalize() {} func (r nullSegmentReader) Clone( _ pool.CheckedBytesPool, ) (SegmentReader, error) { diff --git a/src/dbnode/x/xio/segment_reader_test.go b/src/dbnode/x/xio/segment_reader_test.go index b05fa09d1f..8e250fc7b1 100644 --- a/src/dbnode/x/xio/segment_reader_test.go +++ b/src/dbnode/x/xio/segment_reader_test.go @@ -25,11 +25,11 @@ import ( "io" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/dbnode/x/xpool/pool_test.go b/src/dbnode/x/xpool/pool_test.go index 34a6e161f9..9ef51c00ae 100644 --- a/src/dbnode/x/xpool/pool_test.go +++ b/src/dbnode/x/xpool/pool_test.go @@ -23,9 +23,9 @@ package xpool import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func testPool() CheckedBytesWrapperPool { diff --git a/src/integration/aggregator/aggregator.go b/src/integration/aggregator/aggregator.go index c1fad2922e..d210dbd04a 100644 --- a/src/integration/aggregator/aggregator.go +++ b/src/integration/aggregator/aggregator.go @@ -27,12 +27,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/x/headers" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/integration/legacy/carbon_test.go b/src/integration/legacy/carbon_test.go index 786fe90b10..147a6f0d5a 100644 --- a/src/integration/legacy/carbon_test.go +++ b/src/integration/legacy/carbon_test.go @@ -1,4 +1,6 @@ +//go:build cluster_integration // +build cluster_integration + // // Copyright (c) 2020 Uber Technologies, Inc. // @@ -28,9 +30,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/integration/resources" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/integration/resources" ) func findVerifier(expected string) resources.ResponseVerifier { diff --git a/src/integration/legacy/cold_write_test.go b/src/integration/legacy/cold_write_test.go index 573141a1ea..09053502f9 100644 --- a/src/integration/legacy/cold_write_test.go +++ b/src/integration/legacy/cold_write_test.go @@ -1,4 +1,6 @@ +//go:build cluster_integration // +build cluster_integration + // // Copyright (c) 2020 Uber Technologies, Inc. // @@ -30,12 +32,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/integration/resources/inprocess" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type dp struct { diff --git a/src/integration/legacy/query_api_test.go b/src/integration/legacy/query_api_test.go index ab829d18b4..63a7908e95 100644 --- a/src/integration/legacy/query_api_test.go +++ b/src/integration/legacy/query_api_test.go @@ -1,4 +1,6 @@ +//go:build cluster_integration // +build cluster_integration + // // Copyright (c) 2020 Uber Technologies, Inc. // @@ -28,9 +30,9 @@ import ( "strings" "testing" - "github.com/m3db/m3/src/integration/resources" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/integration/resources" ) type urlTest struct { diff --git a/src/integration/prometheus/prometheus.go b/src/integration/prometheus/prometheus.go index f8efe6e65f..1a3c538ff7 100644 --- a/src/integration/prometheus/prometheus.go +++ b/src/integration/prometheus/prometheus.go @@ -33,6 +33,10 @@ import ( "testing" "time" + "github.com/prometheus/common/model" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/generated/proto/kvpb" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/kvconfig" @@ -47,10 +51,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/common/model" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) const ( @@ -347,7 +347,7 @@ func testQueryLimitsApplied( }) logger.Info("test query series limit with require-exhaustive headers true " + - "(below limit therefore no error)") + "(below the limit therefore no error)") requireInstantQuerySuccess(t, coordinator, resources.QueryRequest{ @@ -366,7 +366,7 @@ func testQueryLimitsApplied( }) logger.Info("test query series limit with require-exhaustive headers " + - "true (above limit therefore error)") + "true (above the limit therefore error)") requireError(t, func() error { _, err := coordinator.InstantQuery(resources.QueryRequest{ Query: "database_write_tagged_success", @@ -408,7 +408,7 @@ func testQueryLimitsApplied( }) logger.Info("test query docs limit with require-exhaustive headers true " + - "(below limit therefore no error)") + "(below limit and therefore no error)") requireInstantQuerySuccess(t, coordinator, resources.QueryRequest{ @@ -429,7 +429,7 @@ func testQueryLimitsApplied( }) logger.Info("test query docs limit with require-exhaustive headers " + - "true (above limit therefore error)") + "true (above limit, error)") requireError(t, func() error { _, err := coordinator.InstantQuery(resources.QueryRequest{ Query: "database_write_tagged_success", @@ -683,7 +683,7 @@ func testQueryLimitsApplied( }) logger.Info("test query time range limit with require-exhaustive headers true " + - "(above limit therefore error)") + "(above the limit and therefore error)") requireError(t, func() error { _, err := coordinator.RangeQuery(resources.RangeQueryRequest{ Query: "database_write_tagged_success", @@ -751,7 +751,7 @@ func testQueryLimitsApplied( }) logger.Info("test query time range limit with require-exhaustive headers true " + - "(above limit therefore error)") + "(above the limit therefore error)") requireError(t, func() error { _, err := coordinator.LabelValues(resources.LabelValuesRequest{ MetadataRequest: resources.MetadataRequest{ @@ -1099,7 +1099,7 @@ func testLabelQueryLimitsApplied( logger *zap.Logger, ) { logger.Info("test label limits with require-exhaustive headers true " + - "(below limit therefore no error)") + "(below the limit and therefore no error)") requireLabelValuesSuccess(t, coordinator, resources.LabelValuesRequest{ @@ -1143,7 +1143,7 @@ func testLabelQueryLimitsApplied( }) logger.Info("Test label series limit with require-exhaustive headers " + - "true (above limit therefore error)") + "true (above limit and therefore error)") requireError(t, func() error { _, err := coordinator.LabelValues(resources.LabelValuesRequest{ LabelName: "__name__", @@ -1192,7 +1192,7 @@ func testLabelQueryLimitsApplied( }) logger.Info("Test label docs limit with require-exhaustive headers " + - "true (above limit therefore error)") + "true (above limit, therefore error)") requireError(t, func() error { _, err := coordinator.LabelValues(resources.LabelValuesRequest{ LabelName: "__name__", diff --git a/src/integration/prometheus/prometheus_test.go b/src/integration/prometheus/prometheus_test.go index 778102c9c6..b4620dd9a8 100644 --- a/src/integration/prometheus/prometheus_test.go +++ b/src/integration/prometheus/prometheus_test.go @@ -30,13 +30,13 @@ import ( "runtime" "testing" - "github.com/m3db/m3/src/integration/resources" - "github.com/m3db/m3/src/integration/resources/docker/dockerexternal" - "github.com/m3db/m3/src/integration/resources/inprocess" - "github.com/ory/dockertest/v3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/integration/resources" + "github.com/m3db/m3/src/integration/resources/docker/dockerexternal" + "github.com/m3db/m3/src/integration/resources/inprocess" ) func TestPrometheus(t *testing.T) { diff --git a/src/integration/repair/repair_and_replication.go b/src/integration/repair/repair_and_replication.go index ff502e5638..bc3f3854b1 100644 --- a/src/integration/repair/repair_and_replication.go +++ b/src/integration/repair/repair_and_replication.go @@ -26,10 +26,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/integration/resources" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/integration/repair/repair_and_replication_test.go b/src/integration/repair/repair_and_replication_test.go index 2e88acfb8d..3818f565de 100644 --- a/src/integration/repair/repair_and_replication_test.go +++ b/src/integration/repair/repair_and_replication_test.go @@ -28,14 +28,14 @@ import ( "context" "testing" + "github.com/ory/dockertest/v3" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/integration/resources/docker/dockerexternal" "github.com/m3db/m3/src/integration/resources/inprocess" "github.com/m3db/m3/src/x/instrument" - - "github.com/ory/dockertest/v3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestRepairAndReplication(t *testing.T) { diff --git a/src/integration/resources/coordinator_client.go b/src/integration/resources/coordinator_client.go index 72a0dc74d3..e7feedf846 100644 --- a/src/integration/resources/coordinator_client.go +++ b/src/integration/resources/coordinator_client.go @@ -33,6 +33,13 @@ import ( "strings" "time" + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + "github.com/golang/snappy" + "github.com/prometheus/common/model" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/placementhandler" "github.com/m3db/m3/src/query/api/v1/handler/graphite" @@ -44,13 +51,6 @@ import ( "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - "github.com/golang/snappy" - "github.com/prometheus/common/model" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) var errUnknownServiceType = errors.New("unknown service type") @@ -454,8 +454,9 @@ func (c *CoordinatorClient) DeleteNamespace(namespaceID string) error { return nil } -//nolint:dupl // InitM3msgTopic initializes an m3msg topic +// +//nolint:dupl func (c *CoordinatorClient) InitM3msgTopic( topicOpts M3msgTopicOptions, initRequest admin.TopicInitRequest, @@ -508,8 +509,9 @@ func (c *CoordinatorClient) GetM3msgTopic( return response, nil } -//nolint:dupl // AddM3msgTopicConsumer adds a consumer service to an m3msg topic +// +//nolint:dupl func (c *CoordinatorClient) AddM3msgTopicConsumer( topicOpts M3msgTopicOptions, addRequest admin.TopicAddRequest, diff --git a/src/integration/resources/docker/dockerexternal/etcd.go b/src/integration/resources/docker/dockerexternal/etcd.go index e3a5d07ad6..14c6655244 100644 --- a/src/integration/resources/docker/dockerexternal/etcd.go +++ b/src/integration/resources/docker/dockerexternal/etcd.go @@ -30,17 +30,16 @@ import ( "strconv" "time" - "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration/bridge" - xdockertest "github.com/m3db/m3/src/x/dockertest" - 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" "go.uber.org/zap" "google.golang.org/grpc" + + xdockertest "github.com/m3db/m3/src/x/dockertest" + xerrors "github.com/m3db/m3/src/x/errors" + "github.com/m3db/m3/src/x/instrument" + "github.com/m3db/m3/src/x/retry" ) var ( @@ -97,8 +96,6 @@ type EtcdNode struct { // initialized by Setup address string resource *xdockertest.Resource - etcdCli *clientv3.Client - bridge *bridge.Bridge stopped bool } @@ -247,7 +244,7 @@ func (c *EtcdNode) waitForHealth(ctx context.Context, memberCli memberClient) er var timeout time.Duration deadline, ok := ctx.Deadline() if ok { - timeout = deadline.Sub(time.Now()) + timeout = time.Until(deadline) } c.logger.Info( "Waiting for etcd to report healthy (via member list)", diff --git a/src/integration/resources/docker/dockerexternal/etcd_test.go b/src/integration/resources/docker/dockerexternal/etcd_test.go index a267afb75c..3950e68c02 100644 --- a/src/integration/resources/docker/dockerexternal/etcd_test.go +++ b/src/integration/resources/docker/dockerexternal/etcd_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" clientv3 "go.etcd.io/etcd/client/v3" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/instrument" ) const ( @@ -124,7 +124,7 @@ func TestCluster(t *testing.T) { testPrefix := "cleanup-test-" deps.Etcd.namePrefix = testPrefix - findContainers := func(namePrefix string, pool *dockertest.Pool) ([]docker.APIContainers, error) { + findContainers := func(namePrefix string, _ *dockertest.Pool) ([]docker.APIContainers, error) { containers, err := deps.Pool.Client.ListContainers(docker.ListContainersOptions{}) if err != nil { return nil, err diff --git a/src/integration/resources/docker/dockerexternal/etcdintegration/cluster.go b/src/integration/resources/docker/dockerexternal/etcdintegration/cluster.go index 1a23284fe9..b06d424ebf 100644 --- a/src/integration/resources/docker/dockerexternal/etcdintegration/cluster.go +++ b/src/integration/resources/docker/dockerexternal/etcdintegration/cluster.go @@ -30,18 +30,18 @@ import ( "net" "time" + "github.com/ory/dockertest/v3" + "github.com/stretchr/testify/require" + clientv3 "go.etcd.io/etcd/client/v3" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/m3db/m3/src/integration/resources/docker/dockerexternal" "github.com/m3db/m3/src/integration/resources/docker/dockerexternal/etcdintegration/bridge" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" xtest "github.com/m3db/m3/src/x/test" - - "github.com/ory/dockertest/v3" - "github.com/stretchr/testify/require" - clientv3 "go.etcd.io/etcd/client/v3" - "go.uber.org/zap" - "google.golang.org/grpc" ) const ( diff --git a/src/integration/resources/docker/dockerexternal/prometheus.go b/src/integration/resources/docker/dockerexternal/prometheus.go index 7adc580d21..014db0578e 100644 --- a/src/integration/resources/docker/dockerexternal/prometheus.go +++ b/src/integration/resources/docker/dockerexternal/prometheus.go @@ -29,12 +29,12 @@ import ( "net/http" "time" - xdockertest "github.com/m3db/m3/src/x/dockertest" - "github.com/m3db/m3/src/x/instrument" - "github.com/cenkalti/backoff/v3" "github.com/ory/dockertest/v3" "github.com/prometheus/common/model" + + xdockertest "github.com/m3db/m3/src/x/dockertest" + "github.com/m3db/m3/src/x/instrument" ) // Prometheus is a docker-backed instantiation of Prometheus. diff --git a/src/integration/resources/docker/dockerm3/coordinator.go b/src/integration/resources/docker/dockerm3/coordinator.go index d607bccd96..51bdffe5b1 100644 --- a/src/integration/resources/docker/dockerm3/coordinator.go +++ b/src/integration/resources/docker/dockerm3/coordinator.go @@ -26,14 +26,14 @@ import ( "net/http" "time" + "github.com/ory/dockertest/v3" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/query/generated/proto/prompb" xdockertest "github.com/m3db/m3/src/x/dockertest" - - "github.com/ory/dockertest/v3" - "github.com/prometheus/common/model" ) const ( diff --git a/src/integration/resources/docker/dockerm3/dbnode.go b/src/integration/resources/docker/dockerm3/dbnode.go index 0053b0729b..42089aa0d5 100644 --- a/src/integration/resources/docker/dockerm3/dbnode.go +++ b/src/integration/resources/docker/dockerm3/dbnode.go @@ -24,15 +24,15 @@ import ( "fmt" "strings" + "github.com/ory/dockertest/v3" + "github.com/ory/dockertest/v3/docker" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/dbnode/integration" "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/query/generated/proto/admin" xdockertest "github.com/m3db/m3/src/x/dockertest" - - "github.com/ory/dockertest/v3" - "github.com/ory/dockertest/v3/docker" - "go.uber.org/zap" ) const ( diff --git a/src/integration/resources/docker/dockerm3/harness.go b/src/integration/resources/docker/dockerm3/harness.go index 8eb4fe3f7c..962b4dd7ac 100644 --- a/src/integration/resources/docker/dockerm3/harness.go +++ b/src/integration/resources/docker/dockerm3/harness.go @@ -24,13 +24,13 @@ package dockerm3 import ( "time" + "github.com/ory/dockertest/v3" + "go.uber.org/zap" + "github.com/m3db/m3/src/integration/resources" xdockertest "github.com/m3db/m3/src/x/dockertest" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/ory/dockertest/v3" - "go.uber.org/zap" ) const timeout = time.Second * 60 diff --git a/src/integration/resources/inprocess/aggregator.go b/src/integration/resources/inprocess/aggregator.go index fc76aef7c0..cad8cb348a 100644 --- a/src/integration/resources/inprocess/aggregator.go +++ b/src/integration/resources/inprocess/aggregator.go @@ -30,6 +30,10 @@ import ( "strconv" "time" + "github.com/google/uuid" + "go.uber.org/zap" + "gopkg.in/yaml.v2" + m3agg "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/aggregator/server" "github.com/m3db/m3/src/aggregator/tools/deploy" @@ -39,10 +43,6 @@ import ( nettest "github.com/m3db/m3/src/integration/resources/net" "github.com/m3db/m3/src/x/config/hostid" xos "github.com/m3db/m3/src/x/os" - - "github.com/google/uuid" - "go.uber.org/zap" - "gopkg.in/yaml.v2" ) var errAggregatorNotStarted = errors.New("aggregator instance has not started") @@ -176,6 +176,7 @@ func (a *Aggregator) HostDetails() (*resources.InstanceInfo, error) { } // Start starts the aggregator instance. +// //nolint:dupl func (a *Aggregator) Start() { if a.started { @@ -256,8 +257,8 @@ func (a *Aggregator) Close() error { select { case <-a.shutdownCh: case <-time.After(shutdownTimeout): - return errors.New("timeout waiting for shutdown notification. server closing may" + - " not be completely graceful") + return errors.New("timeout waiting for shutdown notification. server closing " + + " may not be completely graceful") } return nil diff --git a/src/integration/resources/inprocess/aggregator_test.go b/src/integration/resources/inprocess/aggregator_test.go index f1daa056a6..8c5d6349ab 100644 --- a/src/integration/resources/inprocess/aggregator_test.go +++ b/src/integration/resources/inprocess/aggregator_test.go @@ -1,4 +1,6 @@ +//go:build test_harness // +build test_harness + // Copyright (c) 2021 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -27,6 +29,10 @@ import ( "testing" "time" + "github.com/prometheus/common/model" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + m3agg "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -36,10 +42,6 @@ import ( "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/query/storage" xtime "github.com/m3db/m3/src/x/time" - "github.com/prometheus/common/model" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNewAggregator(t *testing.T) { diff --git a/src/integration/resources/inprocess/cluster.go b/src/integration/resources/inprocess/cluster.go index 01630b2b81..03dcf86c72 100644 --- a/src/integration/resources/inprocess/cluster.go +++ b/src/integration/resources/inprocess/cluster.go @@ -26,6 +26,11 @@ import ( "fmt" "time" + "github.com/google/uuid" + "github.com/ory/dockertest/v3" + "go.uber.org/zap" + "gopkg.in/yaml.v2" + etcdclient "github.com/m3db/m3/src/cluster/client/etcd" aggcfg "github.com/m3db/m3/src/cmd/services/m3aggregator/config" dbcfg "github.com/m3db/m3/src/cmd/services/m3dbnode/config" @@ -41,11 +46,6 @@ import ( "github.com/m3db/m3/src/x/config/hostid" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/google/uuid" - "github.com/ory/dockertest/v3" - "go.uber.org/zap" - "gopkg.in/yaml.v2" ) // ClusterConfigs contain the input config to use for components within @@ -245,7 +245,7 @@ func NewClusterFromSpecification( if err := etcd.Setup(context.TODO()); err != nil { return nil, err } - etcdEndpoints = []string{fmt.Sprintf(etcd.Address())} + etcdEndpoints = []string{fmt.Sprint(etcd.Address())} } updateEtcdEndpoints := func(etcdCfg *etcdclient.Configuration) { diff --git a/src/integration/resources/inprocess/cluster_test.go b/src/integration/resources/inprocess/cluster_test.go index c35696101d..f518cf67a7 100644 --- a/src/integration/resources/inprocess/cluster_test.go +++ b/src/integration/resources/inprocess/cluster_test.go @@ -1,4 +1,6 @@ +//go:build test_harness // +build test_harness + // Copyright (c) 2021 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -25,9 +27,10 @@ import ( "errors" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/integration/resources" - "github.com/stretchr/testify/require" ) func TestNewCluster(t *testing.T) { diff --git a/src/integration/resources/inprocess/coordinator.go b/src/integration/resources/inprocess/coordinator.go index a7daa585a3..0e56177656 100644 --- a/src/integration/resources/inprocess/coordinator.go +++ b/src/integration/resources/inprocess/coordinator.go @@ -32,6 +32,10 @@ import ( "strconv" "time" + "github.com/prometheus/common/model" + "go.uber.org/zap" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/integration/resources" nettest "github.com/m3db/m3/src/integration/resources/net" @@ -42,10 +46,6 @@ import ( xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/headers" xos "github.com/m3db/m3/src/x/os" - - "github.com/prometheus/common/model" - "go.uber.org/zap" - "gopkg.in/yaml.v2" ) const ( @@ -53,9 +53,10 @@ const ( shutdownTimeout = time.Minute ) -//nolint:maligned // Coordinator is an in-process implementation of resources.Coordinator for use // in integration tests. +// +//nolint:maligned type Coordinator struct { cfg config.Configuration client resources.CoordinatorClient @@ -69,8 +70,9 @@ type Coordinator struct { shutdownCh <-chan struct{} } -//nolint:maligned // CoordinatorOptions are options for starting a coordinator server. +// +//nolint:maligned type CoordinatorOptions struct { // GeneratePorts will automatically update the config to use open ports // if set to true. If false, configuration is used as-is re: ports. @@ -115,10 +117,10 @@ func NewCoordinatorFromYAML(yamlCfg string, opts CoordinatorOptions) (resources. // some behavior. For example, assuming we have a running DB node already, we could // do the following to create a new namespace and write to it (note: ignoring error checking): // -// coord, _ := NewCoordinatorFromYAML(defaultCoordConfig, CoordinatorOptions{}) -// coord.AddNamespace(admin.NamespaceAddRequest{...}) -// coord.WaitForNamespace(namespaceName) -// coord.WriteProm("cpu", map[string]string{"host", host}, samples) +// coord, _ := NewCoordinatorFromYAML(defaultCoordConfig, CoordinatorOptions{}) +// coord.AddNamespace(admin.NamespaceAddRequest{...}) +// coord.WaitForNamespace(namespaceName) +// coord.WriteProm("cpu", map[string]string{"host", host}, samples) // // The coordinator will start up as you specify in your config. However, there is some // helper logic to avoid port and filesystem collisions when spinning up multiple components @@ -215,6 +217,7 @@ func NewEmbeddedCoordinator(d *DBNode) (resources.Coordinator, error) { } // Start is the start method for the coordinator. +// //nolint:dupl func (c *Coordinator) Start() { if c.started { @@ -385,8 +388,8 @@ func (c *Coordinator) Close() error { select { case <-c.shutdownCh: case <-time.After(shutdownTimeout): - return errors.New("timeout waiting for shutdown notification. coordinator closing may" + - " not be completely graceful") + return errors.New("timeout waiting for shutdown notification. coordinator " + + " closing may not be completely graceful") } c.started = false diff --git a/src/integration/resources/inprocess/coordinator_test.go b/src/integration/resources/inprocess/coordinator_test.go index 9f9e776139..409aee0265 100644 --- a/src/integration/resources/inprocess/coordinator_test.go +++ b/src/integration/resources/inprocess/coordinator_test.go @@ -27,6 +27,11 @@ import ( "context" "testing" + "github.com/ory/dockertest/v3" + "github.com/prometheus/common/model" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/integration/resources" @@ -38,11 +43,6 @@ import ( "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - "github.com/ory/dockertest/v3" - - "github.com/prometheus/common/model" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNewCoordinator(t *testing.T) { diff --git a/src/integration/resources/inprocess/dbnode.go b/src/integration/resources/inprocess/dbnode.go index f526faf1a4..c3018e9b0c 100644 --- a/src/integration/resources/inprocess/dbnode.go +++ b/src/integration/resources/inprocess/dbnode.go @@ -31,6 +31,10 @@ import ( "strconv" "time" + "github.com/google/uuid" + "go.uber.org/zap" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cmd/services/m3dbnode/config" "github.com/m3db/m3/src/cmd/services/m3dbnode/server" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" @@ -41,10 +45,6 @@ import ( xconfig "github.com/m3db/m3/src/x/config" "github.com/m3db/m3/src/x/config/hostid" xos "github.com/m3db/m3/src/x/os" - - "github.com/google/uuid" - "go.uber.org/zap" - "gopkg.in/yaml.v2" ) // TODO(nate): make configurable @@ -64,8 +64,9 @@ type DBNode struct { tchanClient *integration.TestTChannelClient } -//nolint:maligned // DBNodeOptions are options for starting a DB node server. +// +//nolint:maligned type DBNodeOptions struct { // GeneratePorts will automatically update the config to use open ports // if set to true. If false, configuration is used as-is re: ports. @@ -113,10 +114,10 @@ func NewDBNodeFromYAML(yamlCfg string, opts DBNodeOptions) (resources.Node, erro // some behavior. For example, assuming we have a valid placement available already we // could do the following to read and write to a namespace (note: ignoring error checking): // -// dbnode, _ := NewDBNodeFromYAML(defaultDBNodeConfig, DBNodeOptions{}) -// dbnode.WaitForBootstrap() -// dbnode.WriteTaggedPoint(&rpc.WriteTaggedRequest{...})) -// res, _ = dbnode.FetchTagged(&rpc.FetchTaggedRequest{...}) +// dbnode, _ := NewDBNodeFromYAML(defaultDBNodeConfig, DBNodeOptions{}) +// dbnode.WaitForBootstrap() +// dbnode.WriteTaggedPoint(&rpc.WriteTaggedRequest{...})) +// res, _ = dbnode.FetchTagged(&rpc.FetchTaggedRequest{...}) // // The dbnode will start up as you specify in your config. However, there is some // helper logic to avoid port and filesystem collisions when spinning up multiple components @@ -357,8 +358,8 @@ func (d *DBNode) Close() error { select { case <-d.shutdownCh: case <-time.After(shutdownTimeout): - return errors.New("timeout waiting for shutdown notification. server closing may" + - " not be completely graceful") + return errors.New("timeout waiting for shutdown notification. " + + " server closing may not be completely graceful") } } d.started = false diff --git a/src/integration/resources/inprocess/inprocess_test.go b/src/integration/resources/inprocess/inprocess_test.go index b2eebb6b89..6da271c478 100644 --- a/src/integration/resources/inprocess/inprocess_test.go +++ b/src/integration/resources/inprocess/inprocess_test.go @@ -1,4 +1,6 @@ +//go:build test_harness // +build test_harness + // Copyright (c) 2021 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -24,9 +26,9 @@ package inprocess import ( "testing" - "github.com/m3db/m3/src/integration/resources" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/integration/resources" ) func TestSetupInprocessCluster(t *testing.T) { diff --git a/src/integration/resources/resources.go b/src/integration/resources/resources.go index d40c5d0d19..5425a8b944 100644 --- a/src/integration/resources/resources.go +++ b/src/integration/resources/resources.go @@ -27,15 +27,15 @@ import ( "strconv" "time" + protobuftypes "github.com/gogo/protobuf/types" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/msg/generated/proto/topicpb" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" - - protobuftypes "github.com/gogo/protobuf/types" - "go.uber.org/zap" ) const ( diff --git a/src/integration/resources/types.go b/src/integration/resources/types.go index 6cc518b752..56cc0b521a 100644 --- a/src/integration/resources/types.go +++ b/src/integration/resources/types.go @@ -30,14 +30,14 @@ import ( "sync" "time" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/aggregator/aggregator" "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/x/errors" - - "github.com/prometheus/common/model" ) // ResponseVerifier is a function that checks if the query response is valid. diff --git a/src/integration/simple/simple.go b/src/integration/simple/simple.go index 6a661acbcf..62a238f7c6 100644 --- a/src/integration/simple/simple.go +++ b/src/integration/simple/simple.go @@ -26,15 +26,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/generated/thrift/rpc" "github.com/m3db/m3/src/integration/resources" "github.com/m3db/m3/src/m3ninx/idx" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) const ( diff --git a/src/integration/simple/simple_test.go b/src/integration/simple/simple_test.go index a645b08f71..108f7e137b 100644 --- a/src/integration/simple/simple_test.go +++ b/src/integration/simple/simple_test.go @@ -1,4 +1,6 @@ +//go:build cluster_integration // +build cluster_integration + // // Copyright (c) 2021 Uber Technologies, Inc. // diff --git a/src/m3em/agent/agent.go b/src/m3em/agent/agent.go index 615948b1a9..38c505ec8d 100644 --- a/src/m3em/agent/agent.go +++ b/src/m3em/agent/agent.go @@ -32,17 +32,17 @@ import ( "sync/atomic" "time" - "github.com/m3db/m3/src/m3em/checksum" - "github.com/m3db/m3/src/m3em/generated/proto/m3em" - "github.com/m3db/m3/src/m3em/os/exec" - "github.com/m3db/m3/src/m3em/os/fs" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/uber-go/tally" "go.uber.org/zap" context "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" + + "github.com/m3db/m3/src/m3em/checksum" + "github.com/m3db/m3/src/m3em/generated/proto/m3em" + "github.com/m3db/m3/src/m3em/os/exec" + "github.com/m3db/m3/src/m3em/os/fs" + xerrors "github.com/m3db/m3/src/x/errors" ) const ( diff --git a/src/m3em/agent/agent_test.go b/src/m3em/agent/agent_test.go index 185c575f79..7352f48173 100644 --- a/src/m3em/agent/agent_test.go +++ b/src/m3em/agent/agent_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + context "golang.org/x/net/context" + hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" "github.com/m3db/m3/src/m3em/generated/proto/m3em" "github.com/m3db/m3/src/m3em/os/exec" @@ -36,10 +40,6 @@ import ( xgrpc "github.com/m3db/m3/src/m3em/x/grpc" m3xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - context "golang.org/x/net/context" ) func newTempDir(t *testing.T) string { diff --git a/src/m3em/agent/heartbeater.go b/src/m3em/agent/heartbeater.go index 1907b99fd9..0e4648b10e 100644 --- a/src/m3em/agent/heartbeater.go +++ b/src/m3em/agent/heartbeater.go @@ -27,12 +27,12 @@ import ( "sync/atomic" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" - "google.golang.org/grpc" ) type runner interface { diff --git a/src/m3em/agent/heartbeater_test.go b/src/m3em/agent/heartbeater_test.go index 5c55f6e75b..6c0a7578a1 100644 --- a/src/m3em/agent/heartbeater_test.go +++ b/src/m3em/agent/heartbeater_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" xgrpc "github.com/m3db/m3/src/m3em/x/grpc" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestInvalidMessageType(t *testing.T) { diff --git a/src/m3em/cluster/cluster.go b/src/m3em/cluster/cluster.go index 170bfa4bd0..78acc0d89f 100644 --- a/src/m3em/cluster/cluster.go +++ b/src/m3em/cluster/cluster.go @@ -24,12 +24,12 @@ import ( "fmt" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/m3em/node" xerrors "github.com/m3db/m3/src/x/errors" - - "go.uber.org/zap" ) var ( diff --git a/src/m3em/cluster/cluster_test.go b/src/m3em/cluster/cluster_test.go index 45de07faa5..1791132562 100644 --- a/src/m3em/cluster/cluster_test.go +++ b/src/m3em/cluster/cluster_test.go @@ -25,13 +25,13 @@ import ( "math/rand" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/m3em/cluster/config_test.go b/src/m3em/cluster/config_test.go index af3c4f64e7..501c1e267a 100644 --- a/src/m3em/cluster/config_test.go +++ b/src/m3em/cluster/config_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - xretry "github.com/m3db/m3/src/x/retry" - "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/instrument" + xretry "github.com/m3db/m3/src/x/retry" ) func TestConfigurationAssignment(t *testing.T) { diff --git a/src/m3em/cluster/types.go b/src/m3em/cluster/types.go index b9e4787b5e..28dfd86fac 100644 --- a/src/m3em/cluster/types.go +++ b/src/m3em/cluster/types.go @@ -33,24 +33,26 @@ import ( // Status indicates the different states a Cluster can be in. Refer to the // state diagram below to understand transitions. Note, all states can transition // to `ClusterStatusError`, these edges are skipped below. -// ╔══════════════════╗ -// ║ ║ -// ║ Uninitialized ║────────────Setup()────┐ -// ║ ║ │ -// ╚══════════════════╝ │ -// ▲ │ -// │ │ -// │ │ -// │ Teardown() │ -// ├────────────────────────┐ │ -// │ │ │ -// ┌───────┘ │ │ -// │ │ ▼ -// ╔═════╩════════════╗◀────Start()─────╦═╩════════════════╗ -// ║ ║ ║ ║ -// ┌──║ Running ║ ║ Setup ║──┐ -// │ ║ ║ ║ ║ │ -// │ ╚══════════════════╝──────Stop()────▶╚══════════════════╝ │ +// +// ╔══════════════════╗ +// ║ ║ +// ║ Uninitialized ║────────────Setup()────┐ +// ║ ║ │ +// ╚══════════════════╝ │ +// ▲ │ +// │ │ +// │ │ +// │ Teardown() │ +// ├────────────────────────┐ │ +// │ │ │ +// ┌───────┘ │ │ +// │ │ ▼ +// ╔═════╩════════════╗◀────Start()─────╦═╩════════════════╗ +// ║ ║ ║ ║ +// ┌──║ Running ║ ║ Setup ║──┐ +// │ ║ ║ ║ ║ │ +// │ ╚══════════════════╝──────Stop()────▶╚══════════════════╝ │ +// // AddInstance() ▲ ▲ AddInstance() // RemoveInstance() │ │ RemoveInstance() // ReplaceInstance()──┘ └────ReplaceInstance() diff --git a/src/m3em/integration/common.go b/src/m3em/integration/common.go index e8fee29c12..0c0239a1a8 100644 --- a/src/m3em/integration/common.go +++ b/src/m3em/integration/common.go @@ -31,9 +31,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/m3em/agent" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/agent" ) const ( diff --git a/src/m3em/integration/file_transfer_test.go b/src/m3em/integration/file_transfer_test.go index 73789476ba..d8c09060d5 100644 --- a/src/m3em/integration/file_transfer_test.go +++ b/src/m3em/integration/file_transfer_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -27,9 +28,9 @@ import ( "path" "testing" - "github.com/m3db/m3/src/m3em/build" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/build" ) func TestFileTransfer(t *testing.T) { diff --git a/src/m3em/integration/harness.go b/src/m3em/integration/harness.go index da62ad850e..9e862adbfc 100644 --- a/src/m3em/integration/harness.go +++ b/src/m3em/integration/harness.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -31,6 +32,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/m3em/agent" hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" @@ -41,11 +47,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) type closeFn func() error diff --git a/src/m3em/integration/heartbeat_timeout_test.go b/src/m3em/integration/heartbeat_timeout_test.go index a1c352765e..4ae9a0b219 100644 --- a/src/m3em/integration/heartbeat_timeout_test.go +++ b/src/m3em/integration/heartbeat_timeout_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -27,10 +28,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/stretchr/testify/require" ) func TestHeartbeatTimeout(t *testing.T) { diff --git a/src/m3em/integration/large_file_transfer_test.go b/src/m3em/integration/large_file_transfer_test.go index 5d899df4da..b85b351fc7 100644 --- a/src/m3em/integration/large_file_transfer_test.go +++ b/src/m3em/integration/large_file_transfer_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -28,9 +29,9 @@ import ( "path" "testing" - "github.com/m3db/m3/src/m3em/build" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/build" ) func TestLargeFileTransfer(t *testing.T) { diff --git a/src/m3em/integration/multiple_data_transfer_test.go b/src/m3em/integration/multiple_data_transfer_test.go index 99a75172f5..ab66fbff29 100644 --- a/src/m3em/integration/multiple_data_transfer_test.go +++ b/src/m3em/integration/multiple_data_transfer_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -27,9 +28,9 @@ import ( "path" "testing" - "github.com/m3db/m3/src/m3em/build" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/build" ) func TestMultipleDataTransfer(t *testing.T) { diff --git a/src/m3em/integration/process_execution_heartbeat_test.go b/src/m3em/integration/process_execution_heartbeat_test.go index 49be620a7f..dde13793c8 100644 --- a/src/m3em/integration/process_execution_heartbeat_test.go +++ b/src/m3em/integration/process_execution_heartbeat_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -30,10 +31,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/stretchr/testify/require" ) func TestProcessExecutionHeartbeating(t *testing.T) { diff --git a/src/m3em/integration/process_execution_heartbeat_timeout_test.go b/src/m3em/integration/process_execution_heartbeat_timeout_test.go index 26ce967c36..fce541b53e 100644 --- a/src/m3em/integration/process_execution_heartbeat_timeout_test.go +++ b/src/m3em/integration/process_execution_heartbeat_timeout_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -27,10 +28,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/stretchr/testify/require" ) func TestProcessExecutionHeartbeatingTimeout(t *testing.T) { diff --git a/src/m3em/integration/process_execution_termination_test.go b/src/m3em/integration/process_execution_termination_test.go index d5bc8f4fef..b4f54d393f 100644 --- a/src/m3em/integration/process_execution_termination_test.go +++ b/src/m3em/integration/process_execution_termination_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -29,10 +30,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/stretchr/testify/require" ) func TestProcessTermination(t *testing.T) { diff --git a/src/m3em/integration/process_execution_test.go b/src/m3em/integration/process_execution_test.go index 6f52031528..12f4e7c0b5 100644 --- a/src/m3em/integration/process_execution_test.go +++ b/src/m3em/integration/process_execution_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -29,10 +30,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/node" - - "github.com/stretchr/testify/require" ) func TestProcessExecution(t *testing.T) { diff --git a/src/m3em/integration/process_output_streamed_test.go b/src/m3em/integration/process_output_streamed_test.go index e1df001b6d..67d399944a 100644 --- a/src/m3em/integration/process_output_streamed_test.go +++ b/src/m3em/integration/process_output_streamed_test.go @@ -18,6 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package integration @@ -29,9 +30,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/m3em/build" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/build" ) func TestProccessStreamingOutputExecution(t *testing.T) { diff --git a/src/m3em/integration/resources/cert.go b/src/m3em/integration/resources/cert.go index 915c10f7ad..f2b2a1ada3 100644 --- a/src/m3em/integration/resources/cert.go +++ b/src/m3em/integration/resources/cert.go @@ -18,14 +18,15 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:build integration // +build integration package resources import ( - xgrpc "github.com/m3db/m3/src/m3em/x/grpc" - "google.golang.org/grpc/credentials" + + xgrpc "github.com/m3db/m3/src/m3em/x/grpc" ) const ( diff --git a/src/m3em/node/config_test.go b/src/m3em/node/config_test.go index 19ff1d754f..5fe3922b23 100644 --- a/src/m3em/node/config_test.go +++ b/src/m3em/node/config_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - xretry "github.com/m3db/m3/src/x/retry" - "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/instrument" + xretry "github.com/m3db/m3/src/x/retry" ) func TestConfigurationAssignment(t *testing.T) { diff --git a/src/m3em/node/heartbeat.go b/src/m3em/node/heartbeat.go index 76d4322568..487fb30dce 100644 --- a/src/m3em/node/heartbeat.go +++ b/src/m3em/node/heartbeat.go @@ -25,12 +25,12 @@ import ( "sync" "time" - hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" - "github.com/m3db/m3/src/x/instrument" - context "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" + + hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" + "github.com/m3db/m3/src/x/instrument" ) type heartbeatRouter struct { diff --git a/src/m3em/node/heartbeat_test.go b/src/m3em/node/heartbeat_test.go index 43e289484c..265487f781 100644 --- a/src/m3em/node/heartbeat_test.go +++ b/src/m3em/node/heartbeat_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" context "golang.org/x/net/context" + + hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" + "github.com/m3db/m3/src/x/instrument" ) var ( diff --git a/src/m3em/node/node.go b/src/m3em/node/node.go index a54bf0de52..37ccaf484a 100644 --- a/src/m3em/node/node.go +++ b/src/m3em/node/node.go @@ -28,16 +28,16 @@ import ( "path/filepath" "sync" + "github.com/pborman/uuid" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/generated/proto/m3em" "github.com/m3db/m3/src/m3em/os/fs" xclock "github.com/m3db/m3/src/x/clock" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/pborman/uuid" - "go.uber.org/zap" - "google.golang.org/grpc" ) var ( diff --git a/src/m3em/node/node_test.go b/src/m3em/node/node_test.go index 3aa398742d..8cd1ead13d 100644 --- a/src/m3em/node/node_test.go +++ b/src/m3em/node/node_test.go @@ -28,14 +28,14 @@ import ( "os" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/m3em/build" "github.com/m3db/m3/src/m3em/generated/proto/m3em" mockfs "github.com/m3db/m3/src/m3em/os/fs/mocks" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" ) const defaultRandSeed = 1234567890 diff --git a/src/m3em/node/types.go b/src/m3em/node/types.go index 1a3c229d7f..5b3fe5a0b2 100644 --- a/src/m3em/node/types.go +++ b/src/m3em/node/types.go @@ -23,6 +23,8 @@ package node import ( "time" + "google.golang.org/grpc" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/m3em/build" hb "github.com/m3db/m3/src/m3em/generated/proto/heartbeat" @@ -30,39 +32,39 @@ import ( xclock "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" xretry "github.com/m3db/m3/src/x/retry" - - "google.golang.org/grpc" ) // Status indicates the different states a ServiceNode can be in. The // state diagram below describes the transitions between the various states: // -// ┌──────────────────┐ -// │ │ -// ┌Teardown()─────│ Error │ -// │ │ │ -// │ └──────────────────┘ -// │ -// ▼ +// ┌──────────────────┐ +// │ │ +// ┌Teardown()─────│ Error │ +// │ │ │ +// │ └──────────────────┘ +// │ +// ▼ +// // ┌──────────────────┐ ┌───────────────-──┐ // │ │ Setup() │ │ // │ Uninitialized ├────────────────────────▶│ Setup │◀─┐ // │ │◀───────────┐ │ │ │ // └──────────────────┘ Teardown()└────────────└──────────────────┘ │ -// ▲ │ │ -// │ │ │ -// │ │ │ -// │ Start() │ │ -// │ ┌─────────────┘ │ -// │ │ │ -// │ │ │ -// │ │ │ -// │ ▼ │ -// │ ┌──────────────────┐ │ -// │Teardown() │ │ | -// └────────────────────│ Running │────────────Stop() -// │ │ -// └──────────────────┘ +// +// ▲ │ │ +// │ │ │ +// │ │ │ +// │ Start() │ │ +// │ ┌─────────────┘ │ +// │ │ │ +// │ │ │ +// │ │ │ +// │ ▼ │ +// │ ┌──────────────────┐ │ +// │Teardown() │ │ | +// └────────────────────│ Running │────────────Stop() +// │ │ +// └──────────────────┘ type Status int const ( diff --git a/src/m3em/os/fs/file_reader_iter_test.go b/src/m3em/os/fs/file_reader_iter_test.go index cc887b4865..4e69500abc 100644 --- a/src/m3em/os/fs/file_reader_iter_test.go +++ b/src/m3em/os/fs/file_reader_iter_test.go @@ -24,9 +24,9 @@ import ( "os" "testing" - "github.com/m3db/m3/src/m3em/checksum" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3em/checksum" ) func TestIterChecksumLargeBuffer(t *testing.T) { diff --git a/src/m3ninx/idx/query_matcher_test.go b/src/m3ninx/idx/query_matcher_test.go index 5a95df6c6b..251e5cdb26 100644 --- a/src/m3ninx/idx/query_matcher_test.go +++ b/src/m3ninx/idx/query_matcher_test.go @@ -23,9 +23,9 @@ package idx_test import ( "testing" - "github.com/m3db/m3/src/m3ninx/idx" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/idx" ) func TestQueryMatcherTermQuery(t *testing.T) { diff --git a/src/m3ninx/index/batch_matcher_test.go b/src/m3ninx/index/batch_matcher_test.go index 047b2f532d..71a4736959 100644 --- a/src/m3ninx/index/batch_matcher_test.go +++ b/src/m3ninx/index/batch_matcher_test.go @@ -23,10 +23,10 @@ package index_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" - - "github.com/stretchr/testify/require" ) func TestBatchMatcherAllowPartialReflexive(t *testing.T) { diff --git a/src/m3ninx/index/iterator_test.go b/src/m3ninx/index/iterator_test.go index 8083ad04b3..33798787a1 100644 --- a/src/m3ninx/index/iterator_test.go +++ b/src/m3ninx/index/iterator_test.go @@ -23,13 +23,13 @@ package index import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index/segment/fst/encoding" "github.com/m3db/m3/src/m3ninx/postings" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestDocIterator(t *testing.T) { diff --git a/src/m3ninx/index/regexp.go b/src/m3ninx/index/regexp.go index 6aa250d595..0016d42e25 100644 --- a/src/m3ninx/index/regexp.go +++ b/src/m3ninx/index/regexp.go @@ -26,10 +26,10 @@ import ( "regexp/syntax" "sync" + "github.com/uber-go/tally" + fstregexp "github.com/m3db/m3/src/m3ninx/index/segment/fst/regexp" "github.com/m3db/m3/src/x/cache" - - "github.com/uber-go/tally" ) var ( diff --git a/src/m3ninx/index/regexp_prop_test.go b/src/m3ninx/index/regexp_prop_test.go index 444dd7a196..61c75cc703 100644 --- a/src/m3ninx/index/regexp_prop_test.go +++ b/src/m3ninx/index/regexp_prop_test.go @@ -1,4 +1,6 @@ +//go:build big // +build big + // // Copyright (c) 2018 Uber Technologies, Inc. // diff --git a/src/m3ninx/index/regexp_test.go b/src/m3ninx/index/regexp_test.go index e8ba1f0a8a..720bc3a7e3 100644 --- a/src/m3ninx/index/regexp_test.go +++ b/src/m3ninx/index/regexp_test.go @@ -27,11 +27,11 @@ import ( "testing" "unicode" - "github.com/m3db/m3/src/x/tallytest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/tallytest" ) func TestEnsureSyntaxPerlTreatsAnchorsAsTextTerminator(t *testing.T) { diff --git a/src/m3ninx/index/segment/builder/builder.go b/src/m3ninx/index/segment/builder/builder.go index 145dc41c19..e05c361ced 100644 --- a/src/m3ninx/index/segment/builder/builder.go +++ b/src/m3ninx/index/segment/builder/builder.go @@ -26,14 +26,14 @@ import ( "runtime" "sync" + "github.com/cespare/xxhash/v2" + "github.com/twotwotwo/sorts" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/util" - - "github.com/cespare/xxhash/v2" - "github.com/twotwotwo/sorts" ) var ( diff --git a/src/m3ninx/index/segment/builder/builder_test.go b/src/m3ninx/index/segment/builder/builder_test.go index 20e89dea00..07e1e94dcf 100644 --- a/src/m3ninx/index/segment/builder/builder_test.go +++ b/src/m3ninx/index/segment/builder/builder_test.go @@ -26,11 +26,11 @@ import ( "testing" "unsafe" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/m3ninx/index/segment/builder/bytes_slice_iter.go b/src/m3ninx/index/segment/builder/bytes_slice_iter.go index f627388d89..3e02e4f800 100644 --- a/src/m3ninx/index/segment/builder/bytes_slice_iter.go +++ b/src/m3ninx/index/segment/builder/bytes_slice_iter.go @@ -23,10 +23,10 @@ package builder import ( "bytes" + "github.com/twotwotwo/sorts" + "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" - - "github.com/twotwotwo/sorts" ) type uniqueField struct { diff --git a/src/m3ninx/index/segment/builder/multi_segments_field_iter_test.go b/src/m3ninx/index/segment/builder/multi_segments_field_iter_test.go index 5938626ce6..0591b92100 100644 --- a/src/m3ninx/index/segment/builder/multi_segments_field_iter_test.go +++ b/src/m3ninx/index/segment/builder/multi_segments_field_iter_test.go @@ -23,13 +23,13 @@ package builder import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/mem" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/m3ninx/index/segment/builder/multi_segments_field_postings_list_iter_test.go b/src/m3ninx/index/segment/builder/multi_segments_field_postings_list_iter_test.go index 5d49119746..d99a6929a7 100644 --- a/src/m3ninx/index/segment/builder/multi_segments_field_postings_list_iter_test.go +++ b/src/m3ninx/index/segment/builder/multi_segments_field_postings_list_iter_test.go @@ -24,10 +24,10 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index/segment" - - "github.com/stretchr/testify/require" ) func TestFieldPostingsListIterFromSegments(t *testing.T) { diff --git a/src/m3ninx/index/segment/builder/multi_segments_multi_key_postings_list_iter.go b/src/m3ninx/index/segment/builder/multi_segments_multi_key_postings_list_iter.go index e212144ab4..8123e482bb 100644 --- a/src/m3ninx/index/segment/builder/multi_segments_multi_key_postings_list_iter.go +++ b/src/m3ninx/index/segment/builder/multi_segments_multi_key_postings_list_iter.go @@ -23,12 +23,13 @@ package builder import ( "bytes" + bitmap "github.com/m3dbx/pilosa/roaring" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" xerrors "github.com/m3db/m3/src/x/errors" - bitmap "github.com/m3dbx/pilosa/roaring" ) var _ segment.FieldsPostingsListIterator = &multiKeyPostingsListIterator{} diff --git a/src/m3ninx/index/segment/builder/multi_segments_terms_iter.go b/src/m3ninx/index/segment/builder/multi_segments_terms_iter.go index e15a4d484e..a7ecbbec18 100644 --- a/src/m3ninx/index/segment/builder/multi_segments_terms_iter.go +++ b/src/m3ninx/index/segment/builder/multi_segments_terms_iter.go @@ -21,11 +21,12 @@ package builder import ( + bitmap "github.com/m3dbx/pilosa/roaring" + "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" xerrors "github.com/m3db/m3/src/x/errors" - bitmap "github.com/m3dbx/pilosa/roaring" ) const ( diff --git a/src/m3ninx/index/segment/builder/multi_segments_terms_iter_test.go b/src/m3ninx/index/segment/builder/multi_segments_terms_iter_test.go index 99bc8c225d..cbd2066712 100644 --- a/src/m3ninx/index/segment/builder/multi_segments_terms_iter_test.go +++ b/src/m3ninx/index/segment/builder/multi_segments_terms_iter_test.go @@ -26,11 +26,11 @@ import ( "strings" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" - - "github.com/stretchr/testify/require" ) func TestTermsIterFromSegmentsDeduplicates(t *testing.T) { diff --git a/src/m3ninx/index/segment/builder/terms.go b/src/m3ninx/index/segment/builder/terms.go index 4fde080672..3a8207dfc0 100644 --- a/src/m3ninx/index/segment/builder/terms.go +++ b/src/m3ninx/index/segment/builder/terms.go @@ -23,8 +23,9 @@ package builder import ( "bytes" - "github.com/m3db/m3/src/m3ninx/postings" "github.com/twotwotwo/sorts" + + "github.com/m3db/m3/src/m3ninx/postings" ) type terms struct { diff --git a/src/m3ninx/index/segment/builder/terms_test.go b/src/m3ninx/index/segment/builder/terms_test.go index 0a17d7a062..25e76f4e04 100644 --- a/src/m3ninx/index/segment/builder/terms_test.go +++ b/src/m3ninx/index/segment/builder/terms_test.go @@ -23,9 +23,9 @@ package builder import ( "testing" - "github.com/m3db/m3/src/m3ninx/postings" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/postings" ) func TestTermsReuse(t *testing.T) { diff --git a/src/m3ninx/index/segment/fst/encoding/docs/data_test.go b/src/m3ninx/index/segment/fst/encoding/docs/data_test.go index 792c107680..d2777dae92 100644 --- a/src/m3ninx/index/segment/fst/encoding/docs/data_test.go +++ b/src/m3ninx/index/segment/fst/encoding/docs/data_test.go @@ -24,10 +24,10 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/util" - - "github.com/stretchr/testify/require" ) var tests = []struct { diff --git a/src/m3ninx/index/segment/fst/encoding/docs/index_test.go b/src/m3ninx/index/segment/fst/encoding/docs/index_test.go index 3d5a73df48..5cea60d7dc 100644 --- a/src/m3ninx/index/segment/fst/encoding/docs/index_test.go +++ b/src/m3ninx/index/segment/fst/encoding/docs/index_test.go @@ -24,9 +24,9 @@ import ( "bytes" "testing" - "github.com/m3db/m3/src/m3ninx/postings" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/postings" ) func TestStoredFieldsIndex(t *testing.T) { diff --git a/src/m3ninx/index/segment/fst/fst_terms_iterator.go b/src/m3ninx/index/segment/fst/fst_terms_iterator.go index 091016af91..bd4cd1f201 100644 --- a/src/m3ninx/index/segment/fst/fst_terms_iterator.go +++ b/src/m3ninx/index/segment/fst/fst_terms_iterator.go @@ -21,10 +21,10 @@ package fst import ( + "github.com/m3dbx/vellum" + sgmt "github.com/m3db/m3/src/m3ninx/index/segment" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/m3dbx/vellum" ) type fstTermsIterOpts struct { diff --git a/src/m3ninx/index/segment/fst/fst_terms_postings_iterator.go b/src/m3ninx/index/segment/fst/fst_terms_postings_iterator.go index 28c9d8f5d3..2f1b8a06b7 100644 --- a/src/m3ninx/index/segment/fst/fst_terms_postings_iterator.go +++ b/src/m3ninx/index/segment/fst/fst_terms_postings_iterator.go @@ -21,11 +21,12 @@ package fst import ( + "github.com/m3dbx/pilosa/roaring" + "github.com/m3db/m3/src/m3ninx/generated/proto/fswriter" sgmt "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/postings" postingsroaring "github.com/m3db/m3/src/m3ninx/postings/roaring" - "github.com/m3dbx/pilosa/roaring" ) // postingsIterRoaringPoolingConfig uses a configuration that avoids allocating diff --git a/src/m3ninx/index/segment/fst/segment.go b/src/m3ninx/index/segment/fst/segment.go index b8608f0912..f491f6f963 100644 --- a/src/m3ninx/index/segment/fst/segment.go +++ b/src/m3ninx/index/segment/fst/segment.go @@ -26,6 +26,9 @@ import ( "io" "sync" + pilosaroaring "github.com/m3dbx/pilosa/roaring" + "github.com/m3dbx/vellum" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/generated/proto/fswriter" "github.com/m3db/m3/src/m3ninx/index" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/context" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/mmap" - - pilosaroaring "github.com/m3dbx/pilosa/roaring" - "github.com/m3dbx/vellum" ) var ( diff --git a/src/m3ninx/index/segment/fst/utils.go b/src/m3ninx/index/segment/fst/utils.go index d78f46b3f8..07b8c361bf 100644 --- a/src/m3ninx/index/segment/fst/utils.go +++ b/src/m3ninx/index/segment/fst/utils.go @@ -24,10 +24,10 @@ import ( "bytes" "testing" + "github.com/stretchr/testify/require" + sgmt "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/x/mmap" - - "github.com/stretchr/testify/require" ) // ToTestSegment returns a FST segment equivalent to the provide mutable segment. diff --git a/src/m3ninx/index/segment/fst/writer.go b/src/m3ninx/index/segment/fst/writer.go index c52b96943b..d236bec312 100644 --- a/src/m3ninx/index/segment/fst/writer.go +++ b/src/m3ninx/index/segment/fst/writer.go @@ -24,14 +24,14 @@ import ( "fmt" "io" + "github.com/golang/protobuf/proto" + "github.com/m3db/m3/src/m3ninx/generated/proto/fswriter" sgmt "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/fst/encoding" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/pilosa" "github.com/m3db/m3/src/m3ninx/x" - - "github.com/golang/protobuf/proto" ) var ( diff --git a/src/m3ninx/index/segment/fst/writer_reader_test.go b/src/m3ninx/index/segment/fst/writer_reader_test.go index 50339643db..a9fe5a724d 100644 --- a/src/m3ninx/index/segment/fst/writer_reader_test.go +++ b/src/m3ninx/index/segment/fst/writer_reader_test.go @@ -27,14 +27,14 @@ import ( "sync" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" sgmt "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/mem" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/util" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/m3ninx/index/segment/mem/concurrent_postings_map_test.go b/src/m3ninx/index/segment/mem/concurrent_postings_map_test.go index 6f18bf228a..72652313a3 100644 --- a/src/m3ninx/index/segment/mem/concurrent_postings_map_test.go +++ b/src/m3ninx/index/segment/mem/concurrent_postings_map_test.go @@ -25,9 +25,9 @@ import ( "sort" "testing" - sgmt "github.com/m3db/m3/src/m3ninx/index/segment" - "github.com/stretchr/testify/require" + + sgmt "github.com/m3db/m3/src/m3ninx/index/segment" ) func TestConcurrentPostingsMap(t *testing.T) { diff --git a/src/m3ninx/index/segment/mem/iterator_test.go b/src/m3ninx/index/segment/mem/iterator_test.go index 54c2a5a8a7..fe0ad42b97 100644 --- a/src/m3ninx/index/segment/mem/iterator_test.go +++ b/src/m3ninx/index/segment/mem/iterator_test.go @@ -23,10 +23,10 @@ package mem import ( "testing" - "github.com/m3db/m3/src/m3ninx/postings" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/postings" ) func TestIterator(t *testing.T) { diff --git a/src/m3ninx/index/segment/mem/merge_test.go b/src/m3ninx/index/segment/mem/merge_test.go index 8323863bcd..56bf06c7b0 100644 --- a/src/m3ninx/index/segment/mem/merge_test.go +++ b/src/m3ninx/index/segment/mem/merge_test.go @@ -23,10 +23,10 @@ package mem import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" - - "github.com/stretchr/testify/require" ) func TestMemSegmentMerge(t *testing.T) { diff --git a/src/m3ninx/index/segment/mem/reader_test.go b/src/m3ninx/index/segment/mem/reader_test.go index f82bfef96f..cda084aabc 100644 --- a/src/m3ninx/index/segment/mem/reader_test.go +++ b/src/m3ninx/index/segment/mem/reader_test.go @@ -24,13 +24,13 @@ import ( re "regexp" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestReaderMatchExact(t *testing.T) { diff --git a/src/m3ninx/index/segment/mem/segment_test.go b/src/m3ninx/index/segment/mem/segment_test.go index 7c2379b823..1d6c4bca49 100644 --- a/src/m3ninx/index/segment/mem/segment_test.go +++ b/src/m3ninx/index/segment/mem/segment_test.go @@ -24,11 +24,11 @@ import ( re "regexp" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" sgmt "github.com/m3db/m3/src/m3ninx/index/segment" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/m3ninx/index/segment/mem/terms_dict_test.go b/src/m3ninx/index/segment/mem/terms_dict_test.go index c1ec4e2f40..0fcf205727 100644 --- a/src/m3ninx/index/segment/mem/terms_dict_test.go +++ b/src/m3ninx/index/segment/mem/terms_dict_test.go @@ -26,13 +26,13 @@ import ( re "regexp" "testing" - "github.com/m3db/m3/src/m3ninx/doc" - "github.com/m3db/m3/src/m3ninx/postings" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" "github.com/stretchr/testify/suite" + + "github.com/m3db/m3/src/m3ninx/doc" + "github.com/m3db/m3/src/m3ninx/postings" ) var ( diff --git a/src/m3ninx/index/types.go b/src/m3ninx/index/types.go index 6203ac1591..038b7a042d 100644 --- a/src/m3ninx/index/types.go +++ b/src/m3ninx/index/types.go @@ -25,10 +25,11 @@ import ( "regexp" "regexp/syntax" + vregex "github.com/m3dbx/vellum/regexp" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/postings" xerrors "github.com/m3db/m3/src/x/errors" - vregex "github.com/m3dbx/vellum/regexp" ) // ErrDocNotFound is the error returned when there is no document for a given postings ID. diff --git a/src/m3ninx/persist/reader_test.go b/src/m3ninx/persist/reader_test.go index 7ee8de6bd0..1d06648c52 100644 --- a/src/m3ninx/persist/reader_test.go +++ b/src/m3ninx/persist/reader_test.go @@ -24,11 +24,11 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index/segment/fst" "github.com/m3db/m3/src/x/mmap" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestReaderValidateType(t *testing.T) { diff --git a/src/m3ninx/persist/writer_test.go b/src/m3ninx/persist/writer_test.go index 71619565fa..37ceb75844 100644 --- a/src/m3ninx/persist/writer_test.go +++ b/src/m3ninx/persist/writer_test.go @@ -24,11 +24,11 @@ import ( "io" "testing" - "github.com/m3db/m3/src/m3ninx/index/segment/fst" - xtest "github.com/m3db/m3/src/x/test" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/index/segment/fst" + xtest "github.com/m3db/m3/src/x/test" ) func newTestWriter(t *testing.T, ctrl *gomock.Controller) ( diff --git a/src/m3ninx/postings/pilosa/codec.go b/src/m3ninx/postings/pilosa/codec.go index 8c8998f7b1..7ad23dd3bf 100644 --- a/src/m3ninx/postings/pilosa/codec.go +++ b/src/m3ninx/postings/pilosa/codec.go @@ -23,9 +23,10 @@ package pilosa import ( "bytes" + "github.com/m3dbx/pilosa/roaring" + "github.com/m3db/m3/src/m3ninx/postings" idxroaring "github.com/m3db/m3/src/m3ninx/postings/roaring" - "github.com/m3dbx/pilosa/roaring" ) // Encoder helps serialize a Pilosa RoaringBitmap diff --git a/src/m3ninx/postings/pilosa/codec_test.go b/src/m3ninx/postings/pilosa/codec_test.go index dbcb212f29..68924ad826 100644 --- a/src/m3ninx/postings/pilosa/codec_test.go +++ b/src/m3ninx/postings/pilosa/codec_test.go @@ -23,10 +23,10 @@ package pilosa import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" - - "github.com/stretchr/testify/require" ) func TestEncodeDecode(t *testing.T) { diff --git a/src/m3ninx/postings/pilosa/iterator.go b/src/m3ninx/postings/pilosa/iterator.go index eb5e06fba5..d46513edba 100644 --- a/src/m3ninx/postings/pilosa/iterator.go +++ b/src/m3ninx/postings/pilosa/iterator.go @@ -21,8 +21,9 @@ package pilosa import ( - "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3dbx/pilosa/roaring" + + "github.com/m3db/m3/src/m3ninx/postings" ) // NB: need to do this to find a path into our postings list which doesn't require every diff --git a/src/m3ninx/postings/pilosa/iterator_test.go b/src/m3ninx/postings/pilosa/iterator_test.go index d41d045e31..401d3b6c33 100644 --- a/src/m3ninx/postings/pilosa/iterator_test.go +++ b/src/m3ninx/postings/pilosa/iterator_test.go @@ -23,10 +23,10 @@ package pilosa import ( "testing" - "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3dbx/pilosa/roaring" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/postings" ) func TestIterator(t *testing.T) { diff --git a/src/m3ninx/postings/roaring/roaring.go b/src/m3ninx/postings/roaring/roaring.go index de2f69976b..47732a281f 100644 --- a/src/m3ninx/postings/roaring/roaring.go +++ b/src/m3ninx/postings/roaring/roaring.go @@ -24,10 +24,10 @@ import ( "errors" "fmt" + "github.com/m3dbx/pilosa/roaring" + "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/x" - - "github.com/m3dbx/pilosa/roaring" ) var ( diff --git a/src/m3ninx/postings/roaring/roaring_test.go b/src/m3ninx/postings/roaring/roaring_test.go index e9e3178cb0..dc6d842855 100644 --- a/src/m3ninx/postings/roaring/roaring_test.go +++ b/src/m3ninx/postings/roaring/roaring_test.go @@ -23,10 +23,10 @@ package roaring import ( "testing" - "github.com/m3db/m3/src/m3ninx/postings" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/postings" ) func TestRoaringPostingsListEmpty(t *testing.T) { diff --git a/src/m3ninx/search/executor/executor_test.go b/src/m3ninx/search/executor/executor_test.go index bfe455c186..abbaf29d48 100644 --- a/src/m3ninx/search/executor/executor_test.go +++ b/src/m3ninx/search/executor/executor_test.go @@ -23,13 +23,13 @@ package executor import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/x/context" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) type testIterator struct{} diff --git a/src/m3ninx/search/executor/iterator_test.go b/src/m3ninx/search/executor/iterator_test.go index 8eaeccd898..66d09b6d6f 100644 --- a/src/m3ninx/search/executor/iterator_test.go +++ b/src/m3ninx/search/executor/iterator_test.go @@ -24,14 +24,14 @@ import ( "fmt" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings/roaring" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/x/context" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestIterator(t *testing.T) { diff --git a/src/m3ninx/search/proptest/concurrent_test.go b/src/m3ninx/search/proptest/concurrent_test.go index 19de6b1550..d435c6c812 100644 --- a/src/m3ninx/search/proptest/concurrent_test.go +++ b/src/m3ninx/search/proptest/concurrent_test.go @@ -27,15 +27,15 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment/fst" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/m3ninx/search/executor" "github.com/m3db/m3/src/x/context" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/require" ) func TestConcurrentQueries(t *testing.T) { diff --git a/src/m3ninx/search/proptest/issue865_test.go b/src/m3ninx/search/proptest/issue865_test.go index 15050e490b..7833b65300 100644 --- a/src/m3ninx/search/proptest/issue865_test.go +++ b/src/m3ninx/search/proptest/issue865_test.go @@ -1,3 +1,4 @@ +//go:build big // +build big // Copyright (c) 2018 Uber Technologies, Inc. @@ -28,16 +29,16 @@ import ( "testing" "time" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/m3ninx/search/executor" "github.com/m3db/m3/src/m3ninx/search/query" "github.com/m3db/m3/src/x/context" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/require" ) // NB(prateek): this test simulates the issues described in issue: https://github.com/m3db/m3/issues/865 diff --git a/src/m3ninx/search/proptest/prop_test.go b/src/m3ninx/search/proptest/prop_test.go index c1929b8424..2dd7aff179 100644 --- a/src/m3ninx/search/proptest/prop_test.go +++ b/src/m3ninx/search/proptest/prop_test.go @@ -1,3 +1,4 @@ +//go:build big // +build big // Copyright (c) 2018 Uber Technologies, Inc. @@ -28,16 +29,15 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/context" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/prop" + "github.com/stretchr/testify/require" "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/index/segment/fst" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/m3ninx/search/executor" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/prop" - "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/context" ) func TestSegmentDistributionDoesNotAffectQuery(t *testing.T) { diff --git a/src/m3ninx/search/proptest/query_gen.go b/src/m3ninx/search/proptest/query_gen.go index ed3c06e13e..5ff81a682a 100644 --- a/src/m3ninx/search/proptest/query_gen.go +++ b/src/m3ninx/search/proptest/query_gen.go @@ -24,12 +24,12 @@ import ( "bytes" "reflect" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/search" "github.com/m3db/m3/src/m3ninx/search/query" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" ) // GenAllQuery generates an all query. diff --git a/src/m3ninx/search/proptest/segment_gen.go b/src/m3ninx/search/proptest/segment_gen.go index 2b62319c6f..af970d2124 100644 --- a/src/m3ninx/search/proptest/segment_gen.go +++ b/src/m3ninx/search/proptest/segment_gen.go @@ -25,14 +25,14 @@ import ( "math/rand" "testing" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/m3ninx/index/segment" "github.com/m3db/m3/src/m3ninx/index/segment/fst" "github.com/m3db/m3/src/m3ninx/index/segment/mem" - - "github.com/leanovate/gopter" - "github.com/leanovate/gopter/gen" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/m3ninx/search/query/all_test.go b/src/m3ninx/search/query/all_test.go index a919bc7ef7..60d85cb5df 100644 --- a/src/m3ninx/search/query/all_test.go +++ b/src/m3ninx/search/query/all_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestAllQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/codec_test.go b/src/m3ninx/search/query/codec_test.go index 7e6dc2a227..debfe8a539 100644 --- a/src/m3ninx/search/query/codec_test.go +++ b/src/m3ninx/search/query/codec_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestMarshal(t *testing.T) { diff --git a/src/m3ninx/search/query/conjunction_test.go b/src/m3ninx/search/query/conjunction_test.go index 77443a6758..be60d06652 100644 --- a/src/m3ninx/search/query/conjunction_test.go +++ b/src/m3ninx/search/query/conjunction_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestConjunctionQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/disjunction_test.go b/src/m3ninx/search/query/disjunction_test.go index e2b5f675cc..bb7b7ceaf4 100644 --- a/src/m3ninx/search/query/disjunction_test.go +++ b/src/m3ninx/search/query/disjunction_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestDisjunctionQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/field_test.go b/src/m3ninx/search/query/field_test.go index 3f14695017..f9e10f56cf 100644 --- a/src/m3ninx/search/query/field_test.go +++ b/src/m3ninx/search/query/field_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestFieldQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/negation_test.go b/src/m3ninx/search/query/negation_test.go index ab8b9cbee6..99b5ba3c54 100644 --- a/src/m3ninx/search/query/negation_test.go +++ b/src/m3ninx/search/query/negation_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestNegationQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/regexp_test.go b/src/m3ninx/search/query/regexp_test.go index 4a89c0f8e8..4571eade22 100644 --- a/src/m3ninx/search/query/regexp_test.go +++ b/src/m3ninx/search/query/regexp_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestRegexpQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/term_test.go b/src/m3ninx/search/query/term_test.go index 44a6ba5602..b77bbbe260 100644 --- a/src/m3ninx/search/query/term_test.go +++ b/src/m3ninx/search/query/term_test.go @@ -23,9 +23,9 @@ package query import ( "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestTermQuery(t *testing.T) { diff --git a/src/m3ninx/search/query/util_test.go b/src/m3ninx/search/query/util_test.go index 56915c410f..36218602f2 100644 --- a/src/m3ninx/search/query/util_test.go +++ b/src/m3ninx/search/query/util_test.go @@ -24,10 +24,10 @@ import ( "strings" "testing" - "github.com/m3db/m3/src/m3ninx/search" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/search" ) func TestJoin(t *testing.T) { diff --git a/src/m3ninx/search/searcher/all_test.go b/src/m3ninx/search/searcher/all_test.go index c4cedbaaac..1c965ca54d 100644 --- a/src/m3ninx/search/searcher/all_test.go +++ b/src/m3ninx/search/searcher/all_test.go @@ -23,11 +23,11 @@ package searcher import ( "testing" - "github.com/m3db/m3/src/m3ninx/index" - "github.com/m3db/m3/src/m3ninx/postings/roaring" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/index" + "github.com/m3db/m3/src/m3ninx/postings/roaring" ) func TestAllSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/conjunction_test.go b/src/m3ninx/search/searcher/conjunction_test.go index f69b378dc6..52b924d373 100644 --- a/src/m3ninx/search/searcher/conjunction_test.go +++ b/src/m3ninx/search/searcher/conjunction_test.go @@ -23,13 +23,13 @@ package searcher import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" "github.com/m3db/m3/src/m3ninx/search" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestConjunctionSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/disjunction_test.go b/src/m3ninx/search/searcher/disjunction_test.go index a789191bbb..6f6703f1f5 100644 --- a/src/m3ninx/search/searcher/disjunction_test.go +++ b/src/m3ninx/search/searcher/disjunction_test.go @@ -23,13 +23,13 @@ package searcher import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" "github.com/m3db/m3/src/m3ninx/search" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestDisjunctionSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/empty_test.go b/src/m3ninx/search/searcher/empty_test.go index 69c2b71b05..2bfafdf15b 100644 --- a/src/m3ninx/search/searcher/empty_test.go +++ b/src/m3ninx/search/searcher/empty_test.go @@ -23,11 +23,11 @@ package searcher import ( "testing" - "github.com/m3db/m3/src/m3ninx/index" - "github.com/m3db/m3/src/m3ninx/postings/roaring" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/m3ninx/index" + "github.com/m3db/m3/src/m3ninx/postings/roaring" ) func TestEmptySearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/field_test.go b/src/m3ninx/search/searcher/field_test.go index d640122611..d4137fd8b4 100644 --- a/src/m3ninx/search/searcher/field_test.go +++ b/src/m3ninx/search/searcher/field_test.go @@ -23,12 +23,12 @@ package searcher import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestFieldSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/negation_test.go b/src/m3ninx/search/searcher/negation_test.go index f3ccfd18ad..a364df63b3 100644 --- a/src/m3ninx/search/searcher/negation_test.go +++ b/src/m3ninx/search/searcher/negation_test.go @@ -23,13 +23,13 @@ package searcher import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" "github.com/m3db/m3/src/m3ninx/search" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestNegationSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/regexp_test.go b/src/m3ninx/search/searcher/regexp_test.go index 72b2773940..2753107bf9 100644 --- a/src/m3ninx/search/searcher/regexp_test.go +++ b/src/m3ninx/search/searcher/regexp_test.go @@ -24,12 +24,12 @@ import ( re "regexp" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestRegexpSearcher(t *testing.T) { diff --git a/src/m3ninx/search/searcher/term_test.go b/src/m3ninx/search/searcher/term_test.go index adb8a18254..84bcbed298 100644 --- a/src/m3ninx/search/searcher/term_test.go +++ b/src/m3ninx/search/searcher/term_test.go @@ -23,12 +23,12 @@ package searcher import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/index" "github.com/m3db/m3/src/m3ninx/postings" "github.com/m3db/m3/src/m3ninx/postings/roaring" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestTermSearcher(t *testing.T) { diff --git a/src/metrics/aggregation/id_compress_test.go b/src/metrics/aggregation/id_compress_test.go index 426148d58e..b300b17418 100644 --- a/src/metrics/aggregation/id_compress_test.go +++ b/src/metrics/aggregation/id_compress_test.go @@ -23,9 +23,9 @@ package aggregation import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestIDCompressRoundTrip(t *testing.T) { diff --git a/src/metrics/aggregation/id_test.go b/src/metrics/aggregation/id_test.go index 9e2615c3f9..a907407351 100644 --- a/src/metrics/aggregation/id_test.go +++ b/src/metrics/aggregation/id_test.go @@ -24,12 +24,12 @@ import ( "encoding/json" "testing" - "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" - "github.com/m3db/m3/src/x/test/testmarshal" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" - "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" + "github.com/m3db/m3/src/x/test/testmarshal" ) var ( diff --git a/src/metrics/aggregation/type_config_test.go b/src/metrics/aggregation/type_config_test.go index d0828d68df..2f06b4279f 100644 --- a/src/metrics/aggregation/type_config_test.go +++ b/src/metrics/aggregation/type_config_test.go @@ -23,10 +23,10 @@ package aggregation import ( "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/instrument" ) func TestTypesConfiguration(t *testing.T) { diff --git a/src/metrics/aggregation/type_test.go b/src/metrics/aggregation/type_test.go index 29d9fc3d55..455b0261a5 100644 --- a/src/metrics/aggregation/type_test.go +++ b/src/metrics/aggregation/type_test.go @@ -25,11 +25,11 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/m3db/m3/src/x/test/testmarshal" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/pool" + "github.com/m3db/m3/src/x/test/testmarshal" ) func TestTypeIsValid(t *testing.T) { diff --git a/src/metrics/aggregation/types_options_test.go b/src/metrics/aggregation/types_options_test.go index ec7080c004..f99963ebe2 100644 --- a/src/metrics/aggregation/types_options_test.go +++ b/src/metrics/aggregation/types_options_test.go @@ -24,9 +24,9 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestTypesOptionsValidateDefault(t *testing.T) { diff --git a/src/metrics/aggregation/types_pool_test.go b/src/metrics/aggregation/types_pool_test.go index a6172586fc..bd3170b3d0 100644 --- a/src/metrics/aggregation/types_pool_test.go +++ b/src/metrics/aggregation/types_pool_test.go @@ -23,9 +23,9 @@ package aggregation import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestTypesPool(t *testing.T) { diff --git a/src/metrics/carbon/parser.go b/src/metrics/carbon/parser.go index 59763cba0b..48d5731d92 100644 --- a/src/metrics/carbon/parser.go +++ b/src/metrics/carbon/parser.go @@ -31,10 +31,10 @@ import ( "time" "unicode/utf8" + "go.uber.org/zap" + "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/unsafe" - - "go.uber.org/zap" ) const ( diff --git a/src/metrics/carbon/parser_test.go b/src/metrics/carbon/parser_test.go index 383f48a2b2..8d11d5a358 100644 --- a/src/metrics/carbon/parser_test.go +++ b/src/metrics/carbon/parser_test.go @@ -28,10 +28,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/instrument" ) var ( diff --git a/src/metrics/encoding/protobuf/aggregated_decoder_pool_test.go b/src/metrics/encoding/protobuf/aggregated_decoder_pool_test.go index cd7fcf8b6f..e704b77a1d 100644 --- a/src/metrics/encoding/protobuf/aggregated_decoder_pool_test.go +++ b/src/metrics/encoding/protobuf/aggregated_decoder_pool_test.go @@ -23,9 +23,9 @@ package protobuf import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestAggregatedDecoderPool(t *testing.T) { diff --git a/src/metrics/encoding/protobuf/aggregated_roundtrip_test.go b/src/metrics/encoding/protobuf/aggregated_roundtrip_test.go index 02a8fe437e..3b085f29da 100644 --- a/src/metrics/encoding/protobuf/aggregated_roundtrip_test.go +++ b/src/metrics/encoding/protobuf/aggregated_roundtrip_test.go @@ -23,12 +23,12 @@ package protobuf import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/encoding/protobuf/buffer_test.go b/src/metrics/encoding/protobuf/buffer_test.go index df6552ef20..5f7ce8bf17 100644 --- a/src/metrics/encoding/protobuf/buffer_test.go +++ b/src/metrics/encoding/protobuf/buffer_test.go @@ -23,9 +23,9 @@ package protobuf import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestBufferWithPool(t *testing.T) { diff --git a/src/metrics/encoding/protobuf/reset_test.go b/src/metrics/encoding/protobuf/reset_test.go index e44227bb01..ce565dbd44 100644 --- a/src/metrics/encoding/protobuf/reset_test.go +++ b/src/metrics/encoding/protobuf/reset_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" "github.com/m3db/m3/src/metrics/generated/proto/pipelinepb" "github.com/m3db/m3/src/metrics/generated/proto/policypb" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/encoding/protobuf/unaggregated_encoder_test.go b/src/metrics/encoding/protobuf/unaggregated_encoder_test.go index d00f06dd4e..b7c056e0b8 100644 --- a/src/metrics/encoding/protobuf/unaggregated_encoder_test.go +++ b/src/metrics/encoding/protobuf/unaggregated_encoder_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/encoding" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/encoding/protobuf/unaggregated_iterator_test.go b/src/metrics/encoding/protobuf/unaggregated_iterator_test.go index 4b4bf9f673..2723703e4e 100644 --- a/src/metrics/encoding/protobuf/unaggregated_iterator_test.go +++ b/src/metrics/encoding/protobuf/unaggregated_iterator_test.go @@ -27,12 +27,12 @@ import ( "strings" "testing" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/encoding" "github.com/m3db/m3/src/metrics/metric/aggregated" "github.com/m3db/m3/src/metrics/metric/unaggregated" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" ) func TestUnaggregatedIteratorDecodeCounterWithMetadatas(t *testing.T) { diff --git a/src/metrics/encoding/protobuf/unaggregated_options_test.go b/src/metrics/encoding/protobuf/unaggregated_options_test.go index 764abbde95..edad085d0f 100644 --- a/src/metrics/encoding/protobuf/unaggregated_options_test.go +++ b/src/metrics/encoding/protobuf/unaggregated_options_test.go @@ -23,9 +23,9 @@ package protobuf import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestDefaultUnaggregatedOptions(t *testing.T) { diff --git a/src/metrics/filters/filter_benchmark_test.go b/src/metrics/filters/filter_benchmark_test.go index c79dfa75ef..0f4c708fd7 100644 --- a/src/metrics/filters/filter_benchmark_test.go +++ b/src/metrics/filters/filter_benchmark_test.go @@ -25,9 +25,9 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/metrics/metric/id" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/metrics/metric/id" ) var ( diff --git a/src/metrics/generated/proto/pipelinepb/custom_unmarshal.go b/src/metrics/generated/proto/pipelinepb/custom_unmarshal.go index 2cb76e15ee..d5c226795e 100644 --- a/src/metrics/generated/proto/pipelinepb/custom_unmarshal.go +++ b/src/metrics/generated/proto/pipelinepb/custom_unmarshal.go @@ -133,4 +133,4 @@ func (m *AppliedPipelineOp) reuse() { func (m *AppliedRollupOp) reuse() { m.Id = m.Id[:0] m.AggregationId = aggregationpb.AggregationID{} -} \ No newline at end of file +} diff --git a/src/metrics/integration/match_rule_update_stress_test.go b/src/metrics/integration/match_rule_update_stress_test.go index e61d59f21c..d72ec95255 100644 --- a/src/metrics/integration/match_rule_update_stress_test.go +++ b/src/metrics/integration/match_rule_update_stress_test.go @@ -1,3 +1,4 @@ +//go:build integration // +build integration // Copyright (c) 2017 Uber Technologies, Inc. @@ -29,6 +30,11 @@ import ( "testing" "time" + "github.com/golang/protobuf/proto" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/metrics/aggregation" @@ -45,11 +51,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/x/pool" - - "github.com/golang/protobuf/proto" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/matcher/cache/cache.go b/src/metrics/matcher/cache/cache.go index 47f480727d..d188895907 100644 --- a/src/metrics/matcher/cache/cache.go +++ b/src/metrics/matcher/cache/cache.go @@ -26,12 +26,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/matcher/namespace" "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/x/clock" - - "github.com/uber-go/tally" ) const ( diff --git a/src/metrics/matcher/cache/cache_test.go b/src/metrics/matcher/cache/cache_test.go index e7ad57e119..c879e6de55 100644 --- a/src/metrics/matcher/cache/cache_test.go +++ b/src/metrics/matcher/cache/cache_test.go @@ -29,12 +29,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/matcher/namespace" "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/x/clock" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/matcher/cache/config_test.go b/src/metrics/matcher/cache/config_test.go index 0ffc50fe97..a7d7f183db 100644 --- a/src/metrics/matcher/cache/config_test.go +++ b/src/metrics/matcher/cache/config_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) func TestConfig(t *testing.T) { diff --git a/src/metrics/matcher/cache/list_test.go b/src/metrics/matcher/cache/list_test.go index 1224747c88..166bfafb0b 100644 --- a/src/metrics/matcher/cache/list_test.go +++ b/src/metrics/matcher/cache/list_test.go @@ -26,6 +26,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/matcher/namespace" "github.com/m3db/m3/src/metrics/metadata" @@ -33,8 +35,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/rules" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/matcher/config.go b/src/metrics/matcher/config.go index 08d2b0ccc5..c1fe83df2f 100644 --- a/src/metrics/matcher/config.go +++ b/src/metrics/matcher/config.go @@ -24,6 +24,8 @@ import ( "fmt" "time" + murmur3 "github.com/m3db/stackmurmur3/v2" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/metrics/filters" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/pool" - - murmur3 "github.com/m3db/stackmurmur3/v2" ) // Configuration is config used to create a Matcher. diff --git a/src/metrics/matcher/config_test.go b/src/metrics/matcher/config_test.go index 8b72e4157d..d70b813543 100644 --- a/src/metrics/matcher/config_test.go +++ b/src/metrics/matcher/config_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestConfigurationNewNamespaces(t *testing.T) { diff --git a/src/metrics/matcher/namespaces.go b/src/metrics/matcher/namespaces.go index ce693fa88b..0b8dcae307 100644 --- a/src/metrics/matcher/namespaces.go +++ b/src/metrics/matcher/namespaces.go @@ -25,6 +25,9 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/util/runtime" "github.com/m3db/m3/src/metrics/aggregation" @@ -38,9 +41,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" xos "github.com/m3db/m3/src/x/os" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/metrics/matcher/namespaces_test.go b/src/metrics/matcher/namespaces_test.go index 4426fd5a39..ceac9a613d 100644 --- a/src/metrics/matcher/namespaces_test.go +++ b/src/metrics/matcher/namespaces_test.go @@ -28,6 +28,9 @@ import ( "testing" "time" + "github.com/golang/protobuf/proto" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/metrics/generated/proto/rulepb" @@ -35,9 +38,6 @@ import ( "github.com/m3db/m3/src/metrics/matcher/namespace" "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/rules" - - "github.com/golang/protobuf/proto" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/matcher/ruleset.go b/src/metrics/matcher/ruleset.go index bfd34823c6..b14a42d657 100644 --- a/src/metrics/matcher/ruleset.go +++ b/src/metrics/matcher/ruleset.go @@ -26,6 +26,8 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/util/runtime" "github.com/m3db/m3/src/metrics/aggregation" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/uber-go/tally" ) // RuleSet manages runtime updates to registered rules and provides diff --git a/src/metrics/matcher/ruleset_test.go b/src/metrics/matcher/ruleset_test.go index 7adba9cd2e..2bbb487e73 100644 --- a/src/metrics/matcher/ruleset_test.go +++ b/src/metrics/matcher/ruleset_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/metrics/aggregation" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/metrics/rules/view" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/metadata/metadata_test.go b/src/metrics/metadata/metadata_test.go index 19f07f52b7..644ee2d19d 100644 --- a/src/metrics/metadata/metadata_test.go +++ b/src/metrics/metadata/metadata_test.go @@ -26,6 +26,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" @@ -37,8 +39,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/metric/aggregated/types_test.go b/src/metrics/metric/aggregated/types_test.go index 65d0327a0b..3d1cb3c95e 100644 --- a/src/metrics/metric/aggregated/types_test.go +++ b/src/metrics/metric/aggregated/types_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" @@ -37,9 +40,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/metric/id/m3/id_test.go b/src/metrics/metric/id/m3/id_test.go index 189b4c2de3..13e626500a 100644 --- a/src/metrics/metric/id/m3/id_test.go +++ b/src/metrics/metric/id/m3/id_test.go @@ -23,10 +23,10 @@ package m3 import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/metric/id" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestNewRollupID(t *testing.T) { diff --git a/src/metrics/metric/types_test.go b/src/metrics/metric/types_test.go index 26852098ef..51cff2623c 100644 --- a/src/metrics/metric/types_test.go +++ b/src/metrics/metric/types_test.go @@ -23,10 +23,10 @@ package metric import ( "testing" - "github.com/m3db/m3/src/metrics/generated/proto/metricpb" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/metrics/generated/proto/metricpb" ) func TestTypeUnmarshalYAML(t *testing.T) { diff --git a/src/metrics/metric/unaggregated/types_test.go b/src/metrics/metric/unaggregated/types_test.go index a957829283..6d8a38d306 100644 --- a/src/metrics/metric/unaggregated/types_test.go +++ b/src/metrics/metric/unaggregated/types_test.go @@ -24,6 +24,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" @@ -37,8 +39,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/pipeline/applied/type_test.go b/src/metrics/pipeline/applied/type_test.go index b8400918eb..86bdcf68a6 100644 --- a/src/metrics/pipeline/applied/type_test.go +++ b/src/metrics/pipeline/applied/type_test.go @@ -24,15 +24,15 @@ import ( "fmt" "testing" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/pipelinepb" "github.com/m3db/m3/src/metrics/generated/proto/transformationpb" "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/transformation" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/pipeline/type_test.go b/src/metrics/pipeline/type_test.go index 0c354c5ebf..cd45fe0421 100644 --- a/src/metrics/pipeline/type_test.go +++ b/src/metrics/pipeline/type_test.go @@ -24,15 +24,15 @@ import ( "encoding/json" "testing" + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/pipelinepb" "github.com/m3db/m3/src/metrics/generated/proto/transformationpb" "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/metrics/x/bytes" "github.com/m3db/m3/src/x/test/testmarshal" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" ) var ( diff --git a/src/metrics/policy/drop_policy_test.go b/src/metrics/policy/drop_policy_test.go index 8a8986669b..d70501d27b 100644 --- a/src/metrics/policy/drop_policy_test.go +++ b/src/metrics/policy/drop_policy_test.go @@ -25,10 +25,11 @@ import ( "math" "testing" - "github.com/m3db/m3/src/x/test/testmarshal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/test/testmarshal" ) func TestDropPolicyIsDefault(t *testing.T) { diff --git a/src/metrics/policy/policy_test.go b/src/metrics/policy/policy_test.go index 11709ba9b7..65abfc5736 100644 --- a/src/metrics/policy/policy_test.go +++ b/src/metrics/policy/policy_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/policypb" "github.com/m3db/m3/src/x/test/testmarshal" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) func TestPolicyString(t *testing.T) { diff --git a/src/metrics/policy/resolution_test.go b/src/metrics/policy/resolution_test.go index 9767ca0b0e..58cb6f9908 100644 --- a/src/metrics/policy/resolution_test.go +++ b/src/metrics/policy/resolution_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/require" + + xtime "github.com/m3db/m3/src/x/time" ) func TestValidResolutionValue(t *testing.T) { diff --git a/src/metrics/policy/staged_policy_test.go b/src/metrics/policy/staged_policy_test.go index f88b38748d..eea3db360d 100644 --- a/src/metrics/policy/staged_policy_test.go +++ b/src/metrics/policy/staged_policy_test.go @@ -25,10 +25,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestStagedPoliciesHasDefaultPolicies(t *testing.T) { diff --git a/src/metrics/policy/storage_policy_test.go b/src/metrics/policy/storage_policy_test.go index f00f67928d..e922d3c8f1 100644 --- a/src/metrics/policy/storage_policy_test.go +++ b/src/metrics/policy/storage_policy_test.go @@ -26,12 +26,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/metrics/generated/proto/policypb" "github.com/m3db/m3/src/x/test/testmarshal" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) var ( diff --git a/src/metrics/rules/active_ruleset.go b/src/metrics/rules/active_ruleset.go index ca0cab7223..851f73b8cf 100644 --- a/src/metrics/rules/active_ruleset.go +++ b/src/metrics/rules/active_ruleset.go @@ -25,6 +25,8 @@ import ( "fmt" "sort" + murmur3 "github.com/m3db/stackmurmur3/v2" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/filters" "github.com/m3db/m3/src/metrics/metadata" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/query/models" xerrors "github.com/m3db/m3/src/x/errors" - - murmur3 "github.com/m3db/stackmurmur3/v2" ) type activeRuleSet struct { diff --git a/src/metrics/rules/active_ruleset_test.go b/src/metrics/rules/active_ruleset_test.go index 744022c8b8..aa1bf731f1 100644 --- a/src/metrics/rules/active_ruleset_test.go +++ b/src/metrics/rules/active_ruleset_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/filters" "github.com/m3db/m3/src/metrics/matcher/namespace" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/rules/convert_test.go b/src/metrics/rules/convert_test.go index 3f6512e426..c698392ff9 100644 --- a/src/metrics/rules/convert_test.go +++ b/src/metrics/rules/convert_test.go @@ -25,13 +25,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/policypb" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestToAggregationIDAndStoragePoliciesNilPolicyProto(t *testing.T) { diff --git a/src/metrics/rules/mapping.go b/src/metrics/rules/mapping.go index caf071616f..baa9096340 100644 --- a/src/metrics/rules/mapping.go +++ b/src/metrics/rules/mapping.go @@ -26,6 +26,8 @@ import ( "fmt" "time" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/metrics/aggregation" merrors "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/filters" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/query/models" - - "github.com/pborman/uuid" ) const ( diff --git a/src/metrics/rules/mapping_test.go b/src/metrics/rules/mapping_test.go index 5809e739ce..813a4ae482 100644 --- a/src/metrics/rules/mapping_test.go +++ b/src/metrics/rules/mapping_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/filters" @@ -36,10 +40,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/rules/match_result_test.go b/src/metrics/rules/match_result_test.go index cf98331c87..55bd6701b6 100644 --- a/src/metrics/rules/match_result_test.go +++ b/src/metrics/rules/match_result_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/metadata" "github.com/m3db/m3/src/metrics/policy" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestMatchResultProperties(t *testing.T) { diff --git a/src/metrics/rules/namespace_test.go b/src/metrics/rules/namespace_test.go index 7452f67c33..350a91a9b1 100644 --- a/src/metrics/rules/namespace_test.go +++ b/src/metrics/rules/namespace_test.go @@ -23,10 +23,10 @@ package rules import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/generated/proto/rulepb" "github.com/m3db/m3/src/metrics/rules/view" - - "github.com/stretchr/testify/require" ) func TestNewNamespaceSnapshotFromNilProto(t *testing.T) { diff --git a/src/metrics/rules/rollup.go b/src/metrics/rules/rollup.go index e765074825..d7d3184905 100644 --- a/src/metrics/rules/rollup.go +++ b/src/metrics/rules/rollup.go @@ -24,14 +24,14 @@ import ( "errors" "fmt" + "github.com/pborman/uuid" + merrors "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/filters" "github.com/m3db/m3/src/metrics/generated/proto/metricpb" "github.com/m3db/m3/src/metrics/generated/proto/rulepb" "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/query/models" - - "github.com/pborman/uuid" ) var ( diff --git a/src/metrics/rules/rollup_target_test.go b/src/metrics/rules/rollup_target_test.go index f73aa7a3c1..448d5b222b 100644 --- a/src/metrics/rules/rollup_target_test.go +++ b/src/metrics/rules/rollup_target_test.go @@ -24,6 +24,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" "github.com/m3db/m3/src/metrics/generated/proto/pipelinepb" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestNewRollupTargetV1ProtoNilProto(t *testing.T) { diff --git a/src/metrics/rules/rollup_test.go b/src/metrics/rules/rollup_test.go index 31657b0206..95380b6468 100644 --- a/src/metrics/rules/rollup_test.go +++ b/src/metrics/rules/rollup_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/filters" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/metrics/transformation" "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/metrics/rules/ruleset.go b/src/metrics/rules/ruleset.go index b9937d57c3..29a0ef0b5f 100644 --- a/src/metrics/rules/ruleset.go +++ b/src/metrics/rules/ruleset.go @@ -27,6 +27,8 @@ import ( "sort" "time" + "github.com/pborman/uuid" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/metrics/aggregation" merrors "github.com/m3db/m3/src/metrics/errors" @@ -37,8 +39,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/metrics/rules/view/changes" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/pborman/uuid" ) const ( diff --git a/src/metrics/rules/ruleset_test.go b/src/metrics/rules/ruleset_test.go index 0a6e2bf9b0..3324fdab9d 100644 --- a/src/metrics/rules/ruleset_test.go +++ b/src/metrics/rules/ruleset_test.go @@ -26,6 +26,11 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/stretchr/testify/require" + "github.com/twmb/murmur3" + "github.com/m3db/m3/src/metrics/aggregation" merrors "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/filters" @@ -46,11 +51,6 @@ import ( "github.com/m3db/m3/src/query/models" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/stretchr/testify/require" - "github.com/twmb/murmur3" ) var ( diff --git a/src/metrics/rules/store/kv/store_test.go b/src/metrics/rules/store/kv/store_test.go index 3e0d408249..af26a153ef 100644 --- a/src/metrics/rules/store/kv/store_test.go +++ b/src/metrics/rules/store/kv/store_test.go @@ -26,6 +26,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv/mem" merrors "github.com/m3db/m3/src/metrics/errors" "github.com/m3db/m3/src/metrics/generated/proto/aggregationpb" @@ -35,8 +37,6 @@ import ( "github.com/m3db/m3/src/metrics/generated/proto/rulepb" "github.com/m3db/m3/src/metrics/rules" "github.com/m3db/m3/src/metrics/rules/view" - - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/rules/validator/config_test.go b/src/metrics/rules/validator/config_test.go index b526461c81..afafb0ec5e 100644 --- a/src/metrics/rules/validator/config_test.go +++ b/src/metrics/rules/validator/config_test.go @@ -23,6 +23,10 @@ package validator import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" @@ -30,10 +34,6 @@ import ( "github.com/m3db/m3/src/metrics/filters" "github.com/m3db/m3/src/metrics/metric" "github.com/m3db/m3/src/metrics/policy" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) func TestNamespaceValidatorConfigurationNoConfigurationProvided(t *testing.T) { diff --git a/src/metrics/rules/validator/namespace/kv/config_test.go b/src/metrics/rules/validator/namespace/kv/config_test.go index d112ffbc8e..bc369f89ab 100644 --- a/src/metrics/rules/validator/namespace/kv/config_test.go +++ b/src/metrics/rules/validator/namespace/kv/config_test.go @@ -23,15 +23,15 @@ package kv import ( "testing" - "github.com/m3db/m3/src/cluster/client" - "github.com/m3db/m3/src/cluster/generated/proto/commonpb" - "github.com/m3db/m3/src/cluster/kv" - "github.com/m3db/m3/src/cluster/kv/mem" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" gvalidator "gopkg.in/validator.v2" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/cluster/client" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" + "github.com/m3db/m3/src/cluster/kv" + "github.com/m3db/m3/src/cluster/kv/mem" ) func TestNamespaceValidatorConfiguration(t *testing.T) { diff --git a/src/metrics/rules/validator/namespace/kv/validator.go b/src/metrics/rules/validator/namespace/kv/validator.go index 391301d794..77ba70ed85 100644 --- a/src/metrics/rules/validator/namespace/kv/validator.go +++ b/src/metrics/rules/validator/namespace/kv/validator.go @@ -26,11 +26,11 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/kv" kvutil "github.com/m3db/m3/src/cluster/kv/util" "github.com/m3db/m3/src/metrics/rules/validator/namespace" - - "go.uber.org/zap" ) var ( diff --git a/src/metrics/rules/validator/namespace/kv/validator_test.go b/src/metrics/rules/validator/namespace/kv/validator_test.go index d33c2c738c..2f317ab9d9 100644 --- a/src/metrics/rules/validator/namespace/kv/validator_test.go +++ b/src/metrics/rules/validator/namespace/kv/validator_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/rules/validator/validator.go b/src/metrics/rules/validator/validator.go index 485baf2238..0d1000a643 100644 --- a/src/metrics/rules/validator/validator.go +++ b/src/metrics/rules/validator/validator.go @@ -277,14 +277,14 @@ func (v *validator) validateStoragePolicies( } // validatePipeline validates the rollup pipeline as follows: -// * The pipeline must contain at least one operation. -// * The pipeline can contain at most one aggregation operation, and if there is one, -// it must be the first operation. -// * The pipeline can contain arbitrary number of transformation operations. However, -// the transformation derivative order computed from the list of transformations must -// be no more than the maximum transformation derivative order that is supported. -// * The pipeline must contain at least one rollup operation and at most `n` rollup operations, -// where `n` is the maximum supported number of rollup levels. +// - The pipeline must contain at least one operation. +// - The pipeline can contain at most one aggregation operation, and if there is one, +// it must be the first operation. +// - The pipeline can contain arbitrary number of transformation operations. However, +// the transformation derivative order computed from the list of transformations must +// be no more than the maximum transformation derivative order that is supported. +// - The pipeline must contain at least one rollup operation and at most `n` rollup operations, +// where `n` is the maximum supported number of rollup levels. func (v *validator) validatePipeline(pipeline mpipeline.Pipeline, types []metric.Type) error { if pipeline.IsEmpty() { return errEmptyPipeline diff --git a/src/metrics/rules/validator/validator_test.go b/src/metrics/rules/validator/validator_test.go index 3b077bdb42..d24070182a 100644 --- a/src/metrics/rules/validator/validator_test.go +++ b/src/metrics/rules/validator/validator_test.go @@ -26,6 +26,10 @@ import ( "strings" "testing" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/generated/proto/commonpb" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/metrics/aggregation" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/metrics/rules/validator/namespace/kv" "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/metrics/transformation" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/metrics/rules/view/changes/mapping_test.go b/src/metrics/rules/view/changes/mapping_test.go index da5618f8fd..1c74877cee 100644 --- a/src/metrics/rules/view/changes/mapping_test.go +++ b/src/metrics/rules/view/changes/mapping_test.go @@ -25,10 +25,10 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/rules/view" - - "github.com/stretchr/testify/require" ) func TestSortMappingRuleChanges(t *testing.T) { diff --git a/src/metrics/rules/view/changes/rollup_test.go b/src/metrics/rules/view/changes/rollup_test.go index 2cfd4cda52..3a373bbef9 100644 --- a/src/metrics/rules/view/changes/rollup_test.go +++ b/src/metrics/rules/view/changes/rollup_test.go @@ -25,13 +25,13 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/metrics/transformation" - - "github.com/stretchr/testify/require" ) func TestSortRollupRuleChanges(t *testing.T) { diff --git a/src/metrics/rules/view/changes/ruleset_test.go b/src/metrics/rules/view/changes/ruleset_test.go index 4e2ef6f170..13e9844daa 100644 --- a/src/metrics/rules/view/changes/ruleset_test.go +++ b/src/metrics/rules/view/changes/ruleset_test.go @@ -23,10 +23,10 @@ package changes import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/rules/view" "github.com/m3db/m3/src/metrics/x/bytes" - - "github.com/stretchr/testify/require" ) func TestRuleSetChangeSetsSort(t *testing.T) { diff --git a/src/metrics/rules/view/mapping_test.go b/src/metrics/rules/view/mapping_test.go index 86b5726d4d..afd1cb481e 100644 --- a/src/metrics/rules/view/mapping_test.go +++ b/src/metrics/rules/view/mapping_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestMappingRuleEqual(t *testing.T) { diff --git a/src/metrics/rules/view/rollup_test.go b/src/metrics/rules/view/rollup_test.go index 32d726f61d..8fe99767f1 100644 --- a/src/metrics/rules/view/rollup_test.go +++ b/src/metrics/rules/view/rollup_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestRollupTargetEqual(t *testing.T) { diff --git a/src/metrics/rules/view/ruleset_test.go b/src/metrics/rules/view/ruleset_test.go index c4a1c4c24f..bf1286a9a3 100644 --- a/src/metrics/rules/view/ruleset_test.go +++ b/src/metrics/rules/view/ruleset_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/aggregation" "github.com/m3db/m3/src/metrics/pipeline" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/metrics/transformation" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestRuleSetSort(t *testing.T) { diff --git a/src/metrics/transformation/binary.go b/src/metrics/transformation/binary.go index 1498bd6088..43baa8ba84 100644 --- a/src/metrics/transformation/binary.go +++ b/src/metrics/transformation/binary.go @@ -43,9 +43,9 @@ func transformPerSecond() BinaryTransform { // perSecond computes the derivative between consecutive datapoints, taking into // account the time interval between the values. // Note: -// * It skips NaN values. -// * It assumes the timestamps are monotonically increasing, and values are non-decreasing. -// If either of the two conditions is not met, an empty datapoint is returned. +// - It skips NaN values. +// - It assumes the timestamps are monotonically increasing, and values are non-decreasing. +// If either of the two conditions is not met, an empty datapoint is returned. func perSecond(prev, curr Datapoint, flags FeatureFlags) Datapoint { if prev.TimeNanos >= curr.TimeNanos || math.IsNaN(prev.Value) || math.IsNaN(curr.Value) { return emptyDatapoint @@ -65,9 +65,9 @@ func transformIncrease() BinaryTransform { // increase computes the difference between consecutive datapoints, unlike // perSecond it does not account for the time interval between the values. // Note: -// * It skips NaN values. If the previous value is a NaN value, it uses a previous value of 0. -// * It assumes the timestamps are monotonically increasing, and values are non-decreasing. -// If either of the two conditions is not met, an empty datapoint is returned. +// - It skips NaN values. If the previous value is a NaN value, it uses a previous value of 0. +// - It assumes the timestamps are monotonically increasing, and values are non-decreasing. +// If either of the two conditions is not met, an empty datapoint is returned. func increase(prev, curr Datapoint, _ FeatureFlags) Datapoint { if prev.TimeNanos >= curr.TimeNanos { return emptyDatapoint diff --git a/src/metrics/transformation/type_test.go b/src/metrics/transformation/type_test.go index 19d7e689ae..3438265daf 100644 --- a/src/metrics/transformation/type_test.go +++ b/src/metrics/transformation/type_test.go @@ -24,11 +24,11 @@ import ( "encoding/json" "testing" - "github.com/m3db/m3/src/metrics/generated/proto/transformationpb" - "github.com/m3db/m3/src/x/test/testmarshal" + "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" - "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/generated/proto/transformationpb" + "github.com/m3db/m3/src/x/test/testmarshal" ) var ( diff --git a/src/msg/consumer/config_test.go b/src/msg/consumer/config_test.go index 343f2dd30c..c37faea8ce 100644 --- a/src/msg/consumer/config_test.go +++ b/src/msg/consumer/config_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/instrument" ) func TestConfiguration(t *testing.T) { diff --git a/src/msg/consumer/consumer.go b/src/msg/consumer/consumer.go index 0e141556ec..cd9cd2d54c 100644 --- a/src/msg/consumer/consumer.go +++ b/src/msg/consumer/consumer.go @@ -25,14 +25,14 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/protocol/proto" "github.com/m3db/m3/src/x/clock" xio "github.com/m3db/m3/src/x/io" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) type listener struct { diff --git a/src/msg/consumer/consumer_test.go b/src/msg/consumer/consumer_test.go index c3cc4253fd..891ce181bd 100644 --- a/src/msg/consumer/consumer_test.go +++ b/src/msg/consumer/consumer_test.go @@ -27,13 +27,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/msg/generated/proto/msgpb" - "github.com/m3db/m3/src/msg/protocol/proto" - "github.com/m3db/m3/src/x/pool" - "github.com/fortytw2/leaktest" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/msg/generated/proto/msgpb" + "github.com/m3db/m3/src/msg/protocol/proto" + "github.com/m3db/m3/src/x/pool" ) var ( diff --git a/src/msg/consumer/handlers.go b/src/msg/consumer/handlers.go index 845efc1e00..92bd19f830 100644 --- a/src/msg/consumer/handlers.go +++ b/src/msg/consumer/handlers.go @@ -25,9 +25,9 @@ import ( "net" "time" - "github.com/m3db/m3/src/x/server" - "go.uber.org/zap" + + "github.com/m3db/m3/src/x/server" ) type messageHandler struct { diff --git a/src/msg/consumer/handlers_test.go b/src/msg/consumer/handlers_test.go index 454de168a9..c840512b7c 100644 --- a/src/msg/consumer/handlers_test.go +++ b/src/msg/consumer/handlers_test.go @@ -26,14 +26,14 @@ import ( "sync" "testing" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/protocol/proto" "github.com/m3db/m3/src/x/server" xtest "github.com/m3db/m3/src/x/test" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestServerWithSingletonMessageProcessor(t *testing.T) { diff --git a/src/msg/integration/setup.go b/src/msg/integration/setup.go index c1e616a7ed..1bf6e62c1d 100644 --- a/src/msg/integration/setup.go +++ b/src/msg/integration/setup.go @@ -27,6 +27,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "go.uber.org/zap" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" @@ -41,12 +47,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xio "github.com/m3db/m3/src/x/io" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "go.uber.org/zap" - "gopkg.in/yaml.v2" ) const ( diff --git a/src/msg/producer/buffer/buffer.go b/src/msg/producer/buffer/buffer.go index e811c57721..9e0d30386b 100644 --- a/src/msg/producer/buffer/buffer.go +++ b/src/msg/producer/buffer/buffer.go @@ -27,12 +27,12 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" - "go.uber.org/atomic" ) var ( diff --git a/src/msg/producer/buffer/buffer_test.go b/src/msg/producer/buffer/buffer_test.go index 32fd7b7cf8..71af6424b1 100644 --- a/src/msg/producer/buffer/buffer_test.go +++ b/src/msg/producer/buffer/buffer_test.go @@ -25,12 +25,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/msg/producer" - "github.com/m3db/m3/src/x/retry" - "github.com/fortytw2/leaktest" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/msg/producer" + "github.com/m3db/m3/src/x/retry" ) func TestOptionsValidation(t *testing.T) { diff --git a/src/msg/producer/config/buffer_test.go b/src/msg/producer/config/buffer_test.go index 771bfd8895..a035f860ef 100644 --- a/src/msg/producer/config/buffer_test.go +++ b/src/msg/producer/config/buffer_test.go @@ -24,12 +24,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/msg/producer/buffer" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" - - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" ) func TestBufferConfiguration(t *testing.T) { diff --git a/src/msg/producer/config/producer_test.go b/src/msg/producer/config/producer_test.go index c1a1fa94a6..d32c096bfe 100644 --- a/src/msg/producer/config/producer_test.go +++ b/src/msg/producer/config/producer_test.go @@ -23,13 +23,13 @@ package config import ( "testing" - "github.com/m3db/m3/src/cluster/client" - "github.com/m3db/m3/src/x/instrument" - xio "github.com/m3db/m3/src/x/io" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/cluster/client" + "github.com/m3db/m3/src/x/instrument" + xio "github.com/m3db/m3/src/x/io" ) func TestProducerConfiguration(t *testing.T) { diff --git a/src/msg/producer/config/writer.go b/src/msg/producer/config/writer.go index 820e555ba2..5648e2168e 100644 --- a/src/msg/producer/config/writer.go +++ b/src/msg/producer/config/writer.go @@ -24,6 +24,8 @@ import ( "errors" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placement" @@ -36,8 +38,6 @@ import ( xnet "github.com/m3db/m3/src/x/net" "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" ) // ConnectionConfiguration configs the connection options. diff --git a/src/msg/producer/config/writer_test.go b/src/msg/producer/config/writer_test.go index ce8d6940dc..5d103f75c0 100644 --- a/src/msg/producer/config/writer_test.go +++ b/src/msg/producer/config/writer_test.go @@ -24,15 +24,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + yaml "gopkg.in/yaml.v2" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/x/instrument" xio "github.com/m3db/m3/src/x/io" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - yaml "gopkg.in/yaml.v2" ) func TestConnectionConfiguration(t *testing.T) { diff --git a/src/msg/producer/writer/consumer_service_writer.go b/src/msg/producer/writer/consumer_service_writer.go index 702b936cfe..70d1894884 100644 --- a/src/msg/producer/writer/consumer_service_writer.go +++ b/src/msg/producer/writer/consumer_service_writer.go @@ -26,13 +26,13 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/msg/producer/writer/consumer_service_writer_test.go b/src/msg/producer/writer/consumer_service_writer_test.go index 458a3b4838..b11f1611cf 100644 --- a/src/msg/producer/writer/consumer_service_writer_test.go +++ b/src/msg/producer/writer/consumer_service_writer_test.go @@ -27,6 +27,10 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/placement" @@ -39,10 +43,6 @@ import ( "github.com/m3db/m3/src/msg/protocol/proto" "github.com/m3db/m3/src/msg/topic" xtest "github.com/m3db/m3/src/x/test" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestConsumerServiceWriterWithSharedConsumerWithNonShardedPlacement(t *testing.T) { diff --git a/src/msg/producer/writer/consumer_writer.go b/src/msg/producer/writer/consumer_writer.go index d30fcc3322..57bdca89b2 100644 --- a/src/msg/producer/writer/consumer_writer.go +++ b/src/msg/producer/writer/consumer_writer.go @@ -29,14 +29,14 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/protocol/proto" "github.com/m3db/m3/src/x/clock" xio "github.com/m3db/m3/src/x/io" "github.com/m3db/m3/src/x/retry" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/msg/producer/writer/consumer_writer_test.go b/src/msg/producer/writer/consumer_writer_test.go index e579e55afd..129b8fe0cf 100644 --- a/src/msg/producer/writer/consumer_writer_test.go +++ b/src/msg/producer/writer/consumer_writer_test.go @@ -387,6 +387,7 @@ func TestConsumerWriterResetWhileDecoding(t *testing.T) { } // Interface solely for mocking. +// //nolint:deadcode,unused type contextDialer interface { DialContext(ctx context.Context, network string, addr string) (net.Conn, error) diff --git a/src/msg/producer/writer/message.go b/src/msg/producer/writer/message.go index 125aa1bb74..b02e9fc13b 100644 --- a/src/msg/producer/writer/message.go +++ b/src/msg/producer/writer/message.go @@ -21,11 +21,11 @@ package writer import ( + "go.uber.org/atomic" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/protocol/proto" - - "go.uber.org/atomic" ) type message struct { diff --git a/src/msg/producer/writer/message_pool_test.go b/src/msg/producer/writer/message_pool_test.go index 1ae7334137..ca12143109 100644 --- a/src/msg/producer/writer/message_pool_test.go +++ b/src/msg/producer/writer/message_pool_test.go @@ -23,11 +23,11 @@ package writer import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/producer" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/require" ) func TestMessagePool(t *testing.T) { diff --git a/src/msg/producer/writer/message_writer.go b/src/msg/producer/writer/message_writer.go index 1ca18bd57a..aea69f1e29 100644 --- a/src/msg/producer/writer/message_writer.go +++ b/src/msg/producer/writer/message_writer.go @@ -28,15 +28,15 @@ import ( "time" stdunsafe "unsafe" + "github.com/uber-go/tally" + "go.uber.org/atomic" + "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/protocol/proto" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/retry" "github.com/m3db/m3/src/x/unsafe" - - "github.com/uber-go/tally" - "go.uber.org/atomic" ) // MessageRetryNanosFn returns the message backoff time for retry in nanoseconds. diff --git a/src/msg/producer/writer/shard_writer.go b/src/msg/producer/writer/shard_writer.go index feb8995841..5a0d1c4fc7 100644 --- a/src/msg/producer/writer/shard_writer.go +++ b/src/msg/producer/writer/shard_writer.go @@ -23,11 +23,11 @@ package writer import ( "sync" - "github.com/m3db/m3/src/cluster/placement" - "github.com/m3db/m3/src/msg/producer" - "go.uber.org/atomic" "go.uber.org/zap" + + "github.com/m3db/m3/src/cluster/placement" + "github.com/m3db/m3/src/msg/producer" ) type shardWriter interface { diff --git a/src/msg/producer/writer/shard_writer_test.go b/src/msg/producer/writer/shard_writer_test.go index ece56d1148..4e25cecd2b 100644 --- a/src/msg/producer/writer/shard_writer_test.go +++ b/src/msg/producer/writer/shard_writer_test.go @@ -26,15 +26,15 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placement" "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/protocol/proto" xtest "github.com/m3db/m3/src/x/test" - - "github.com/fortytw2/leaktest" - "github.com/stretchr/testify/require" ) func TestSharedShardWriter(t *testing.T) { diff --git a/src/msg/producer/writer/writer.go b/src/msg/producer/writer/writer.go index 41386e4ac4..080627f707 100644 --- a/src/msg/producer/writer/writer.go +++ b/src/msg/producer/writer/writer.go @@ -25,14 +25,14 @@ import ( "fmt" "sync" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/topic" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/watch" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( @@ -266,11 +266,7 @@ func (w *writer) RegisterFilter(sid services.ServiceID, filter producer.FilterFu defer w.Unlock() key := sid.String() - if _, ok := w.filterRegistry[key]; ok { - w.filterRegistry[key] = append(w.filterRegistry[key], filter) - } else { - w.filterRegistry[key] = []producer.FilterFunc{filter} - } + w.filterRegistry[key] = append(w.filterRegistry[key], filter) csw, ok := w.consumerServiceWriters[key] if ok { diff --git a/src/msg/producer/writer/writer_test.go b/src/msg/producer/writer/writer_test.go index e98384714b..e929455a54 100644 --- a/src/msg/producer/writer/writer_test.go +++ b/src/msg/producer/writer/writer_test.go @@ -27,6 +27,11 @@ import ( "testing" "time" + "github.com/fortytw2/leaktest" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" @@ -36,11 +41,6 @@ import ( "github.com/m3db/m3/src/msg/producer" "github.com/m3db/m3/src/msg/topic" xtest "github.com/m3db/m3/src/x/test" - - "github.com/fortytw2/leaktest" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" ) func TestWriterInitErrorNoTopic(t *testing.T) { diff --git a/src/msg/protocol/proto/config_test.go b/src/msg/protocol/proto/config_test.go index a02b27a7e3..97623d7f78 100644 --- a/src/msg/protocol/proto/config_test.go +++ b/src/msg/protocol/proto/config_test.go @@ -23,10 +23,10 @@ package proto import ( "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/instrument" ) func TestConfiguration(t *testing.T) { diff --git a/src/msg/protocol/proto/roundtrip_test.go b/src/msg/protocol/proto/roundtrip_test.go index cdb591b410..463d17deef 100644 --- a/src/msg/protocol/proto/roundtrip_test.go +++ b/src/msg/protocol/proto/roundtrip_test.go @@ -26,10 +26,10 @@ import ( "net" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/msg/generated/proto/msgpb" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/require" ) func TestBaseEncodeDecodeRoundTripWithoutPool(t *testing.T) { diff --git a/src/msg/topic/service_test.go b/src/msg/topic/service_test.go index 5909a92d15..569c0233bc 100644 --- a/src/msg/topic/service_test.go +++ b/src/msg/topic/service_test.go @@ -23,14 +23,14 @@ package topic import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/msg/generated/proto/msgpb" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestTopicService(t *testing.T) { diff --git a/src/msg/topic/topic_test.go b/src/msg/topic/topic_test.go index f8ca34bb83..776e2d9b9f 100644 --- a/src/msg/topic/topic_test.go +++ b/src/msg/topic/topic_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cluster/services" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/services" ) func TestTopicAddConsumer(t *testing.T) { diff --git a/src/query/api/v1/handler/database/create.go b/src/query/api/v1/handler/database/create.go index 8e60d86282..5add5a5891 100644 --- a/src/query/api/v1/handler/database/create.go +++ b/src/query/api/v1/handler/database/create.go @@ -30,6 +30,9 @@ import ( "strings" "time" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" clusterplacement "github.com/m3db/m3/src/cluster/placement" @@ -46,9 +49,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/database/create_test.go b/src/query/api/v1/handler/database/create_test.go index 98cb901ca4..d7f8f81227 100644 --- a/src/query/api/v1/handler/database/create_test.go +++ b/src/query/api/v1/handler/database/create_test.go @@ -30,6 +30,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -44,10 +48,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/api/v1/handler/graphite/find.go b/src/query/api/v1/handler/graphite/find.go index 7fe1dcea6d..7f0828c30b 100644 --- a/src/query/api/v1/handler/graphite/find.go +++ b/src/query/api/v1/handler/graphite/find.go @@ -26,6 +26,8 @@ import ( "sort" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" @@ -36,8 +38,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/graphite/find_test.go b/src/query/api/v1/handler/graphite/find_test.go index fa50fcf0c8..94e70fc066 100644 --- a/src/query/api/v1/handler/graphite/find_test.go +++ b/src/query/api/v1/handler/graphite/find_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -40,10 +44,6 @@ import ( "github.com/m3db/m3/src/x/headers" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // dates is a tuple of a date with a valid string representation diff --git a/src/query/api/v1/handler/graphite/pickle/pickle_writer_test.go b/src/query/api/v1/handler/graphite/pickle/pickle_writer_test.go index 27b72f9eda..d0d8be0099 100644 --- a/src/query/api/v1/handler/graphite/pickle/pickle_writer_test.go +++ b/src/query/api/v1/handler/graphite/pickle/pickle_writer_test.go @@ -61,7 +61,7 @@ func TestWriteComplex(t *testing.T) { w.WriteDictKey("step") w.WriteInt(3494945) w.WriteDictKey("pi") - w.WriteFloat64(3.45E10) + w.WriteFloat64(3.45e10) w.WriteDictKey("none") w.WriteNone() w.WriteDictKey("noNumber") @@ -92,7 +92,7 @@ func TestWriteComplex(t *testing.T) { require.NoError(t, unpickle(buf.Bytes(), &s)) assert.Equal(t, 3494945, s.Step) - assert.Equal(t, 3.45E10, s.Pi) + assert.Equal(t, 3.45e10, s.Pi) assert.Nil(t, s.NoNumber) assert.Equal(t, "hello world", s.Skey) assert.Equal(t, []interface{}{ diff --git a/src/query/api/v1/handler/graphite/render.go b/src/query/api/v1/handler/graphite/render.go index d0a6485f00..bddca5f3c0 100644 --- a/src/query/api/v1/handler/graphite/render.go +++ b/src/query/api/v1/handler/graphite/render.go @@ -26,6 +26,9 @@ import ( "sort" "sync" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/src/query/api/v1/handler/graphite/render_test.go b/src/query/api/v1/handler/graphite/render_test.go index 928e07c021..a18e09d0ca 100644 --- a/src/query/api/v1/handler/graphite/render_test.go +++ b/src/query/api/v1/handler/graphite/render_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/block" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/x/headers" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func testHandlerOptions(t *testing.T) options.HandlerOptions { diff --git a/src/query/api/v1/handler/influxdb/write.go b/src/query/api/v1/handler/influxdb/write.go index 06f3fa7cea..7dd7986921 100644 --- a/src/query/api/v1/handler/influxdb/write.go +++ b/src/query/api/v1/handler/influxdb/write.go @@ -31,6 +31,9 @@ import ( "net/http" "time" + imodels "github.com/influxdata/influxdb/models" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" @@ -39,10 +42,6 @@ import ( "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/ts" "github.com/m3db/m3/src/query/util/logging" - - imodels "github.com/influxdata/influxdb/models" - "go.uber.org/zap" - xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/net/http" diff --git a/src/query/api/v1/handler/influxdb/write_test.go b/src/query/api/v1/handler/influxdb/write_test.go index 2c8817c29e..c0eaa197f3 100644 --- a/src/query/api/v1/handler/influxdb/write_test.go +++ b/src/query/api/v1/handler/influxdb/write_test.go @@ -31,16 +31,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + imodels "github.com/influxdata/influxdb/models" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/models" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - imodels "github.com/influxdata/influxdb/models" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // human-readable string out of what the iterator produces; diff --git a/src/query/api/v1/handler/json/write.go b/src/query/api/v1/handler/json/write.go index 934561a345..d172da2d7a 100644 --- a/src/query/api/v1/handler/json/write.go +++ b/src/query/api/v1/handler/json/write.go @@ -26,6 +26,8 @@ import ( "io/ioutil" "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/query/models" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/json/write_test.go b/src/query/api/v1/handler/json/write_test.go index 10295e9224..ceaaf72e42 100644 --- a/src/query/api/v1/handler/json/write_test.go +++ b/src/query/api/v1/handler/json/write_test.go @@ -29,12 +29,12 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test/m3" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestFailingJSONWriteParsing(t *testing.T) { diff --git a/src/query/api/v1/handler/namespace/add.go b/src/query/api/v1/handler/namespace/add.go index 5210028978..6bf33fd229 100644 --- a/src/query/api/v1/handler/namespace/add.go +++ b/src/query/api/v1/handler/namespace/add.go @@ -26,6 +26,9 @@ import ( "net/http" "path" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" @@ -38,9 +41,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) var ( diff --git a/src/query/api/v1/handler/namespace/add_test.go b/src/query/api/v1/handler/namespace/add_test.go index dc4477ce0a..d61ce4a361 100644 --- a/src/query/api/v1/handler/namespace/add_test.go +++ b/src/query/api/v1/handler/namespace/add_test.go @@ -28,6 +28,10 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/namespace" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const testAddJSON = ` diff --git a/src/query/api/v1/handler/namespace/common_test.go b/src/query/api/v1/handler/namespace/common_test.go index 04739efcca..bbef1bdafe 100644 --- a/src/query/api/v1/handler/namespace/common_test.go +++ b/src/query/api/v1/handler/namespace/common_test.go @@ -26,16 +26,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/dbnode/retention" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func init() { diff --git a/src/query/api/v1/handler/namespace/delete.go b/src/query/api/v1/handler/namespace/delete.go index f850a10ccd..ff43a889e4 100644 --- a/src/query/api/v1/handler/namespace/delete.go +++ b/src/query/api/v1/handler/namespace/delete.go @@ -28,6 +28,9 @@ import ( "path" "strings" + "github.com/gorilla/mux" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/dbnode/namespace" @@ -36,9 +39,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gorilla/mux" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/namespace/delete_test.go b/src/query/api/v1/handler/namespace/delete_test.go index 268b9dcbe2..3e26e516f8 100644 --- a/src/query/api/v1/handler/namespace/delete_test.go +++ b/src/query/api/v1/handler/namespace/delete_test.go @@ -26,14 +26,14 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/cluster/kv" - nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" - "github.com/m3db/m3/src/x/instrument" - "github.com/golang/mock/gomock" "github.com/gorilla/mux" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/kv" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" + "github.com/m3db/m3/src/x/instrument" ) func TestNamespaceDeleteHandlerNotFound(t *testing.T) { diff --git a/src/query/api/v1/handler/namespace/get.go b/src/query/api/v1/handler/namespace/get.go index e9f53e0f2c..418ed98c1e 100644 --- a/src/query/api/v1/handler/namespace/get.go +++ b/src/query/api/v1/handler/namespace/get.go @@ -27,6 +27,10 @@ import ( "path" "strconv" + "github.com/gogo/protobuf/jsonpb" + "github.com/golang/protobuf/proto" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -36,10 +40,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "github.com/golang/protobuf/proto" - "go.uber.org/zap" ) var ( diff --git a/src/query/api/v1/handler/namespace/get_test.go b/src/query/api/v1/handler/namespace/get_test.go index c5412b2bff..032239eefb 100644 --- a/src/query/api/v1/handler/namespace/get_test.go +++ b/src/query/api/v1/handler/namespace/get_test.go @@ -26,6 +26,10 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" @@ -33,10 +37,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func setupNamespaceTest(t *testing.T, ctrl *gomock.Controller) (*client.MockClient, *kv.MockStore) { diff --git a/src/query/api/v1/handler/namespace/ready_test.go b/src/query/api/v1/handler/namespace/ready_test.go index 47fbd2650f..13faeeb82f 100644 --- a/src/query/api/v1/handler/namespace/ready_test.go +++ b/src/query/api/v1/handler/namespace/ready_test.go @@ -27,6 +27,9 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/dbnode/client" @@ -38,9 +41,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestNamespaceReadyHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/namespace/schema.go b/src/query/api/v1/handler/namespace/schema.go index 83dc6be864..7656ace37a 100644 --- a/src/query/api/v1/handler/namespace/schema.go +++ b/src/query/api/v1/handler/namespace/schema.go @@ -25,6 +25,9 @@ import ( "net/http" "path" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -35,9 +38,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) var ( diff --git a/src/query/api/v1/handler/namespace/schema_test.go b/src/query/api/v1/handler/namespace/schema_test.go index c205cb160b..0e550c7b21 100644 --- a/src/query/api/v1/handler/namespace/schema_test.go +++ b/src/query/api/v1/handler/namespace/schema_test.go @@ -31,6 +31,10 @@ import ( "strings" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/dbnode/namespace/kvadmin" "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/api/v1/handler/namespace/update.go b/src/query/api/v1/handler/namespace/update.go index 6de5c10447..ba0b6109ac 100644 --- a/src/query/api/v1/handler/namespace/update.go +++ b/src/query/api/v1/handler/namespace/update.go @@ -28,6 +28,9 @@ import ( "path" "reflect" + "github.com/gogo/protobuf/jsonpb" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" @@ -38,9 +41,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" - "go.uber.org/zap" ) var ( diff --git a/src/query/api/v1/handler/namespace/update_test.go b/src/query/api/v1/handler/namespace/update_test.go index 30b3525f9c..339194dbac 100644 --- a/src/query/api/v1/handler/namespace/update_test.go +++ b/src/query/api/v1/handler/namespace/update_test.go @@ -29,17 +29,17 @@ import ( "strings" "testing" + "github.com/gogo/protobuf/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/kv" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/gogo/protobuf/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/api/v1/handler/openapi/openapi.go b/src/query/api/v1/handler/openapi/openapi.go index 01cb99759b..eb07598511 100644 --- a/src/query/api/v1/handler/openapi/openapi.go +++ b/src/query/api/v1/handler/openapi/openapi.go @@ -23,13 +23,13 @@ package openapi import ( "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/route" assets "github.com/m3db/m3/src/query/generated/assets/openapi" "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/openapi/openapi_test.go b/src/query/api/v1/handler/openapi/openapi_test.go index eb1d11cb5d..1f418113f8 100644 --- a/src/query/api/v1/handler/openapi/openapi_test.go +++ b/src/query/api/v1/handler/openapi/openapi_test.go @@ -26,10 +26,10 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/instrument" ) func TestDocHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/prom/common.go b/src/query/api/v1/handler/prom/common.go index aafbdd21a1..242d81091b 100644 --- a/src/query/api/v1/handler/prom/common.go +++ b/src/query/api/v1/handler/prom/common.go @@ -25,11 +25,11 @@ import ( "net/http" "time" - xhttp "github.com/m3db/m3/src/x/net/http" - jsoniter "github.com/json-iterator/go" promql "github.com/prometheus/prometheus/promql/parser" promstorage "github.com/prometheus/prometheus/storage" + + xhttp "github.com/m3db/m3/src/x/net/http" ) // All of this is taken from prometheus to ensure we have consistent return/error diff --git a/src/query/api/v1/handler/prom/mocks.go b/src/query/api/v1/handler/prom/mocks.go index f001aebd61..15b77c9a5f 100644 --- a/src/query/api/v1/handler/prom/mocks.go +++ b/src/query/api/v1/handler/prom/mocks.go @@ -25,14 +25,14 @@ import ( "errors" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/go-kit/kit/log" kitlogzap "github.com/go-kit/kit/log/zap" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" promstorage "github.com/prometheus/prometheus/storage" "go.uber.org/zap/zapcore" + + "github.com/m3db/m3/src/x/instrument" ) type mockQuerier struct { diff --git a/src/query/api/v1/handler/prom/prom.go b/src/query/api/v1/handler/prom/prom.go index d46bbc7054..aad5b8be01 100644 --- a/src/query/api/v1/handler/prom/prom.go +++ b/src/query/api/v1/handler/prom/prom.go @@ -24,12 +24,12 @@ import ( "errors" "net/http" + "github.com/prometheus/prometheus/promql/parser" + promstorage "github.com/prometheus/prometheus/storage" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/storage/prometheus" - - "github.com/prometheus/prometheus/promql/parser" - promstorage "github.com/prometheus/prometheus/storage" ) // opts defines options for PromQL handler. diff --git a/src/query/api/v1/handler/prom/read.go b/src/query/api/v1/handler/prom/read.go index ddb46d41bd..7a7fea5b62 100644 --- a/src/query/api/v1/handler/prom/read.go +++ b/src/query/api/v1/handler/prom/read.go @@ -28,6 +28,13 @@ import ( "net/http" "sync" + errs "github.com/pkg/errors" + "github.com/prometheus/prometheus/promql" + "github.com/prometheus/prometheus/promql/parser" + promstorage "github.com/prometheus/prometheus/storage" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/native" "github.com/m3db/m3/src/query/api/v1/options" @@ -38,13 +45,6 @@ import ( "github.com/m3db/m3/src/query/storage/prometheus" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - errs "github.com/pkg/errors" - "github.com/prometheus/prometheus/promql" - "github.com/prometheus/prometheus/promql/parser" - promstorage "github.com/prometheus/prometheus/storage" - "github.com/uber-go/tally" - "go.uber.org/zap" ) // NewQueryFn creates a new promql Query. diff --git a/src/query/api/v1/handler/prom/read_test.go b/src/query/api/v1/handler/prom/read_test.go index a644e9e637..1410ae7356 100644 --- a/src/query/api/v1/handler/prom/read_test.go +++ b/src/query/api/v1/handler/prom/read_test.go @@ -30,6 +30,12 @@ import ( "testing" "time" + "github.com/prometheus/prometheus/model/labels" + "github.com/prometheus/prometheus/promql" + promstorage "github.com/prometheus/prometheus/storage" + "github.com/stretchr/testify/require" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/native" "github.com/m3db/m3/src/query/api/v1/options" @@ -38,12 +44,6 @@ import ( "github.com/m3db/m3/src/query/storage/prometheus" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/prometheus/prometheus/model/labels" - "github.com/prometheus/prometheus/promql" - promstorage "github.com/prometheus/prometheus/storage" - "github.com/stretchr/testify/require" - "go.uber.org/zap" ) const promQuery = `http_requests_total{job="prometheus",group="canary"}` diff --git a/src/query/api/v1/handler/prometheus/common.go b/src/query/api/v1/handler/prometheus/common.go index 721f0f5193..293046d389 100644 --- a/src/query/api/v1/handler/prometheus/common.go +++ b/src/query/api/v1/handler/prometheus/common.go @@ -28,6 +28,8 @@ import ( "net/http" "time" + "github.com/golang/snappy" + "github.com/m3db/m3/src/query/errors" "github.com/m3db/m3/src/query/models" xpromql "github.com/m3db/m3/src/query/parser/promql" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/query/util/json" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/snappy" ) const ( diff --git a/src/query/api/v1/handler/prometheus/common_test.go b/src/query/api/v1/handler/prometheus/common_test.go index 56ccf73e80..3efe82d3c6 100644 --- a/src/query/api/v1/handler/prometheus/common_test.go +++ b/src/query/api/v1/handler/prometheus/common_test.go @@ -29,14 +29,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser/promql" "github.com/m3db/m3/src/query/test" xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPromCompressedReadSuccess(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/handleroptions/fetch_options_test.go b/src/query/api/v1/handler/prometheus/handleroptions/fetch_options_test.go index 87012286f5..7d4b8690c0 100644 --- a/src/query/api/v1/handler/prometheus/handleroptions/fetch_options_test.go +++ b/src/query/api/v1/handler/prometheus/handleroptions/fetch_options_test.go @@ -33,6 +33,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/metrics/policy" @@ -42,9 +45,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFetchOptionsBuilder(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/handleroptions/header_test.go b/src/query/api/v1/handler/prometheus/handleroptions/header_test.go index 268f122f45..55af79ce07 100644 --- a/src/query/api/v1/handler/prometheus/handleroptions/header_test.go +++ b/src/query/api/v1/handler/prometheus/handleroptions/header_test.go @@ -28,12 +28,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/x/headers" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestAddDBResultResponseHeaders(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/handleroptions/tag_options_test.go b/src/query/api/v1/handler/prometheus/handleroptions/tag_options_test.go index e631999c18..345e80f83a 100644 --- a/src/query/api/v1/handler/prometheus/handleroptions/tag_options_test.go +++ b/src/query/api/v1/handler/prometheus/handleroptions/tag_options_test.go @@ -24,11 +24,11 @@ import ( "encoding/json" "testing" - "github.com/m3db/m3/src/query/models" - "github.com/m3db/m3/src/query/storage" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" + "github.com/m3db/m3/src/query/storage" ) func toStrip(strs ...string) [][]byte { diff --git a/src/query/api/v1/handler/prometheus/native/common_test.go b/src/query/api/v1/handler/prometheus/native/common_test.go index cb34e2d557..ce16f8b2d3 100644 --- a/src/query/api/v1/handler/prometheus/native/common_test.go +++ b/src/query/api/v1/handler/prometheus/native/common_test.go @@ -30,6 +30,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor" @@ -42,10 +46,6 @@ import ( xhttp "github.com/m3db/m3/src/x/net/http" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/complete_tags.go b/src/query/api/v1/handler/prometheus/native/complete_tags.go index b7301d0afa..1056352ce4 100644 --- a/src/query/api/v1/handler/prometheus/native/complete_tags.go +++ b/src/query/api/v1/handler/prometheus/native/complete_tags.go @@ -25,6 +25,8 @@ import ( "net/http" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -38,8 +40,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/complete_tags_test.go b/src/query/api/v1/handler/prometheus/native/complete_tags_test.go index 91e34ea27f..1086d078e1 100644 --- a/src/query/api/v1/handler/prometheus/native/complete_tags_test.go +++ b/src/query/api/v1/handler/prometheus/native/complete_tags_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/block" @@ -36,10 +40,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3/consolidators" "github.com/m3db/m3/src/x/headers" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func buildWarningMeta(name, message string) block.ResultMetadata { diff --git a/src/query/api/v1/handler/prometheus/native/list_tags.go b/src/query/api/v1/handler/prometheus/native/list_tags.go index 1cd002df1e..5d44014512 100644 --- a/src/query/api/v1/handler/prometheus/native/list_tags.go +++ b/src/query/api/v1/handler/prometheus/native/list_tags.go @@ -25,6 +25,8 @@ import ( "io/ioutil" "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/list_tags_test.go b/src/query/api/v1/handler/prometheus/native/list_tags_test.go index 593a949382..6b6f036323 100644 --- a/src/query/api/v1/handler/prometheus/native/list_tags_test.go +++ b/src/query/api/v1/handler/prometheus/native/list_tags_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/block" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/x/headers" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type listTagsMatcher struct { diff --git a/src/query/api/v1/handler/prometheus/native/middleware.go b/src/query/api/v1/handler/prometheus/native/middleware.go index c9c5fbd679..35789e9d09 100644 --- a/src/query/api/v1/handler/prometheus/native/middleware.go +++ b/src/query/api/v1/handler/prometheus/native/middleware.go @@ -25,10 +25,10 @@ import ( "net/http" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/middleware" - - "go.uber.org/zap" ) // WithQueryParams adds the query request parameters to the middleware options. diff --git a/src/query/api/v1/handler/prometheus/native/middleware_test.go b/src/query/api/v1/handler/prometheus/native/middleware_test.go index 4f6c2b6e2f..8ac86a6462 100644 --- a/src/query/api/v1/handler/prometheus/native/middleware_test.go +++ b/src/query/api/v1/handler/prometheus/native/middleware_test.go @@ -30,17 +30,17 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/api/v1/middleware" - "github.com/m3db/m3/src/x/headers" - "github.com/m3db/m3/src/x/instrument" - xhttp "github.com/m3db/m3/src/x/net/http" - "github.com/gorilla/mux" "github.com/jonboulle/clockwork" "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" + + "github.com/m3db/m3/src/query/api/v1/middleware" + "github.com/m3db/m3/src/x/headers" + "github.com/m3db/m3/src/x/instrument" + xhttp "github.com/m3db/m3/src/x/net/http" ) func TestQueryResponse(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/native/parse_query.go b/src/query/api/v1/handler/prometheus/native/parse_query.go index a729bd21fc..aaa9c827f2 100644 --- a/src/query/api/v1/handler/prometheus/native/parse_query.go +++ b/src/query/api/v1/handler/prometheus/native/parse_query.go @@ -26,6 +26,8 @@ import ( "strings" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/query/executor" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/query/parser/promql" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/parse_query_test.go b/src/query/api/v1/handler/prometheus/native/parse_query_test.go index c6334c0d57..0bf4cc8a7f 100644 --- a/src/query/api/v1/handler/prometheus/native/parse_query_test.go +++ b/src/query/api/v1/handler/prometheus/native/parse_query_test.go @@ -27,14 +27,14 @@ import ( "net/url" "testing" + pql "github.com/prometheus/prometheus/promql/parser" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/executor" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - pql "github.com/prometheus/prometheus/promql/parser" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var parseTests = []struct { diff --git a/src/query/api/v1/handler/prometheus/native/parse_threshold.go b/src/query/api/v1/handler/prometheus/native/parse_threshold.go index 896de3493c..d7caa371f1 100644 --- a/src/query/api/v1/handler/prometheus/native/parse_threshold.go +++ b/src/query/api/v1/handler/prometheus/native/parse_threshold.go @@ -23,14 +23,14 @@ package native import ( "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/query/executor" "github.com/m3db/m3/src/query/functions/scalar" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/parse_threshold_test.go b/src/query/api/v1/handler/prometheus/native/parse_threshold_test.go index b9fe74dbc5..4c8c8567df 100644 --- a/src/query/api/v1/handler/prometheus/native/parse_threshold_test.go +++ b/src/query/api/v1/handler/prometheus/native/parse_threshold_test.go @@ -28,13 +28,13 @@ import ( "net/url" "testing" + pql "github.com/prometheus/prometheus/promql/parser" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/executor" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - pql "github.com/prometheus/prometheus/promql/parser" - - "github.com/stretchr/testify/require" ) var thresholdTests = []struct { diff --git a/src/query/api/v1/handler/prometheus/native/read.go b/src/query/api/v1/handler/prometheus/native/read.go index 003fdba9d2..18d9fa9ab9 100644 --- a/src/query/api/v1/handler/prometheus/native/read.go +++ b/src/query/api/v1/handler/prometheus/native/read.go @@ -23,6 +23,10 @@ package native import ( "net/http" + opentracingext "github.com/opentracing/opentracing-go/ext" + opentracinglog "github.com/opentracing/opentracing-go/log" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" @@ -31,10 +35,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xhttp "github.com/m3db/m3/src/x/net/http" xopentracing "github.com/m3db/m3/src/x/opentracing" - - opentracingext "github.com/opentracing/opentracing-go/ext" - opentracinglog "github.com/opentracing/opentracing-go/log" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/native/read_common.go b/src/query/api/v1/handler/prometheus/native/read_common.go index 50abae8be8..bcf4f1b895 100644 --- a/src/query/api/v1/handler/prometheus/native/read_common.go +++ b/src/query/api/v1/handler/prometheus/native/read_common.go @@ -25,6 +25,9 @@ import ( "math" "net/http" + opentracinglog "github.com/opentracing/opentracing-go/log" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/block" @@ -36,9 +39,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" xopentracing "github.com/m3db/m3/src/x/opentracing" - - opentracinglog "github.com/opentracing/opentracing-go/log" - "github.com/uber-go/tally" ) type promReadMetrics struct { diff --git a/src/query/api/v1/handler/prometheus/native/read_instantaneous_test.go b/src/query/api/v1/handler/prometheus/native/read_instantaneous_test.go index 7c9195d2bc..8fd856c3bc 100644 --- a/src/query/api/v1/handler/prometheus/native/read_instantaneous_test.go +++ b/src/query/api/v1/handler/prometheus/native/read_instantaneous_test.go @@ -30,15 +30,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/x/headers" xjson "github.com/m3db/m3/src/x/json" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type vectorResult struct { diff --git a/src/query/api/v1/handler/prometheus/native/read_test.go b/src/query/api/v1/handler/prometheus/native/read_test.go index b0d4f29d93..c58b0e753d 100644 --- a/src/query/api/v1/handler/prometheus/native/read_test.go +++ b/src/query/api/v1/handler/prometheus/native/read_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -38,10 +42,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestParseRequest(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/remote/mag_tags_test.go b/src/query/api/v1/handler/prometheus/remote/mag_tags_test.go index 6a767924db..623b8c05d1 100644 --- a/src/query/api/v1/handler/prometheus/remote/mag_tags_test.go +++ b/src/query/api/v1/handler/prometheus/remote/mag_tags_test.go @@ -23,9 +23,10 @@ package remote import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/generated/proto/prompb" - "github.com/stretchr/testify/assert" ) func TestMapTags_Append(t *testing.T) { diff --git a/src/query/api/v1/handler/prometheus/remote/match.go b/src/query/api/v1/handler/prometheus/remote/match.go index 4cfd0cd0d0..425516b5e4 100644 --- a/src/query/api/v1/handler/prometheus/remote/match.go +++ b/src/query/api/v1/handler/prometheus/remote/match.go @@ -24,6 +24,8 @@ import ( "io/ioutil" "net/http" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) // PromSeriesMatchHTTPMethods are the HTTP methods for this handler. diff --git a/src/query/api/v1/handler/prometheus/remote/read.go b/src/query/api/v1/handler/prometheus/remote/read.go index a7c44d5245..865071b995 100644 --- a/src/query/api/v1/handler/prometheus/remote/read.go +++ b/src/query/api/v1/handler/prometheus/remote/read.go @@ -31,6 +31,13 @@ import ( "sync" "time" + "github.com/golang/protobuf/proto" + "github.com/golang/snappy" + "github.com/prometheus/prometheus/model/labels" + promql "github.com/prometheus/prometheus/promql/parser" + "github.com/uber-go/tally" + "go.uber.org/zap" + comparator "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" @@ -48,13 +55,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" xhttp "github.com/m3db/m3/src/x/net/http" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/protobuf/proto" - "github.com/golang/snappy" - "github.com/prometheus/prometheus/model/labels" - promql "github.com/prometheus/prometheus/promql/parser" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/remote/read_test.go b/src/query/api/v1/handler/prometheus/remote/read_test.go index a4298918c1..2fc4da17c4 100644 --- a/src/query/api/v1/handler/prometheus/remote/read_test.go +++ b/src/query/api/v1/handler/prometheus/remote/read_test.go @@ -32,6 +32,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/dbnode/client" xmetrics "github.com/m3db/m3/src/dbnode/x/metrics" @@ -50,11 +55,6 @@ import ( xhttp "github.com/m3db/m3/src/x/net/http" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) var ( diff --git a/src/query/api/v1/handler/prometheus/remote/tag_values.go b/src/query/api/v1/handler/prometheus/remote/tag_values.go index 2c7acd7bec..644d375fc0 100644 --- a/src/query/api/v1/handler/prometheus/remote/tag_values.go +++ b/src/query/api/v1/handler/prometheus/remote/tag_values.go @@ -26,6 +26,9 @@ import ( "io/ioutil" "net/http" + "github.com/gorilla/mux" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -40,9 +43,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" xtime "github.com/m3db/m3/src/x/time" - - "github.com/gorilla/mux" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/remote/tag_values_test.go b/src/query/api/v1/handler/prometheus/remote/tag_values_test.go index 4a6133aa06..d1ebdbc157 100644 --- a/src/query/api/v1/handler/prometheus/remote/tag_values_test.go +++ b/src/query/api/v1/handler/prometheus/remote/tag_values_test.go @@ -31,6 +31,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/gorilla/mux" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/api/v1/route" @@ -41,11 +46,6 @@ import ( "github.com/m3db/m3/src/x/headers" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/gorilla/mux" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type tagValuesMatcher struct { diff --git a/src/query/api/v1/handler/prometheus/remote/test/read.go b/src/query/api/v1/handler/prometheus/remote/test/read.go index 8cde943cb6..ef141045b9 100644 --- a/src/query/api/v1/handler/prometheus/remote/test/read.go +++ b/src/query/api/v1/handler/prometheus/remote/test/read.go @@ -26,12 +26,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/generated/proto/prompb" - "github.com/golang/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/generated/proto/prompb" ) // GeneratePromReadRequest generates a Prometheus remote diff --git a/src/query/api/v1/handler/prometheus/remote/test/write.go b/src/query/api/v1/handler/prometheus/remote/test/write.go index 01fe64066d..afa4d6f211 100644 --- a/src/query/api/v1/handler/prometheus/remote/test/write.go +++ b/src/query/api/v1/handler/prometheus/remote/test/write.go @@ -26,12 +26,12 @@ import ( "io/ioutil" "time" - "github.com/m3db/m3/src/query/generated/proto/prompb" - "github.com/golang/protobuf/proto" "github.com/golang/snappy" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/generated/proto/prompb" ) // GeneratePromWriteRequest generates a Prometheus remote diff --git a/src/query/api/v1/handler/prometheus/remote/write.go b/src/query/api/v1/handler/prometheus/remote/write.go index a9499e1df1..2c31c2ff21 100644 --- a/src/query/api/v1/handler/prometheus/remote/write.go +++ b/src/query/api/v1/handler/prometheus/remote/write.go @@ -33,6 +33,13 @@ import ( "sync/atomic" "time" + "github.com/cespare/xxhash/v2" + "github.com/golang/protobuf/proto" + "github.com/golang/snappy" + murmur3 "github.com/m3db/stackmurmur3/v2" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/metrics/policy" @@ -54,13 +61,6 @@ import ( "github.com/m3db/m3/src/x/retry" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/cespare/xxhash/v2" - "github.com/golang/protobuf/proto" - "github.com/golang/snappy" - murmur3 "github.com/m3db/stackmurmur3/v2" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/prometheus/remote/write_test.go b/src/query/api/v1/handler/prometheus/remote/write_test.go index b052e1e4c3..4571ce7f18 100644 --- a/src/query/api/v1/handler/prometheus/remote/write_test.go +++ b/src/query/api/v1/handler/prometheus/remote/write_test.go @@ -34,6 +34,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/dbnode/generated/proto/annotation" @@ -49,11 +54,6 @@ import ( "github.com/m3db/m3/src/x/headers" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func makeOptions(ds ingest.DownsamplerAndWriter) options.HandlerOptions { diff --git a/src/query/api/v1/handler/prometheus/response.go b/src/query/api/v1/handler/prometheus/response.go index a28384e162..302f9a42f8 100644 --- a/src/query/api/v1/handler/prometheus/response.go +++ b/src/query/api/v1/handler/prometheus/response.go @@ -41,7 +41,7 @@ type data struct { // ResultType is the type of Result (matrix, vector, etc.). ResultType string // Result contains the query result (concrete type depends on ResultType). - Result result + Result result } type result interface { diff --git a/src/query/api/v1/handler/search.go b/src/query/api/v1/handler/search.go index ee096b8fa7..eb4b789899 100644 --- a/src/query/api/v1/handler/search.go +++ b/src/query/api/v1/handler/search.go @@ -27,6 +27,8 @@ import ( "net/http" "strconv" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" "github.com/m3db/m3/src/query/errors" @@ -35,8 +37,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/search_test.go b/src/query/api/v1/handler/search_test.go index b31cffe61a..790eaf076c 100644 --- a/src/query/api/v1/handler/search_test.go +++ b/src/query/api/v1/handler/search_test.go @@ -31,6 +31,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/api/v1/options" @@ -42,10 +46,6 @@ import ( "github.com/m3db/m3/src/x/ident" xhttp "github.com/m3db/m3/src/x/net/http" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/api/v1/handler/topic/add.go b/src/query/api/v1/handler/topic/add.go index f7f006d9e0..8676b2e38d 100644 --- a/src/query/api/v1/handler/topic/add.go +++ b/src/query/api/v1/handler/topic/add.go @@ -23,6 +23,8 @@ package topic import ( "net/http" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -32,13 +34,11 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( // AddURL is the url for the topic add handler (with the POST method). - AddURL = route.Prefix + "/topic" + AddURL = route.Prefix + _topic // AddHTTPMethod is the HTTP method used with this resource. AddHTTPMethod = http.MethodPost diff --git a/src/query/api/v1/handler/topic/add_test.go b/src/query/api/v1/handler/topic/add_test.go index 4ec7fd58af..681521ca97 100644 --- a/src/query/api/v1/handler/topic/add_test.go +++ b/src/query/api/v1/handler/topic/add_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/msg/generated/proto/topicpb" "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestTopicAddHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/topic/common.go b/src/query/api/v1/handler/topic/common.go index b316d9aec9..6d45e01ac4 100644 --- a/src/query/api/v1/handler/topic/common.go +++ b/src/query/api/v1/handler/topic/common.go @@ -24,6 +24,9 @@ import ( "net/http" "strings" + "github.com/gogo/protobuf/jsonpb" + "github.com/gogo/protobuf/proto" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/util/queryhttp" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" ) const ( @@ -42,6 +42,8 @@ const ( DefaultTopicName = "aggregated_metrics" // HeaderTopicName is the header used to specify the topic name. HeaderTopicName = "topic-name" + + _topic = "/topic" ) type serviceFn func(clusterClient clusterclient.Client, opts handleroptions.ServiceOptions) (topic.Service, error) diff --git a/src/query/api/v1/handler/topic/delete.go b/src/query/api/v1/handler/topic/delete.go index decab92b33..fe590e08d8 100644 --- a/src/query/api/v1/handler/topic/delete.go +++ b/src/query/api/v1/handler/topic/delete.go @@ -24,6 +24,8 @@ import ( "fmt" "net/http" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" @@ -33,13 +35,11 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( // DeleteURL is the url for the topic delete handler (with the DELETE method). - DeleteURL = route.Prefix + "/topic" + DeleteURL = route.Prefix + _topic // DeleteHTTPMethod is the HTTP method used with this resource. DeleteHTTPMethod = http.MethodDelete diff --git a/src/query/api/v1/handler/topic/delete_test.go b/src/query/api/v1/handler/topic/delete_test.go index 80debe39a2..80b0ce6546 100644 --- a/src/query/api/v1/handler/topic/delete_test.go +++ b/src/query/api/v1/handler/topic/delete_test.go @@ -26,13 +26,13 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/cluster/kv" - "github.com/m3db/m3/src/cmd/services/m3query/config" - "github.com/m3db/m3/src/x/instrument" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/kv" + "github.com/m3db/m3/src/cmd/services/m3query/config" + "github.com/m3db/m3/src/x/instrument" ) func TestTopicDeleteHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/topic/get.go b/src/query/api/v1/handler/topic/get.go index 54b65e707f..a7469ee38c 100644 --- a/src/query/api/v1/handler/topic/get.go +++ b/src/query/api/v1/handler/topic/get.go @@ -23,6 +23,8 @@ package topic import ( "net/http" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -32,13 +34,11 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( // GetURL is the url for the topic get handler (with the GET method). - GetURL = route.Prefix + "/topic" + GetURL = route.Prefix + _topic // GetHTTPMethod is the HTTP method used with this resource. GetHTTPMethod = http.MethodGet diff --git a/src/query/api/v1/handler/topic/get_test.go b/src/query/api/v1/handler/topic/get_test.go index e1f04c1a15..921b96aebd 100644 --- a/src/query/api/v1/handler/topic/get_test.go +++ b/src/query/api/v1/handler/topic/get_test.go @@ -28,14 +28,14 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/msg/generated/proto/topicpb" "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestTopicGetHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/topic/init.go b/src/query/api/v1/handler/topic/init.go index 64fc6466d7..4fe387df4e 100644 --- a/src/query/api/v1/handler/topic/init.go +++ b/src/query/api/v1/handler/topic/init.go @@ -23,6 +23,8 @@ package topic import ( "net/http" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -32,8 +34,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/handler/topic/init_test.go b/src/query/api/v1/handler/topic/init_test.go index 7e33e8d8ad..539b55075c 100644 --- a/src/query/api/v1/handler/topic/init_test.go +++ b/src/query/api/v1/handler/topic/init_test.go @@ -28,14 +28,14 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/msg/generated/proto/topicpb" "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestPlacementInitHandler(t *testing.T) { diff --git a/src/query/api/v1/handler/topic/update.go b/src/query/api/v1/handler/topic/update.go index 98ecb50819..e4bfe9aa53 100644 --- a/src/query/api/v1/handler/topic/update.go +++ b/src/query/api/v1/handler/topic/update.go @@ -23,6 +23,9 @@ package topic import ( "net/http" + pkgerrors "github.com/pkg/errors" + "go.uber.org/zap" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -32,14 +35,11 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - pkgerrors "github.com/pkg/errors" - "go.uber.org/zap" ) const ( // UpdateURL is the url for the topic update handler (with the PUT method). - UpdateURL = route.Prefix + "/topic" + UpdateURL = route.Prefix + _topic // UpdateHTTPMethod is the HTTP method used with this resource. UpdateHTTPMethod = http.MethodPut diff --git a/src/query/api/v1/handler/topic/update_test.go b/src/query/api/v1/handler/topic/update_test.go index ccff291961..3eba437e97 100644 --- a/src/query/api/v1/handler/topic/update_test.go +++ b/src/query/api/v1/handler/topic/update_test.go @@ -27,15 +27,15 @@ import ( "net/http/httptest" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/msg/generated/proto/topicpb" "github.com/m3db/m3/src/msg/topic" "github.com/m3db/m3/src/query/generated/proto/admin" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/api/v1/httpd/graphite_router_test.go b/src/query/api/v1/httpd/graphite_router_test.go index bf21dd5948..0554c0d5fa 100644 --- a/src/query/api/v1/httpd/graphite_router_test.go +++ b/src/query/api/v1/httpd/graphite_router_test.go @@ -26,10 +26,10 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/query/api/v1/options" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/api/v1/options" ) func TestGraphiteRenderHandler(t *testing.T) { diff --git a/src/query/api/v1/httpd/handler.go b/src/query/api/v1/httpd/handler.go index 1bb8cb5cc3..126fe5c78b 100644 --- a/src/query/api/v1/httpd/handler.go +++ b/src/query/api/v1/httpd/handler.go @@ -28,6 +28,10 @@ import ( _ "net/http/pprof" "time" + "github.com/gorilla/mux" + "github.com/jonboulle/clockwork" + "go.uber.org/zap" + "github.com/m3db/m3/src/cluster/placementhandler" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -49,10 +53,6 @@ import ( "github.com/m3db/m3/src/query/util/queryhttp" xdebug "github.com/m3db/m3/src/x/debug" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gorilla/mux" - "github.com/jonboulle/clockwork" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/httpd/handler_test.go b/src/query/api/v1/httpd/handler_test.go index 532ed0b748..5e6970ab39 100644 --- a/src/query/api/v1/httpd/handler_test.go +++ b/src/query/api/v1/httpd/handler_test.go @@ -28,6 +28,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/prometheus/prometheus/promql" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + handleroptions3 "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -48,11 +53,6 @@ import ( "github.com/m3db/m3/src/query/test/m3" "github.com/m3db/m3/src/x/instrument" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/golang/mock/gomock" - "github.com/prometheus/prometheus/promql" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/api/v1/middleware/logging.go b/src/query/api/v1/middleware/logging.go index f612e7707c..3c956e3309 100644 --- a/src/query/api/v1/middleware/logging.go +++ b/src/query/api/v1/middleware/logging.go @@ -25,15 +25,15 @@ import ( "strings" "time" + "github.com/gorilla/mux" + "github.com/opentracing/opentracing-go" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/http" "github.com/m3db/m3/src/x/instrument" - - "github.com/gorilla/mux" - "github.com/opentracing/opentracing-go" - "go.uber.org/zap" ) // RequestID populates the request scoped logger with a unique request ID. diff --git a/src/query/api/v1/middleware/logging_test.go b/src/query/api/v1/middleware/logging_test.go index 0b2715b495..7baff19606 100644 --- a/src/query/api/v1/middleware/logging_test.go +++ b/src/query/api/v1/middleware/logging_test.go @@ -29,14 +29,14 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/util/logging" - "github.com/m3db/m3/src/x/instrument" - "github.com/jonboulle/clockwork" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/m3db/m3/src/query/util/logging" + "github.com/m3db/m3/src/x/instrument" ) type httpWriter struct { diff --git a/src/query/api/v1/middleware/metrics.go b/src/query/api/v1/middleware/metrics.go index 55ddefd02d..ba4d4c361a 100644 --- a/src/query/api/v1/middleware/metrics.go +++ b/src/query/api/v1/middleware/metrics.go @@ -26,14 +26,14 @@ import ( "sync" "time" + "github.com/gorilla/mux" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/parser/promql" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/http" "github.com/m3db/m3/src/x/instrument" - - "github.com/gorilla/mux" - "github.com/uber-go/tally" ) const ( diff --git a/src/query/api/v1/middleware/metrics_test.go b/src/query/api/v1/middleware/metrics_test.go index 521aac803b..3d210cb658 100644 --- a/src/query/api/v1/middleware/metrics_test.go +++ b/src/query/api/v1/middleware/metrics_test.go @@ -27,16 +27,16 @@ import ( "testing" "time" + "github.com/gorilla/mux" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/query/parser/promql" "github.com/m3db/m3/src/x/headers" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/tallytest" - - "github.com/gorilla/mux" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestResponseMetrics(t *testing.T) { diff --git a/src/query/api/v1/middleware/middleware.go b/src/query/api/v1/middleware/middleware.go index aed1bac1e5..b62364b40a 100644 --- a/src/query/api/v1/middleware/middleware.go +++ b/src/query/api/v1/middleware/middleware.go @@ -24,13 +24,13 @@ package middleware import ( "net/http" - "github.com/m3db/m3/src/x/instrument" - "github.com/m3db/m3/src/x/net/http/cors" - "github.com/gorilla/mux" "github.com/jonboulle/clockwork" "github.com/opentracing/opentracing-go" "github.com/prometheus/prometheus/util/httputil" + + "github.com/m3db/m3/src/x/instrument" + "github.com/m3db/m3/src/x/net/http/cors" ) // Register is a func to build the set of middleware functions. diff --git a/src/query/api/v1/middleware/middleware_test.go b/src/query/api/v1/middleware/middleware_test.go index 22bb4c723f..6bdc23ba5a 100644 --- a/src/query/api/v1/middleware/middleware_test.go +++ b/src/query/api/v1/middleware/middleware_test.go @@ -28,9 +28,6 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/query/util/logging" - "github.com/m3db/m3/src/x/instrument" - "github.com/gorilla/mux" "github.com/opentracing/opentracing-go/mocktracer" "github.com/stretchr/testify/assert" @@ -38,6 +35,9 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" + + "github.com/m3db/m3/src/query/util/logging" + "github.com/m3db/m3/src/x/instrument" ) func TestTracing(t *testing.T) { diff --git a/src/query/api/v1/middleware/panic.go b/src/query/api/v1/middleware/panic.go index d99d9bcfcc..6e9a59d7c1 100644 --- a/src/query/api/v1/middleware/panic.go +++ b/src/query/api/v1/middleware/panic.go @@ -25,13 +25,13 @@ import ( "net/http" "sync" - "github.com/m3db/m3/src/query/util/logging" - "github.com/m3db/m3/src/x/instrument" - xhttp "github.com/m3db/m3/src/x/net/http" - "github.com/gorilla/mux" "go.uber.org/zap" "go.uber.org/zap/zapcore" + + "github.com/m3db/m3/src/query/util/logging" + "github.com/m3db/m3/src/x/instrument" + xhttp "github.com/m3db/m3/src/x/net/http" ) var highPriority = zap.LevelEnablerFunc(func(lvl zapcore.Level) bool { diff --git a/src/query/api/v1/middleware/request_classification.go b/src/query/api/v1/middleware/request_classification.go index e3966cbf45..2f6167e007 100644 --- a/src/query/api/v1/middleware/request_classification.go +++ b/src/query/api/v1/middleware/request_classification.go @@ -26,14 +26,14 @@ import ( "strings" "time" + "github.com/prometheus/prometheus/promql/parser" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/api/v1/handler/prometheus" "github.com/m3db/m3/src/query/api/v1/route" "github.com/m3db/m3/src/x/headers" - - "github.com/prometheus/prometheus/promql/parser" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const ( diff --git a/src/query/api/v1/middleware/rewrite.go b/src/query/api/v1/middleware/rewrite.go index b5d67a6e0f..a55ca812f7 100644 --- a/src/query/api/v1/middleware/rewrite.go +++ b/src/query/api/v1/middleware/rewrite.go @@ -29,17 +29,17 @@ import ( "net/url" "time" - "github.com/m3db/m3/src/query/api/v1/handler/prometheus" - "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" - "github.com/m3db/m3/src/query/storage" - xhttp "github.com/m3db/m3/src/x/net/http" - xtime "github.com/m3db/m3/src/x/time" - "github.com/gorilla/mux" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" promstorage "github.com/prometheus/prometheus/storage" "go.uber.org/zap" + + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" + "github.com/m3db/m3/src/query/storage" + xhttp "github.com/m3db/m3/src/x/net/http" + xtime "github.com/m3db/m3/src/x/time" ) var errIgnorableQuerierError = errors.New("ignorable error") diff --git a/src/query/api/v1/middleware/rewrite_test.go b/src/query/api/v1/middleware/rewrite_test.go index 7ff7e29c7f..0c79615682 100644 --- a/src/query/api/v1/middleware/rewrite_test.go +++ b/src/query/api/v1/middleware/rewrite_test.go @@ -29,17 +29,17 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" - "github.com/m3db/m3/src/query/storage/m3/storagemetadata" - "github.com/m3db/m3/src/query/storage/mock" - "github.com/m3db/m3/src/x/instrument" - "github.com/go-kit/kit/log" kitlogzap "github.com/go-kit/kit/log/zap" "github.com/gorilla/mux" "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" + + "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" + "github.com/m3db/m3/src/query/storage/m3/storagemetadata" + "github.com/m3db/m3/src/query/storage/mock" + "github.com/m3db/m3/src/x/instrument" ) func TestPrometheusRangeRewrite(t *testing.T) { diff --git a/src/query/api/v1/middleware/source.go b/src/query/api/v1/middleware/source.go index 153eb7f3ed..86664e1d26 100644 --- a/src/query/api/v1/middleware/source.go +++ b/src/query/api/v1/middleware/source.go @@ -24,13 +24,13 @@ import ( "fmt" "net/http" + "github.com/gorilla/mux" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/source" "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/headers" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gorilla/mux" - "go.uber.org/zap" ) var errInvalidSourceHeader = xhttp.NewError( diff --git a/src/query/api/v1/middleware/source_test.go b/src/query/api/v1/middleware/source_test.go index 7532999349..00159e2e1d 100644 --- a/src/query/api/v1/middleware/source_test.go +++ b/src/query/api/v1/middleware/source_test.go @@ -27,16 +27,16 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/query/source" - "github.com/m3db/m3/src/query/util/logging" - "github.com/m3db/m3/src/x/headers" - "github.com/m3db/m3/src/x/instrument" - "github.com/gorilla/mux" "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zapcore" "go.uber.org/zap/zaptest/observer" + + "github.com/m3db/m3/src/query/source" + "github.com/m3db/m3/src/query/util/logging" + "github.com/m3db/m3/src/x/headers" + "github.com/m3db/m3/src/x/instrument" ) type testSource struct { diff --git a/src/query/api/v1/middleware/tracing.go b/src/query/api/v1/middleware/tracing.go index f84df53f7a..2d41c82afa 100644 --- a/src/query/api/v1/middleware/tracing.go +++ b/src/query/api/v1/middleware/tracing.go @@ -25,15 +25,15 @@ import ( "net/http" "strconv" - "github.com/m3db/m3/src/query/util/logging" - "github.com/m3db/m3/src/x/instrument" - "github.com/gorilla/mux" "github.com/opentracing-contrib/go-stdlib/nethttp" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/mocktracer" "github.com/uber/jaeger-client-go" "go.uber.org/zap" + + "github.com/m3db/m3/src/query/util/logging" + "github.com/m3db/m3/src/x/instrument" ) // Tracing applies OpenTracing compatible middleware, which will start a span diff --git a/src/query/api/v1/options/handler.go b/src/query/api/v1/options/handler.go index 0c15698cc3..9e1a09ae6f 100644 --- a/src/query/api/v1/options/handler.go +++ b/src/query/api/v1/options/handler.go @@ -27,6 +27,9 @@ import ( "strings" "time" + "github.com/prometheus/prometheus/promql" + "google.golang.org/protobuf/runtime/protoiface" + clusterclient "github.com/m3db/m3/src/cluster/client" placementhandleroptions "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/cmd/services/m3coordinator/ingest" @@ -45,9 +48,6 @@ import ( "github.com/m3db/m3/src/query/ts" "github.com/m3db/m3/src/x/clock" "github.com/m3db/m3/src/x/instrument" - - "github.com/prometheus/prometheus/promql" - "google.golang.org/protobuf/runtime/protoiface" ) // QueryEngine is a type of query engine. @@ -64,7 +64,8 @@ const ( // a fixed lookback, so we have to create multiple engines for different lookback values. // // TODO(vilius): there's a conversation at Prometheus mailing list about making lookback dynamic -// https://groups.google.com/g/prometheus-developers/c/9wzuobfLMV8 +// +// https://groups.google.com/g/prometheus-developers/c/9wzuobfLMV8 type PromQLEngineFn func(lookbackDuration time.Duration) (*promql.Engine, error) // OptionTransformFn transforms given handler options. diff --git a/src/query/api/v1/validators/validators.go b/src/query/api/v1/validators/validators.go index 4b521699b6..ba87719507 100644 --- a/src/query/api/v1/validators/validators.go +++ b/src/query/api/v1/validators/validators.go @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -//package validators contains validation logics for the api. +// Package validators contains validation logics for the api. package validators import ( diff --git a/src/query/block/column_test.go b/src/query/block/column_test.go index b341792c4c..85520e2547 100644 --- a/src/query/block/column_test.go +++ b/src/query/block/column_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/query/models" ) func makeTestQueryContext() *models.QueryContext { diff --git a/src/query/block/container_test.go b/src/query/block/container_test.go index 5fc22ad99c..9b2365a696 100644 --- a/src/query/block/container_test.go +++ b/src/query/block/container_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/ts" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestInvalidContainerBlock(t *testing.T) { diff --git a/src/query/block/lazy_test.go b/src/query/block/lazy_test.go index ab683c9800..58c246564a 100644 --- a/src/query/block/lazy_test.go +++ b/src/query/block/lazy_test.go @@ -25,13 +25,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - "github.com/m3db/m3/src/query/ts" - xtime "github.com/m3db/m3/src/x/time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" + "github.com/m3db/m3/src/query/ts" + xtime "github.com/m3db/m3/src/x/time" ) func buildMeta(start xtime.UnixNano) Metadata { diff --git a/src/query/block/meta_test.go b/src/query/block/meta_test.go index 8e40bcafe4..d21ef55fdf 100644 --- a/src/query/block/meta_test.go +++ b/src/query/block/meta_test.go @@ -25,10 +25,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" ) func TestMeta(t *testing.T) { diff --git a/src/query/block/scalar_test.go b/src/query/block/scalar_test.go index b2879d19ae..b02e48e402 100644 --- a/src/query/block/scalar_test.go +++ b/src/query/block/scalar_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" ) var ( diff --git a/src/query/cluster/m3db/async_client_test.go b/src/query/cluster/m3db/async_client_test.go index 9b1e972642..3f00f99cd2 100644 --- a/src/query/cluster/m3db/async_client_test.go +++ b/src/query/cluster/m3db/async_client_test.go @@ -26,12 +26,12 @@ import ( "sync" "testing" - "github.com/m3db/m3/src/cluster/client" - "github.com/m3db/m3/src/cluster/services" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/client" + "github.com/m3db/m3/src/cluster/services" ) func SetupAsyncClientTest(t *testing.T) (*client.MockClient, *services.MockServices) { diff --git a/src/query/config/config_test.go b/src/query/config/config_test.go index 24ef074cfe..6c3c6404d6 100644 --- a/src/query/config/config_test.go +++ b/src/query/config/config_test.go @@ -25,10 +25,10 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cmd/services/m3query/config" xconfig "github.com/m3db/m3/src/x/config" - - "github.com/stretchr/testify/require" ) // TestProvidedConfigFiles ensures that the files in this directly are all valid, and will load. diff --git a/src/query/executor/engine.go b/src/query/executor/engine.go index c8bd17937c..cd140b1c66 100644 --- a/src/query/executor/engine.go +++ b/src/query/executor/engine.go @@ -24,13 +24,13 @@ import ( "context" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/x/opentracing" - - "github.com/uber-go/tally" ) type engine struct { diff --git a/src/query/executor/engine_test.go b/src/query/executor/engine_test.go index 9f4c9cae10..85ba51286c 100644 --- a/src/query/executor/engine_test.go +++ b/src/query/executor/engine_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" @@ -35,10 +39,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/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func newEngine( diff --git a/src/query/executor/request.go b/src/query/executor/request.go index 87d82d2dbd..71f69a2d8b 100644 --- a/src/query/executor/request.go +++ b/src/query/executor/request.go @@ -24,6 +24,8 @@ import ( "context" "fmt" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/plan" @@ -31,8 +33,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/opentracing" - - "go.uber.org/zap" ) // State is the request state. diff --git a/src/query/executor/result.go b/src/query/executor/result.go index 053b785639..c57a933e82 100644 --- a/src/query/executor/result.go +++ b/src/query/executor/result.go @@ -23,11 +23,12 @@ package executor import ( "sync" + "github.com/pkg/errors" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" - "github.com/pkg/errors" ) type sink interface { diff --git a/src/query/executor/state.go b/src/query/executor/state.go index ba37ed2a69..e6eea175fb 100644 --- a/src/query/executor/state.go +++ b/src/query/executor/state.go @@ -24,6 +24,8 @@ import ( "context" "fmt" + "github.com/pkg/errors" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" @@ -31,8 +33,6 @@ import ( "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/util/execution" "github.com/m3db/m3/src/x/instrument" - - "github.com/pkg/errors" ) // ExecutionState represents the execution hierarchy. diff --git a/src/query/executor/state_test.go b/src/query/executor/state_test.go index 9d42601d05..18c1f39704 100644 --- a/src/query/executor/state_test.go +++ b/src/query/executor/state_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/functions" "github.com/m3db/m3/src/query/functions/aggregation" "github.com/m3db/m3/src/query/models" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/mock" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/executor/transform/cache.go b/src/query/executor/transform/cache.go index 6854b92a5d..7e7c5fd4d7 100644 --- a/src/query/executor/transform/cache.go +++ b/src/query/executor/transform/cache.go @@ -23,10 +23,10 @@ package transform import ( "sync" + "github.com/pkg/errors" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/parser" - - "github.com/pkg/errors" ) // BlockCache is used to cache blocks diff --git a/src/query/executor/transform/exec.go b/src/query/executor/transform/exec.go index 3812250793..1f162fc30f 100644 --- a/src/query/executor/transform/exec.go +++ b/src/query/executor/transform/exec.go @@ -38,9 +38,9 @@ type simpleOpNode interface { // It adds instrumentation to the processing, and handles propagating the block downstream. // OpNode's should call this as their implementation of the Process method: // -// func (n MyNode) Process(queryCtx *models.QueryContext, ID parser.NodeID, b block.Block) error { -// return transform.ProcessSimpleBlock(n, n.controller, queryCtx, ID, b) -// } +// func (n MyNode) Process(queryCtx *models.QueryContext, ID parser.NodeID, b block.Block) error { +// return transform.ProcessSimpleBlock(n, n.controller, queryCtx, ID, b) +// } func ProcessSimpleBlock( node simpleOpNode, controller *Controller, diff --git a/src/query/executor/transform/exec_test.go b/src/query/executor/transform/exec_test.go index d9e1335396..83f0d3df3f 100644 --- a/src/query/executor/transform/exec_test.go +++ b/src/query/executor/transform/exec_test.go @@ -26,18 +26,18 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/mocktracer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/functions/utils" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/opentracing/opentracing-go" - "github.com/opentracing/opentracing-go/mocktracer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestProcessSimpleBlock(t *testing.T) { diff --git a/src/query/functions/aggregation/absent_test.go b/src/query/functions/aggregation/absent_test.go index ea900f649e..6bb381f140 100644 --- a/src/query/functions/aggregation/absent_test.go +++ b/src/query/functions/aggregation/absent_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func toArgs(f float64) []interface{} { return []interface{}{f} } diff --git a/src/query/functions/aggregation/base_test.go b/src/query/functions/aggregation/base_test.go index acead3052c..c09bab32bc 100644 --- a/src/query/functions/aggregation/base_test.go +++ b/src/query/functions/aggregation/base_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/functions/aggregation/count_values_test.go b/src/query/functions/aggregation/count_values_test.go index bec2ceba82..5296b62bbb 100644 --- a/src/query/functions/aggregation/count_values_test.go +++ b/src/query/functions/aggregation/count_values_test.go @@ -24,6 +24,9 @@ import ( "math" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -31,9 +34,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestPadValuesWithNans(t *testing.T) { diff --git a/src/query/functions/aggregation/quantile_test.go b/src/query/functions/aggregation/quantile_test.go index c473eba44e..34316a7ecf 100644 --- a/src/query/functions/aggregation/quantile_test.go +++ b/src/query/functions/aggregation/quantile_test.go @@ -24,13 +24,13 @@ import ( "math" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/functions/aggregation/take_test.go b/src/query/functions/aggregation/take_test.go index a86d27c2f0..d2a67a5680 100644 --- a/src/query/functions/aggregation/take_test.go +++ b/src/query/functions/aggregation/take_test.go @@ -25,6 +25,9 @@ import ( "math" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/functions/utils" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestTakeInstantFn(t *testing.T) { diff --git a/src/query/functions/binary/and_test.go b/src/query/functions/binary/and_test.go index fb970d292f..4a152c01ad 100644 --- a/src/query/functions/binary/and_test.go +++ b/src/query/functions/binary/and_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func emptyVectorMatcherBuilder(_, _ block.Block) VectorMatching { diff --git a/src/query/functions/binary/binary_test.go b/src/query/functions/binary/binary_test.go index 8a0c5deba2..acf5a845f1 100644 --- a/src/query/functions/binary/binary_test.go +++ b/src/query/functions/binary/binary_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/functions/utils" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var scalarTests = []struct { diff --git a/src/query/functions/binary/common_test.go b/src/query/functions/binary/common_test.go index 3e31cb1c9e..512fdd41d6 100644 --- a/src/query/functions/binary/common_test.go +++ b/src/query/functions/binary/common_test.go @@ -24,14 +24,14 @@ import ( "math" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var nan = math.NaN() diff --git a/src/query/functions/binary/or_test.go b/src/query/functions/binary/or_test.go index 2b8c10b5ac..ee21403078 100644 --- a/src/query/functions/binary/or_test.go +++ b/src/query/functions/binary/or_test.go @@ -26,6 +26,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestOrWithExactValues(t *testing.T) { diff --git a/src/query/functions/binary/unless_test.go b/src/query/functions/binary/unless_test.go index 41f3953053..00a02a44ed 100644 --- a/src/query/functions/binary/unless_test.go +++ b/src/query/functions/binary/unless_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func m(i int) indexMatcher { diff --git a/src/query/functions/fetch.go b/src/query/functions/fetch.go index 0a8cc4803f..d251d80142 100644 --- a/src/query/functions/fetch.go +++ b/src/query/functions/fetch.go @@ -24,6 +24,8 @@ import ( "fmt" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -32,8 +34,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/opentracing" - - "go.uber.org/zap" ) // FetchType gets the series from storage diff --git a/src/query/functions/fetch_test.go b/src/query/functions/fetch_test.go index 72a1aa668e..9c62e54467 100644 --- a/src/query/functions/fetch_test.go +++ b/src/query/functions/fetch_test.go @@ -25,6 +25,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" @@ -37,11 +42,6 @@ import ( "github.com/m3db/m3/src/query/test/executor" "github.com/m3db/m3/src/query/test/transformtest" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" ) func TestFetch(t *testing.T) { diff --git a/src/query/functions/lazy/base_test.go b/src/query/functions/lazy/base_test.go index 6d9bb6bc01..597059dfe8 100644 --- a/src/query/functions/lazy/base_test.go +++ b/src/query/functions/lazy/base_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/block" - "github.com/m3db/m3/src/query/executor/transform" - xtime "github.com/m3db/m3/src/x/time" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/block" + "github.com/m3db/m3/src/query/executor/transform" + xtime "github.com/m3db/m3/src/x/time" ) func testLazyOpts(timeOffset time.Duration, valOffset float64) block.LazyOptions { diff --git a/src/query/functions/linear/clamp_test.go b/src/query/functions/linear/clamp_test.go index dd6b96b7cc..93a40cfa60 100644 --- a/src/query/functions/linear/clamp_test.go +++ b/src/query/functions/linear/clamp_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // nolint diff --git a/src/query/functions/linear/datetime_test.go b/src/query/functions/linear/datetime_test.go index daf00f489e..6535dce7c5 100644 --- a/src/query/functions/linear/datetime_test.go +++ b/src/query/functions/linear/datetime_test.go @@ -25,15 +25,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var withArg = []interface{}{struct{}{}} diff --git a/src/query/functions/linear/histogram_quantile_test.go b/src/query/functions/linear/histogram_quantile_test.go index 850d842b20..2d11e96d00 100644 --- a/src/query/functions/linear/histogram_quantile_test.go +++ b/src/query/functions/linear/histogram_quantile_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestGatherSeriesToBuckets(t *testing.T) { diff --git a/src/query/functions/linear/math_test.go b/src/query/functions/linear/math_test.go index 255000566b..9257eb83a7 100644 --- a/src/query/functions/linear/math_test.go +++ b/src/query/functions/linear/math_test.go @@ -24,15 +24,15 @@ import ( "math" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func expectedMathVals(values [][]float64, fn func(x float64) float64) [][]float64 { diff --git a/src/query/functions/linear/round_test.go b/src/query/functions/linear/round_test.go index f23156e330..cd3502060c 100644 --- a/src/query/functions/linear/round_test.go +++ b/src/query/functions/linear/round_test.go @@ -25,14 +25,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/functions/linear/sort.go b/src/query/functions/linear/sort.go index 9d696b9d04..1a794dd396 100644 --- a/src/query/functions/linear/sort.go +++ b/src/query/functions/linear/sort.go @@ -64,7 +64,7 @@ type valueAndMeta struct { seriesMeta block.SeriesMeta } -type lessFn func (i, j float64) bool +type lessFn func(i, j float64) bool // Node creates an execution node func (o sortOp) Node( diff --git a/src/query/functions/linear/sort_test.go b/src/query/functions/linear/sort_test.go index e4fa4663fe..67b8f8fd59 100644 --- a/src/query/functions/linear/sort_test.go +++ b/src/query/functions/linear/sort_test.go @@ -25,6 +25,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/test/compare" "github.com/m3db/m3/src/query/test/executor" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestShouldFailWhenOpTypeIsInvalid(t *testing.T) { diff --git a/src/query/functions/scalar/scalar.go b/src/query/functions/scalar/scalar.go index a8af96007e..6afce26c0b 100644 --- a/src/query/functions/scalar/scalar.go +++ b/src/query/functions/scalar/scalar.go @@ -21,13 +21,13 @@ package scalar import ( + "go.uber.org/zap" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/util/logging" - - "go.uber.org/zap" ) const ( diff --git a/src/query/functions/scalar/scalar_test.go b/src/query/functions/scalar/scalar_test.go index e844c4875f..10e975716a 100644 --- a/src/query/functions/scalar/scalar_test.go +++ b/src/query/functions/scalar/scalar_test.go @@ -23,6 +23,9 @@ package scalar import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -30,9 +33,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/executor" "github.com/m3db/m3/src/query/test/transformtest" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestScalar(t *testing.T) { diff --git a/src/query/functions/scalar/time.go b/src/query/functions/scalar/time.go index 22d84ebdb6..9268b87b9d 100644 --- a/src/query/functions/scalar/time.go +++ b/src/query/functions/scalar/time.go @@ -21,13 +21,13 @@ package scalar import ( + "go.uber.org/zap" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/util/logging" - - "go.uber.org/zap" ) type timeOp struct { diff --git a/src/query/functions/scalar/time_test.go b/src/query/functions/scalar/time_test.go index 78ffeccdd2..d4dc72d42d 100644 --- a/src/query/functions/scalar/time_test.go +++ b/src/query/functions/scalar/time_test.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -31,9 +34,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/executor" "github.com/m3db/m3/src/query/test/transformtest" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestTime(t *testing.T) { diff --git a/src/query/functions/tag/join_test.go b/src/query/functions/tag/join_test.go index fb8b7b9296..13efb63e37 100644 --- a/src/query/functions/tag/join_test.go +++ b/src/query/functions/tag/join_test.go @@ -23,15 +23,15 @@ package tag import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestCombineSingleTagWithSeparator(t *testing.T) { diff --git a/src/query/functions/tag/replace_test.go b/src/query/functions/tag/replace_test.go index a261751373..326f27a494 100644 --- a/src/query/functions/tag/replace_test.go +++ b/src/query/functions/tag/replace_test.go @@ -24,15 +24,15 @@ import ( "regexp" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestReplace(t *testing.T) { diff --git a/src/query/functions/temporal/aggregation_test.go b/src/query/functions/temporal/aggregation_test.go index ed1b515c9d..1c6dad6ab6 100644 --- a/src/query/functions/temporal/aggregation_test.go +++ b/src/query/functions/temporal/aggregation_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/executor/transform" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/executor/transform" ) var aggregationTestCases = []testCase{ diff --git a/src/query/functions/temporal/base.go b/src/query/functions/temporal/base.go index 187b78fffc..ff482b11d9 100644 --- a/src/query/functions/temporal/base.go +++ b/src/query/functions/temporal/base.go @@ -27,6 +27,8 @@ import ( "sync" "time" + opentracing "github.com/opentracing/opentracing-go" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -36,8 +38,6 @@ import ( xcontext "github.com/m3db/m3/src/x/context" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - opentracing "github.com/opentracing/opentracing-go" ) var emptyOp = baseOp{} diff --git a/src/query/functions/temporal/base_test.go b/src/query/functions/temporal/base_test.go index d7de453f2e..6c9ededb60 100644 --- a/src/query/functions/temporal/base_test.go +++ b/src/query/functions/temporal/base_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" @@ -37,10 +41,6 @@ import ( "github.com/m3db/m3/src/query/ts" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var nan = math.NaN() diff --git a/src/query/functions/temporal/functions.go b/src/query/functions/temporal/functions.go index 12ddde4669..b5f7152f60 100644 --- a/src/query/functions/temporal/functions.go +++ b/src/query/functions/temporal/functions.go @@ -51,7 +51,7 @@ func (f functionProcessor) initialize( _ time.Duration, _ transform.Options, ) processor { - return &functionNode{ + return &functionNode{ comparisonFunc: f.compFunc, } } @@ -82,7 +82,7 @@ func NewFunctionOp(args []interface{}, optype string) (transform.Params, error) return newBaseOp(duration, optype, f) } -type functionNode struct { +type functionNode struct { comparisonFunc comparisonFunc } diff --git a/src/query/functions/temporal/functions_test.go b/src/query/functions/temporal/functions_test.go index b1749a425d..e9aecc0d37 100644 --- a/src/query/functions/temporal/functions_test.go +++ b/src/query/functions/temporal/functions_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/executor/transform" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/executor/transform" ) var temporalFunctionTestCases = []testCase{ diff --git a/src/query/functions/temporal/holt_winters_test.go b/src/query/functions/temporal/holt_winters_test.go index b66d99a08b..d9b85d1cd3 100644 --- a/src/query/functions/temporal/holt_winters_test.go +++ b/src/query/functions/temporal/holt_winters_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/test/compare" - - "github.com/stretchr/testify/require" ) var holtWintersTestCases = []testCase{ diff --git a/src/query/functions/temporal/linear_regression_test.go b/src/query/functions/temporal/linear_regression_test.go index 7d9f1c3a4c..a1c3372a6a 100644 --- a/src/query/functions/temporal/linear_regression_test.go +++ b/src/query/functions/temporal/linear_regression_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/executor/transform" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/executor/transform" ) var linearRegressionTestCases = []testCase{ diff --git a/src/query/functions/temporal/rate_test.go b/src/query/functions/temporal/rate_test.go index d33d06ad71..48f31927b0 100644 --- a/src/query/functions/temporal/rate_test.go +++ b/src/query/functions/temporal/rate_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/executor/transform" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/executor/transform" ) var rateTestCases = []testCase{ diff --git a/src/query/functions/unconsolidated/timestamp_test.go b/src/query/functions/unconsolidated/timestamp_test.go index e27a23d911..7c6add78f5 100644 --- a/src/query/functions/unconsolidated/timestamp_test.go +++ b/src/query/functions/unconsolidated/timestamp_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/query/test/executor" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestTimestamp(t *testing.T) { diff --git a/src/query/functions/utils/heap.go b/src/query/functions/utils/heap.go index 1587a1da00..f01687395c 100644 --- a/src/query/functions/utils/heap.go +++ b/src/query/functions/utils/heap.go @@ -49,13 +49,13 @@ func minHeapLess(i, j ValueIndexPair) bool { } // Compares two floats for equality with NaNs taken into account. -func equalWithNaNs(i,j float64) bool { +func equalWithNaNs(i, j float64) bool { return i == j || math.IsNaN(i) && math.IsNaN(j) } // Compares NaNs. // Basically, we do not want to add NaNs to the heap when it has reached it's cap so this fn should be used to prevent this. -func lesserIfNaNs(i,j float64) bool { +func lesserIfNaNs(i, j float64) bool { return math.IsNaN(i) && !math.IsNaN(j) } diff --git a/src/query/functions/utils/heap_test.go b/src/query/functions/utils/heap_test.go index c73249c9e0..e5e8e46944 100644 --- a/src/query/functions/utils/heap_test.go +++ b/src/query/functions/utils/heap_test.go @@ -26,9 +26,9 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/query/test/compare" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/query/test/compare" ) type maxSlice []ValueIndexPair @@ -331,8 +331,8 @@ func TestFlushOrderedWhenRandomInsertionOrderAndTakeNaNs(t *testing.T) { } func TestSortLesserWithNaNs(t *testing.T) { - actual := []float64{ 5.0, 4.1, math.NaN(), 8.6, 0.1 } - expected := []float64{ 0.1, 4.1, 5.0, 8.6, math.NaN() } + actual := []float64{5.0, 4.1, math.NaN(), 8.6, 0.1} + expected := []float64{0.1, 4.1, 5.0, 8.6, math.NaN()} sort.Slice(actual, func(i, j int) bool { return LesserWithNaNs(actual[i], actual[j]) @@ -342,8 +342,8 @@ func TestSortLesserWithNaNs(t *testing.T) { } func TestSortGreaterWithNaNs(t *testing.T) { - actual := []float64{ 5.0, 4.1, math.NaN(), 8.6, 0.1 } - expected := []float64{ 8.6, 5.0, 4.1, 0.1, math.NaN() } + actual := []float64{5.0, 4.1, math.NaN(), 8.6, 0.1} + expected := []float64{8.6, 5.0, 4.1, 0.1, math.NaN()} sort.Slice(actual, func(i, j int) bool { return GreaterWithNaNs(actual[i], actual[j]) diff --git a/src/query/functions/utils/metadata_test.go b/src/query/functions/utils/metadata_test.go index 9574aef338..1dd9fba4e6 100644 --- a/src/query/functions/utils/metadata_test.go +++ b/src/query/functions/utils/metadata_test.go @@ -23,11 +23,11 @@ package utils import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test" - - "github.com/stretchr/testify/assert" ) func TestFlattenMetadata(t *testing.T) { diff --git a/src/query/graphite/common/aggregation_test.go b/src/query/graphite/common/aggregation_test.go index 2b8805bf30..a30d125517 100644 --- a/src/query/graphite/common/aggregation_test.go +++ b/src/query/graphite/common/aggregation_test.go @@ -26,9 +26,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/ts" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/ts" ) func TestRangeOfSeries(t *testing.T) { diff --git a/src/query/graphite/common/basic_functions_test.go b/src/query/graphite/common/basic_functions_test.go index 31fb56c7e3..0a67705a93 100644 --- a/src/query/graphite/common/basic_functions_test.go +++ b/src/query/graphite/common/basic_functions_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/ts" - "github.com/m3db/m3/src/x/errors" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/ts" + "github.com/m3db/m3/src/x/errors" ) var ( diff --git a/src/query/graphite/common/test_util.go b/src/query/graphite/common/test_util.go index 1bc962fbd2..88592c3312 100644 --- a/src/query/graphite/common/test_util.go +++ b/src/query/graphite/common/test_util.go @@ -27,6 +27,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/graphite/context" "github.com/m3db/m3/src/query/graphite/storage" @@ -34,9 +37,6 @@ import ( "github.com/m3db/m3/src/query/graphite/ts" querystorage "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/m3/consolidators" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // TestSeries is used to create a tsdb.timeSeries diff --git a/src/query/graphite/common/transform_test.go b/src/query/graphite/common/transform_test.go index 6c58c90044..7a560c7ffb 100644 --- a/src/query/graphite/common/transform_test.go +++ b/src/query/graphite/common/transform_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - xtest "github.com/m3db/m3/src/query/graphite/testing" - "github.com/m3db/m3/src/query/graphite/ts" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + xtest "github.com/m3db/m3/src/query/graphite/testing" + "github.com/m3db/m3/src/query/graphite/ts" ) func testRenamer(series *ts.Series) string { diff --git a/src/query/graphite/graphite/graphite_types_test.go b/src/query/graphite/graphite/graphite_types_test.go index 6ebf6f64c5..b140374773 100644 --- a/src/query/graphite/graphite/graphite_types_test.go +++ b/src/query/graphite/graphite/graphite_types_test.go @@ -28,11 +28,11 @@ import ( "testing" "time" - xtest "github.com/m3db/m3/src/query/graphite/testing" - "github.com/hydrogen18/stalecucumber" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + xtest "github.com/m3db/m3/src/query/graphite/testing" ) func TestMarshalRenderResults(t *testing.T) { diff --git a/src/query/graphite/native/aggregation_functions.go b/src/query/graphite/native/aggregation_functions.go index 097a826d9f..dc590043db 100644 --- a/src/query/graphite/native/aggregation_functions.go +++ b/src/query/graphite/native/aggregation_functions.go @@ -520,7 +520,7 @@ given by nodeNum, then fill them into the template function provided (replacing Additional Examples: -Given keys of +# Given keys of - `stats.counts.haproxy.web.2XX` - `stats.counts.haproxy.web.3XX` @@ -620,12 +620,12 @@ func applyByNode(ctx *common.Context, seriesList singlePathSpec, nodeNum int, te // groupByNode takes a serieslist and maps a callback to subgroups within as defined by a common node // -// &target=groupByNode(foo.by-function.*.*.cpu.load5,2,"sumSeries") +// &target=groupByNode(foo.by-function.*.*.cpu.load5,2,"sumSeries") // -// Would return multiple series which are each the result of applying the "sumSeries" function -// to groups joined on the second node (0 indexed) resulting in a list of targets like +// Would return multiple series which are each the result of applying the "sumSeries" function +// to groups joined on the second node (0 indexed) resulting in a list of targets like // -// sumSeries(foo.by-function.server1.*.cpu.load5),sumSeries(foo.by-function.server2.*.cpu.load5),... +// sumSeries(foo.by-function.server1.*.cpu.load5),sumSeries(foo.by-function.server2.*.cpu.load5),... func groupByNode(ctx *common.Context, series singlePathSpec, node int, fname string) (ts.SeriesList, error) { return groupByNodes(ctx, series, fname, []int{node}...) } @@ -673,13 +673,18 @@ func getMetaSeriesGrouping(seriesList singlePathSpec, nodes []int) (map[string][ // Takes a serieslist and maps a callback to subgroups within as defined by multiple nodes // -// &target=groupByNodes(ganglia.server*.*.cpu.load*,"sum",1,4) +// &target=groupByNodes(ganglia.server*.*.cpu.load*,"sum",1,4) // // Would return multiple series which are each the result of applying the “sum” aggregation to groups joined on the // nodes’ list (0 indexed) resulting in a list of targets like // -// sumSeries(ganglia.server1.*.cpu.load5),sumSeries(ganglia.server1.*.cpu.load10),sumSeries(ganglia.server1.*.cpu.load15), -// sumSeries(ganglia.server2.*.cpu.load5),sumSeries(ganglia.server2.*.cpu.load10),sumSeries(ganglia.server2.*.cpu.load15),... +// sumSeries(ganglia.server1.*.cpu.load5), +// sumSeries(ganglia.server1.*.cpu.load10), +// sumSeries(ganglia.server1.*.cpu.load15), +// +// sumSeries(ganglia.server2.*.cpu.load5), +// sumSeries(ganglia.server2.*.cpu.load10), +// sumSeries(ganglia.server2.*.cpu.load15),... // // NOTE: if len(nodes) = 0, aggregate all series into 1 series. func groupByNodes(ctx *common.Context, seriesList singlePathSpec, fname string, nodes ...int) (ts.SeriesList, error) { diff --git a/src/query/graphite/native/aggregation_functions_test.go b/src/query/graphite/native/aggregation_functions_test.go index 13aed0bd95..1822b01939 100644 --- a/src/query/graphite/native/aggregation_functions_test.go +++ b/src/query/graphite/native/aggregation_functions_test.go @@ -27,16 +27,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/graphite/common" "github.com/m3db/m3/src/query/graphite/context" "github.com/m3db/m3/src/query/graphite/storage" "github.com/m3db/m3/src/query/graphite/ts" xgomock "github.com/m3db/m3/src/x/test" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/golang/mock/gomock" ) var ( diff --git a/src/query/graphite/native/alias_functions_test.go b/src/query/graphite/native/alias_functions_test.go index dfe68036d1..4b87f8046f 100644 --- a/src/query/graphite/native/alias_functions_test.go +++ b/src/query/graphite/native/alias_functions_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/graphite/common" "github.com/m3db/m3/src/query/graphite/storage" "github.com/m3db/m3/src/query/graphite/ts" xgomock "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestAlias(t *testing.T) { diff --git a/src/query/graphite/native/builtin_functions.go b/src/query/graphite/native/builtin_functions.go index 51b94d753b..9422343698 100644 --- a/src/query/graphite/native/builtin_functions.go +++ b/src/query/graphite/native/builtin_functions.go @@ -144,6 +144,7 @@ func sortByMaxima(ctx *common.Context, series singlePathSpec) (ts.SeriesList, er // the response time metric will be plotted only when the maximum value of the // corresponding request/s metric is > 10 // Example: useSeriesAbove(ganglia.metric1.reqs,10,"reqs","time") +// //nolint:govet,gocritic func useSeriesAbove( ctx *common.Context, @@ -961,9 +962,13 @@ func parseWindowSize(windowSizeValue genericInterface, input singlePathSpec) (wi // exponentialMovingAverage takes a series of values and a window size and produces // an exponential moving average utilizing the following formula: -// ema(current) = constant * (Current Value) + (1 - constant) * ema(previous) +// +// ema(current) = constant * (Current Value) + (1 - constant) * ema(previous) +// // The `constant` is calculated as: -// constant = 2 / (windowSize + 1) +// +// constant = 2 / (windowSize + 1) +// // the first period EMA uses a simple moving average for its value. func exponentialMovingAverage( ctx *common.Context, @@ -1455,7 +1460,8 @@ func derivativeTemplate(ctx *common.Context, input singlePathSpec, nameTemplate } // integral shows the sum over time, sort of like a continuous addition function. -// Useful for finding totals or trends in metrics that are collected per minute. +// +// Useful for finding totals or trends in metrics that are collected per minute. func integral(ctx *common.Context, input singlePathSpec) (ts.SeriesList, error) { results := make([]*ts.Series, 0, len(input.Values)) for _, series := range input.Values { diff --git a/src/query/graphite/native/builtin_functions_test.go b/src/query/graphite/native/builtin_functions_test.go index 69818f3b77..3b4382976e 100644 --- a/src/query/graphite/native/builtin_functions_test.go +++ b/src/query/graphite/native/builtin_functions_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/graphite/common" xctx "github.com/m3db/m3/src/query/graphite/context" @@ -37,10 +41,6 @@ import ( querystorage "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/m3/consolidators" xgomock "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/graphite/native/compiler_test.go b/src/query/graphite/native/compiler_test.go index 58c39cb5dd..3bb09168a3 100644 --- a/src/query/graphite/native/compiler_test.go +++ b/src/query/graphite/native/compiler_test.go @@ -25,16 +25,16 @@ import ( "math" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/graphite/common" "github.com/m3db/m3/src/query/graphite/lexer" "github.com/m3db/m3/src/query/graphite/storage" graphitetest "github.com/m3db/m3/src/query/graphite/testing" "github.com/m3db/m3/src/query/graphite/ts" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type testCompile struct { diff --git a/src/query/graphite/native/engine_test.go b/src/query/graphite/native/engine_test.go index 354777e320..5e716d714d 100644 --- a/src/query/graphite/native/engine_test.go +++ b/src/query/graphite/native/engine_test.go @@ -24,15 +24,15 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/graphite/common" "github.com/m3db/m3/src/query/graphite/context" "github.com/m3db/m3/src/query/graphite/storage" "github.com/m3db/m3/src/query/graphite/ts" xgomock "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type queryTestResult struct { diff --git a/src/query/graphite/native/functions_test.go b/src/query/graphite/native/functions_test.go index 9b1fb1f878..3b45cde994 100644 --- a/src/query/graphite/native/functions_test.go +++ b/src/query/graphite/native/functions_test.go @@ -26,11 +26,11 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/query/graphite/common" - xtest "github.com/m3db/m3/src/query/graphite/testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/common" + xtest "github.com/m3db/m3/src/query/graphite/testing" ) func f1(ctx *common.Context, a float64, b string, c bool) (string, error) { diff --git a/src/query/graphite/native/summarize_test.go b/src/query/graphite/native/summarize_test.go index cd930ddd74..11fd43f986 100644 --- a/src/query/graphite/native/summarize_test.go +++ b/src/query/graphite/native/summarize_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/common" - "github.com/m3db/m3/src/query/graphite/ts" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/common" + "github.com/m3db/m3/src/query/graphite/ts" ) func TestSummarize(t *testing.T) { diff --git a/src/query/graphite/storage/converter_test.go b/src/query/graphite/storage/converter_test.go index 88460d5fde..67736f9320 100644 --- a/src/query/graphite/storage/converter_test.go +++ b/src/query/graphite/storage/converter_test.go @@ -23,11 +23,11 @@ package storage import ( "testing" - "github.com/m3db/m3/src/query/graphite/graphite" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/graphite" + "github.com/m3db/m3/src/query/models" ) func TestConvertMetricPartToMatcher(t *testing.T) { diff --git a/src/query/graphite/storage/m3_wrapper.go b/src/query/graphite/storage/m3_wrapper.go index fc21e42707..4449fecb3a 100644 --- a/src/query/graphite/storage/m3_wrapper.go +++ b/src/query/graphite/storage/m3_wrapper.go @@ -29,6 +29,8 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/query/block" xctx "github.com/m3db/m3/src/query/graphite/context" @@ -42,8 +44,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "go.uber.org/zap" ) var errSeriesNoResolution = errors.New("series has no resolution set") diff --git a/src/query/graphite/storage/m3_wrapper_test.go b/src/query/graphite/storage/m3_wrapper_test.go index 92603ce441..1359791081 100644 --- a/src/query/graphite/storage/m3_wrapper_test.go +++ b/src/query/graphite/storage/m3_wrapper_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/m3ninx/doc" "github.com/m3db/m3/src/query/block" @@ -39,10 +43,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/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/graphite/testing/test_utils.go b/src/query/graphite/testing/test_utils.go index 3b08df0e09..8911251004 100644 --- a/src/query/graphite/testing/test_utils.go +++ b/src/query/graphite/testing/test_utils.go @@ -124,7 +124,7 @@ func InDeltaWithNaNs( // Equalish asserts that two objects are equal. Looser than assert.Equal since // it checks for equality of printing expected vs printing actual. // -// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// assert.Equal(t, 123, 123, "123 and 123 should be equal") // // Returns whether the assertion was successful (true) or not (false). func Equalish( diff --git a/src/query/graphite/ts/lttb_test.go b/src/query/graphite/ts/lttb_test.go index a8e2a65dc5..73206840c4 100644 --- a/src/query/graphite/ts/lttb_test.go +++ b/src/query/graphite/ts/lttb_test.go @@ -25,9 +25,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/context" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/context" ) func TestLTTB(t *testing.T) { diff --git a/src/query/graphite/ts/series_test.go b/src/query/graphite/ts/series_test.go index 1ea500ee4c..a861ef53a2 100644 --- a/src/query/graphite/ts/series_test.go +++ b/src/query/graphite/ts/series_test.go @@ -26,11 +26,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/context" - xtest "github.com/m3db/m3/src/query/graphite/testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/context" + xtest "github.com/m3db/m3/src/query/graphite/testing" ) // A Datapoint is a datapoint (timestamp, value, optional series) used in testing diff --git a/src/query/graphite/ts/sortable_series_test.go b/src/query/graphite/ts/sortable_series_test.go index 77b69d22b8..e4dcca5d96 100644 --- a/src/query/graphite/ts/sortable_series_test.go +++ b/src/query/graphite/ts/sortable_series_test.go @@ -27,11 +27,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/graphite/context" - xtest "github.com/m3db/m3/src/query/graphite/testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/context" + xtest "github.com/m3db/m3/src/query/graphite/testing" ) type testSeries struct { diff --git a/src/query/graphite/ts/values_test.go b/src/query/graphite/ts/values_test.go index c25e716ab7..ee2bb42d71 100644 --- a/src/query/graphite/ts/values_test.go +++ b/src/query/graphite/ts/values_test.go @@ -23,9 +23,9 @@ package ts import ( "testing" - "github.com/m3db/m3/src/query/graphite/context" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/graphite/context" ) func TestValuesClose(t *testing.T) { diff --git a/src/query/models/query_context.go b/src/query/models/query_context.go index 883b9871f0..629ad2face 100644 --- a/src/query/models/query_context.go +++ b/src/query/models/query_context.go @@ -23,9 +23,9 @@ package models import ( "context" - "github.com/m3db/m3/src/metrics/policy" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/metrics/policy" ) // QueryContext provides all external state needed to execute and track a query. diff --git a/src/query/models/tags.go b/src/query/models/tags.go index 2baee6121a..054c8ffa04 100644 --- a/src/query/models/tags.go +++ b/src/query/models/tags.go @@ -27,10 +27,10 @@ import ( "sort" "strings" + "github.com/cespare/xxhash/v2" + "github.com/m3db/m3/src/metrics/generated/proto/metricpb" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/cespare/xxhash/v2" ) var ( diff --git a/src/query/models/tags_test.go b/src/query/models/tags_test.go index 15769142bc..df1f18b84f 100644 --- a/src/query/models/tags_test.go +++ b/src/query/models/tags_test.go @@ -27,13 +27,13 @@ import ( "testing" "unsafe" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/graphite/graphite" "github.com/m3db/m3/src/query/util/writer" xerrors "github.com/m3db/m3/src/x/errors" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func testLongTagIDOutOfOrder(t *testing.T, scheme IDSchemeType) Tags { diff --git a/src/query/parser/promql/matcher_test.go b/src/query/parser/promql/matcher_test.go index b617cd89ec..2b5c7c2359 100644 --- a/src/query/parser/promql/matcher_test.go +++ b/src/query/parser/promql/matcher_test.go @@ -25,11 +25,11 @@ import ( "regexp" "testing" - "github.com/m3db/m3/src/query/models" - "github.com/prometheus/prometheus/model/labels" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" ) func TestLabelMatchesToModelMatcher(t *testing.T) { diff --git a/src/query/parser/promql/matchers.go b/src/query/parser/promql/matchers.go index f64ca1b6f0..df34967fcf 100644 --- a/src/query/parser/promql/matchers.go +++ b/src/query/parser/promql/matchers.go @@ -23,6 +23,10 @@ package promql import ( "fmt" + "github.com/prometheus/common/model" + "github.com/prometheus/prometheus/model/labels" + promql "github.com/prometheus/prometheus/promql/parser" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/functions" "github.com/m3db/m3/src/query/functions/aggregation" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" "github.com/m3db/m3/src/query/parser/common" - - "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/model/labels" - promql "github.com/prometheus/prometheus/promql/parser" ) // NewSelectorFromVector creates a new fetchop. diff --git a/src/query/parser/promql/options.go b/src/query/parser/promql/options.go index 7c83f7edbf..4d73db3e6e 100644 --- a/src/query/parser/promql/options.go +++ b/src/query/parser/promql/options.go @@ -23,12 +23,12 @@ package promql import ( "time" + "github.com/prometheus/prometheus/model/labels" + pql "github.com/prometheus/prometheus/promql/parser" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" xclock "github.com/m3db/m3/src/x/clock" - - "github.com/prometheus/prometheus/model/labels" - pql "github.com/prometheus/prometheus/promql/parser" ) // ParseFunctionExpr parses arguments to a function expression, returning diff --git a/src/query/parser/promql/parse.go b/src/query/parser/promql/parse.go index 2d8eb57847..2e44632498 100644 --- a/src/query/parser/promql/parse.go +++ b/src/query/parser/promql/parse.go @@ -24,6 +24,8 @@ import ( "fmt" "time" + pql "github.com/prometheus/prometheus/promql/parser" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/functions/binary" "github.com/m3db/m3/src/query/functions/lazy" @@ -31,8 +33,6 @@ import ( "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" xtime "github.com/m3db/m3/src/x/time" - - pql "github.com/prometheus/prometheus/promql/parser" ) type promParser struct { diff --git a/src/query/parser/promql/parse_test.go b/src/query/parser/promql/parse_test.go index 0872a7a653..07565ba53f 100644 --- a/src/query/parser/promql/parse_test.go +++ b/src/query/parser/promql/parse_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + pql "github.com/prometheus/prometheus/promql/parser" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/functions" "github.com/m3db/m3/src/query/functions/aggregation" "github.com/m3db/m3/src/query/functions/binary" @@ -35,10 +39,6 @@ import ( "github.com/m3db/m3/src/query/functions/temporal" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" - - pql "github.com/prometheus/prometheus/promql/parser" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestDAGWithCountOp(t *testing.T) { diff --git a/src/query/parser/promql/resolve_scalar_test.go b/src/query/parser/promql/resolve_scalar_test.go index 299ce57e6b..cfbb39ac91 100644 --- a/src/query/parser/promql/resolve_scalar_test.go +++ b/src/query/parser/promql/resolve_scalar_test.go @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - "github.com/m3db/m3/src/query/test/compare" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" + "github.com/m3db/m3/src/query/test/compare" ) var scalarResolverTests = []struct { @@ -114,4 +114,3 @@ func TestResolveStringWhenExprIsNil(t *testing.T) { _, err := resolveStringArgument(nil) require.Error(t, err) } - diff --git a/src/query/parser/promql/resolve_scalars.go b/src/query/parser/promql/resolve_scalars.go index 4388daa82d..c0678b610c 100644 --- a/src/query/parser/promql/resolve_scalars.go +++ b/src/query/parser/promql/resolve_scalars.go @@ -24,9 +24,9 @@ import ( "fmt" "math" - "github.com/m3db/m3/src/query/functions/binary" - pql "github.com/prometheus/prometheus/promql/parser" + + "github.com/m3db/m3/src/query/functions/binary" ) var ( diff --git a/src/query/plan/logical_test.go b/src/query/plan/logical_test.go index ab6bf306d3..94c8f06399 100644 --- a/src/query/plan/logical_test.go +++ b/src/query/plan/logical_test.go @@ -23,12 +23,12 @@ package plan import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/functions" "github.com/m3db/m3/src/query/functions/aggregation" "github.com/m3db/m3/src/query/parser" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestSingleChildParentRelation(t *testing.T) { diff --git a/src/query/plan/physical_test.go b/src/query/plan/physical_test.go index 04869d0ed1..d636417444 100644 --- a/src/query/plan/physical_test.go +++ b/src/query/plan/physical_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/functions" "github.com/m3db/m3/src/query/functions/aggregation" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/parser" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func testRequestParams() models.RequestParams { diff --git a/src/query/policy/filter/storage_test.go b/src/query/policy/filter/storage_test.go index 69ccbc7598..d3092eb9f8 100644 --- a/src/query/policy/filter/storage_test.go +++ b/src/query/policy/filter/storage_test.go @@ -23,10 +23,10 @@ package filter import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/mock" - - "github.com/stretchr/testify/assert" ) var ( diff --git a/src/query/pools/query_pools.go b/src/query/pools/query_pools.go index 120ad2c634..6386593da4 100644 --- a/src/query/pools/query_pools.go +++ b/src/query/pools/query_pools.go @@ -21,6 +21,8 @@ package pools import ( + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -32,8 +34,6 @@ import ( "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/serialize" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/uber-go/tally" ) const ( diff --git a/src/query/remote/client.go b/src/query/remote/client.go index 4cec2a7b71..d1015045ec 100644 --- a/src/query/remote/client.go +++ b/src/query/remote/client.go @@ -28,6 +28,11 @@ import ( "sync" "time" + "github.com/uber-go/tally" + "go.uber.org/zap" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/errors" @@ -41,11 +46,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" xgrpc "github.com/m3db/m3/src/x/grpc" "github.com/m3db/m3/src/x/instrument" - - "github.com/uber-go/tally" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" ) const ( diff --git a/src/query/remote/codecs.go b/src/query/remote/codecs.go index bea2aad943..0d0f6d7440 100644 --- a/src/query/remote/codecs.go +++ b/src/query/remote/codecs.go @@ -27,6 +27,8 @@ import ( "strings" "time" + "google.golang.org/grpc/metadata" + "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" "github.com/m3db/m3/src/query/block" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "google.golang.org/grpc/metadata" ) const reqIDKey = "reqid" diff --git a/src/query/remote/codecs_test.go b/src/query/remote/codecs_test.go index 8a1de4726c..f44891188b 100644 --- a/src/query/remote/codecs_test.go +++ b/src/query/remote/codecs_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/metadata" + "github.com/m3db/m3/src/metrics/generated/proto/policypb" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/api/v1/handler/prometheus/handleroptions" @@ -41,10 +45,6 @@ import ( "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc/metadata" ) var ( diff --git a/src/query/remote/compressed_codecs_test.go b/src/query/remote/compressed_codecs_test.go index 3b65c5d74b..cb2b50985f 100644 --- a/src/query/remote/compressed_codecs_test.go +++ b/src/query/remote/compressed_codecs_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" rpc "github.com/m3db/m3/src/query/generated/proto/rpcpb" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/query/test" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/remote/server.go b/src/query/remote/server.go index b9dfb4f63a..a1876d062f 100644 --- a/src/query/remote/server.go +++ b/src/query/remote/server.go @@ -25,6 +25,9 @@ import ( "sync" "time" + "go.uber.org/zap" + "google.golang.org/grpc" + "github.com/m3db/m3/src/dbnode/encoding" rpc "github.com/m3db/m3/src/query/generated/proto/rpcpb" "github.com/m3db/m3/src/query/models" @@ -33,9 +36,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3/consolidators" "github.com/m3db/m3/src/query/util/logging" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" - "google.golang.org/grpc" ) const poolTimeout = time.Second * 10 diff --git a/src/query/remote/server_test.go b/src/query/remote/server_test.go index d2dae39d5c..0a2360617e 100644 --- a/src/query/remote/server_test.go +++ b/src/query/remote/server_test.go @@ -30,6 +30,11 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" m3err "github.com/m3db/m3/src/query/errors" @@ -43,11 +48,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" ) var ( diff --git a/src/query/remote/static_resolver.go b/src/query/remote/static_resolver.go index a5a1407586..ce9e96859b 100644 --- a/src/query/remote/static_resolver.go +++ b/src/query/remote/static_resolver.go @@ -38,8 +38,8 @@ var _ resolver.Builder = (*staticResolverBuilder)(nil) // staticResolverBuilder implements resolver.Builder. // It constructs a staticResolver, which: -// - Always routes to a static list of endpoints (never updates) -// - Performs round-robin load balancing between them. +// - Always routes to a static list of endpoints (never updates) +// - Performs round-robin load balancing between them. type staticResolverBuilder struct { addresses []string } diff --git a/src/query/server/multi_process.go b/src/query/server/multi_process.go index 095573c016..f43b464c6a 100644 --- a/src/query/server/multi_process.go +++ b/src/query/server/multi_process.go @@ -29,11 +29,11 @@ import ( "strconv" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3query/config" xnet "github.com/m3db/m3/src/x/net" "github.com/m3db/m3/src/x/panicmon" - - "go.uber.org/zap" ) const ( diff --git a/src/query/server/query.go b/src/query/server/query.go index f4ed82eb7c..61020fadc5 100644 --- a/src/query/server/query.go +++ b/src/query/server/query.go @@ -30,6 +30,19 @@ import ( "strings" "time" + "github.com/go-kit/kit/log" + kitlogzap "github.com/go-kit/kit/log/zap" + "github.com/opentracing/opentracing-go" + "github.com/pkg/errors" + extprom "github.com/prometheus/client_golang/prometheus" + prometheuspromql "github.com/prometheus/prometheus/promql" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" + "github.com/m3db/m3/src/aggregator/server" clusterclient "github.com/m3db/m3/src/cluster/client" etcdclient "github.com/m3db/m3/src/cluster/client/etcd" @@ -73,19 +86,6 @@ import ( "github.com/m3db/m3/src/x/serialize" xserver "github.com/m3db/m3/src/x/server" xsync "github.com/m3db/m3/src/x/sync" - - "github.com/go-kit/kit/log" - kitlogzap "github.com/go-kit/kit/log/zap" - "github.com/opentracing/opentracing-go" - "github.com/pkg/errors" - extprom "github.com/prometheus/client_golang/prometheus" - prometheuspromql "github.com/prometheus/prometheus/promql" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" - "google.golang.org/grpc" - "google.golang.org/grpc/reflection" ) const ( diff --git a/src/query/server/query_test.go b/src/query/server/query_test.go index c3b64cafa8..cf493685b8 100644 --- a/src/query/server/query_test.go +++ b/src/query/server/query_test.go @@ -31,6 +31,14 @@ import ( "testing" "time" + "github.com/gogo/protobuf/proto" + "github.com/golang/mock/gomock" + "github.com/prometheus/prometheus/promql" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/atomic" + "google.golang.org/grpc" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/kv/mem" "github.com/m3db/m3/src/cmd/services/m3query/config" @@ -50,14 +58,6 @@ import ( "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/serialize" xtest "github.com/m3db/m3/src/x/test" - - "github.com/gogo/protobuf/proto" - "github.com/golang/mock/gomock" - "github.com/prometheus/prometheus/promql" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.uber.org/atomic" - "google.golang.org/grpc" ) var configYAML = ` diff --git a/src/query/storage/converter.go b/src/query/storage/converter.go index 759e4da5b4..a822752dca 100644 --- a/src/query/storage/converter.go +++ b/src/query/storage/converter.go @@ -26,13 +26,13 @@ import ( "sort" "time" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/dbnode/generated/proto/annotation" "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/common/model" ) var ( diff --git a/src/query/storage/converter_test.go b/src/query/storage/converter_test.go index 3551ef076f..99f722d61f 100644 --- a/src/query/storage/converter_test.go +++ b/src/query/storage/converter_test.go @@ -26,15 +26,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/generated/proto/annotation" "github.com/m3db/m3/src/query/generated/proto/prompb" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/ts" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestLabelConversion(t *testing.T) { diff --git a/src/query/storage/error_behavior_test.go b/src/query/storage/error_behavior_test.go index 779ef35edd..b9b4f2df7a 100644 --- a/src/query/storage/error_behavior_test.go +++ b/src/query/storage/error_behavior_test.go @@ -25,11 +25,11 @@ import ( "fmt" "testing" - xtest "github.com/m3db/m3/src/x/test" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + xtest "github.com/m3db/m3/src/x/test" ) func TestParseErrorBehavior(t *testing.T) { diff --git a/src/query/storage/fanout/storage.go b/src/query/storage/fanout/storage.go index 3de9afd346..10eca4d58d 100644 --- a/src/query/storage/fanout/storage.go +++ b/src/query/storage/fanout/storage.go @@ -27,6 +27,8 @@ import ( "sync" "time" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/errors" "github.com/m3db/m3/src/query/models" @@ -38,8 +40,6 @@ import ( "github.com/m3db/m3/src/query/util/execution" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) const ( diff --git a/src/query/storage/fanout/storage_test.go b/src/query/storage/fanout/storage_test.go index 3b81a0e9a2..9f4c5113a6 100644 --- a/src/query/storage/fanout/storage_test.go +++ b/src/query/storage/fanout/storage_test.go @@ -29,6 +29,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" @@ -47,10 +51,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/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func filterFunc(output bool) filter.Storage { diff --git a/src/query/storage/fetch.go b/src/query/storage/fetch.go index 01956c598b..6ba63820ef 100644 --- a/src/query/storage/fetch.go +++ b/src/query/storage/fetch.go @@ -23,10 +23,10 @@ package storage import ( "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" - - "github.com/uber-go/tally" ) const ( diff --git a/src/query/storage/index_test.go b/src/query/storage/index_test.go index 3d8931815a..b2c1c1cf86 100644 --- a/src/query/storage/index_test.go +++ b/src/query/storage/index_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/storage/m3/cluster_namespaces_watcher_test.go b/src/query/storage/m3/cluster_namespaces_watcher_test.go index eca1de1273..f46f84d41f 100644 --- a/src/query/storage/m3/cluster_namespaces_watcher_test.go +++ b/src/query/storage/m3/cluster_namespaces_watcher_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestClusterNamespacesWatcherGet(t *testing.T) { diff --git a/src/query/storage/m3/cluster_resolver_test.go b/src/query/storage/m3/cluster_resolver_test.go index e1a67f69b5..4b2c78b40d 100644 --- a/src/query/storage/m3/cluster_resolver_test.go +++ b/src/query/storage/m3/cluster_resolver_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/storage" @@ -34,10 +38,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFanoutAggregatedOptimizationDisabledGivesAllClustersAsPartial(t *testing.T) { diff --git a/src/query/storage/m3/cluster_test.go b/src/query/storage/m3/cluster_test.go index dcca0b2368..529bc049ab 100644 --- a/src/query/storage/m3/cluster_test.go +++ b/src/query/storage/m3/cluster_test.go @@ -26,16 +26,16 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNewClustersWithDuplicateAggregatedClusterNamespace(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/complete_tags_result_test.go b/src/query/storage/m3/consolidators/complete_tags_result_test.go index 464f0cbb24..3a0f2a3a52 100644 --- a/src/query/storage/m3/consolidators/complete_tags_result_test.go +++ b/src/query/storage/m3/consolidators/complete_tags_result_test.go @@ -23,15 +23,15 @@ package consolidators import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestExhaustiveTagMerge(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/completed_tags_test.go b/src/query/storage/m3/consolidators/completed_tags_test.go index 6d10882ad0..64ce3fc08f 100644 --- a/src/query/storage/m3/consolidators/completed_tags_test.go +++ b/src/query/storage/m3/consolidators/completed_tags_test.go @@ -25,11 +25,11 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/query/block" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/block" + "github.com/m3db/m3/src/query/models" ) func strsToBytes(str []string) [][]byte { diff --git a/src/query/storage/m3/consolidators/convert_test.go b/src/query/storage/m3/consolidators/convert_test.go index 41b2bd56e9..4ea6d4dc99 100644 --- a/src/query/storage/m3/consolidators/convert_test.go +++ b/src/query/storage/m3/consolidators/convert_test.go @@ -23,12 +23,12 @@ package consolidators import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFromIdentTagIteratorToTags(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/fetch_result_map_wrapper_test.go b/src/query/storage/m3/consolidators/fetch_result_map_wrapper_test.go index be162b401c..5af49788fd 100644 --- a/src/query/storage/m3/consolidators/fetch_result_map_wrapper_test.go +++ b/src/query/storage/m3/consolidators/fetch_result_map_wrapper_test.go @@ -24,12 +24,13 @@ import ( "fmt" "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestFetchResultMapWrapper(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/filter_test.go b/src/query/storage/m3/consolidators/filter_test.go index 01e79f8384..b7d9d8aae7 100644 --- a/src/query/storage/m3/consolidators/filter_test.go +++ b/src/query/storage/m3/consolidators/filter_test.go @@ -23,11 +23,11 @@ package consolidators import ( "testing" - "github.com/m3db/m3/src/query/models" - "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" + "github.com/m3db/m3/src/x/ident" ) type tag struct { diff --git a/src/query/storage/m3/consolidators/id_dedupe_map_test.go b/src/query/storage/m3/consolidators/id_dedupe_map_test.go index 8a08f63848..92ca3e655b 100644 --- a/src/query/storage/m3/consolidators/id_dedupe_map_test.go +++ b/src/query/storage/m3/consolidators/id_dedupe_map_test.go @@ -24,6 +24,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/query/models" @@ -31,10 +35,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func verifyIDDedupeMap( diff --git a/src/query/storage/m3/consolidators/multi_fetch_result_tag_test.go b/src/query/storage/m3/consolidators/multi_fetch_result_tag_test.go index 1527582d81..40f931445c 100644 --- a/src/query/storage/m3/consolidators/multi_fetch_result_tag_test.go +++ b/src/query/storage/m3/consolidators/multi_fetch_result_tag_test.go @@ -24,15 +24,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type insertEntry struct { diff --git a/src/query/storage/m3/consolidators/multi_fetch_result_test.go b/src/query/storage/m3/consolidators/multi_fetch_result_test.go index 92a7645a9b..706943368a 100644 --- a/src/query/storage/m3/consolidators/multi_fetch_result_test.go +++ b/src/query/storage/m3/consolidators/multi_fetch_result_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" @@ -32,10 +36,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var defaultTestOpts = MatchOptions{ diff --git a/src/query/storage/m3/consolidators/series_consolidator_test.go b/src/query/storage/m3/consolidators/series_consolidator_test.go index 5632dc057c..958f34d4ea 100644 --- a/src/query/storage/m3/consolidators/series_consolidator_test.go +++ b/src/query/storage/m3/consolidators/series_consolidator_test.go @@ -25,10 +25,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/dbnode/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" ) func TestSingleConsolidator(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/step_accumulator_test.go b/src/query/storage/m3/consolidators/step_accumulator_test.go index 245243c415..08d323993d 100644 --- a/src/query/storage/m3/consolidators/step_accumulator_test.go +++ b/src/query/storage/m3/consolidators/step_accumulator_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/dbnode/ts" xts "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" ) func TestAccumulator(t *testing.T) { diff --git a/src/query/storage/m3/consolidators/tag_dedupe_map_test.go b/src/query/storage/m3/consolidators/tag_dedupe_map_test.go index b4b4388174..1f09767f28 100644 --- a/src/query/storage/m3/consolidators/tag_dedupe_map_test.go +++ b/src/query/storage/m3/consolidators/tag_dedupe_map_test.go @@ -24,6 +24,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/query/models" @@ -31,10 +35,6 @@ import ( "github.com/m3db/m3/src/x/ident" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func verifyDedupeMap( diff --git a/src/query/storage/m3/convert_test.go b/src/query/storage/m3/convert_test.go index aea705d6bd..a832abfbd5 100644 --- a/src/query/storage/m3/convert_test.go +++ b/src/query/storage/m3/convert_test.go @@ -28,14 +28,14 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/storage/m3/dynamic_cluster.go b/src/query/storage/m3/dynamic_cluster.go index 59ef271838..87df86262d 100644 --- a/src/query/storage/m3/dynamic_cluster.go +++ b/src/query/storage/m3/dynamic_cluster.go @@ -25,13 +25,13 @@ import ( "fmt" "sync" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/namespace" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" - - "go.uber.org/zap" ) var ( diff --git a/src/query/storage/m3/dynamic_cluster_test.go b/src/query/storage/m3/dynamic_cluster_test.go index 1401d2e00b..270df73b8b 100644 --- a/src/query/storage/m3/dynamic_cluster_test.go +++ b/src/query/storage/m3/dynamic_cluster_test.go @@ -26,6 +26,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/namespace" @@ -36,10 +40,6 @@ import ( "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" xwatch "github.com/m3db/m3/src/x/watch" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/storage/m3/encoded_block_test.go b/src/query/storage/m3/encoded_block_test.go index 1179acfbcb..635edf7a91 100644 --- a/src/query/storage/m3/encoded_block_test.go +++ b/src/query/storage/m3/encoded_block_test.go @@ -25,15 +25,14 @@ import ( "testing" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/query/block" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func buildBlock( diff --git a/src/query/storage/m3/encoded_step_iterator_test.go b/src/query/storage/m3/encoded_step_iterator_test.go index cd1df46882..98f92c6395 100644 --- a/src/query/storage/m3/encoded_step_iterator_test.go +++ b/src/query/storage/m3/encoded_step_iterator_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/pkg/profile" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/encoding/m3tsz" "github.com/m3db/m3/src/dbnode/namespace" @@ -43,10 +47,6 @@ import ( "github.com/m3db/m3/src/x/pool" xsync "github.com/m3db/m3/src/x/sync" xtime "github.com/m3db/m3/src/x/time" - - "github.com/pkg/profile" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func withPool(t testing.TB, options Options) Options { @@ -664,40 +664,40 @@ var ( ) /* - $ go test -v -run none -bench BenchmarkNextIteration - goos: darwin - goarch: amd64 - pkg: github.com/m3db/m3/src/query/ts/m3db - - BenchmarkNextIteration/sequential_10-12 4112 282491 ns/op - BenchmarkNextIteration/parallel_10-12 4214 249335 ns/op - BenchmarkNextIteration/series_10-12 4515 248946 ns/op - BenchmarkNextIteration/series_batch_10-12 4434 269776 ns/op - - BenchmarkNextIteration/sequential_100-12 4069 267836 ns/op - BenchmarkNextIteration/parallel_100-12 4126 283069 ns/op - BenchmarkNextIteration/series_100-12 4146 266928 ns/op - BenchmarkNextIteration/series_batch_100-12 4399 255991 ns/op - - BenchmarkNextIteration/sequential_200-12 4267 245249 ns/op - BenchmarkNextIteration/parallel_200-12 4233 239597 ns/op - BenchmarkNextIteration/series_200-12 4365 245924 ns/op - BenchmarkNextIteration/series_batch_200-12 4485 235055 ns/op - - BenchmarkNextIteration/sequential_500-12 5108 230085 ns/op - BenchmarkNextIteration/parallel_500-12 4802 230694 ns/op - BenchmarkNextIteration/series_500-12 4831 229797 ns/op - BenchmarkNextIteration/series_batch_500-12 4880 246588 ns/op - - BenchmarkNextIteration/sequential_1000-12 3807 265449 ns/op - BenchmarkNextIteration/parallel_1000-12 5062 254942 ns/op - BenchmarkNextIteration/series_1000-12 4423 236796 ns/op - BenchmarkNextIteration/series_batch_1000-12 4772 251977 ns/op - - BenchmarkNextIteration/sequential_2000-12 4916 243593 ns/op - BenchmarkNextIteration/parallel_2000-12 4743 253677 ns/op - BenchmarkNextIteration/series_2000-12 4078 256375 ns/op - BenchmarkNextIteration/series_batch_2000-12 4465 242323 ns/op +$ go test -v -run none -bench BenchmarkNextIteration +goos: darwin +goarch: amd64 +pkg: github.com/m3db/m3/src/query/ts/m3db + +BenchmarkNextIteration/sequential_10-12 4112 282491 ns/op +BenchmarkNextIteration/parallel_10-12 4214 249335 ns/op +BenchmarkNextIteration/series_10-12 4515 248946 ns/op +BenchmarkNextIteration/series_batch_10-12 4434 269776 ns/op + +BenchmarkNextIteration/sequential_100-12 4069 267836 ns/op +BenchmarkNextIteration/parallel_100-12 4126 283069 ns/op +BenchmarkNextIteration/series_100-12 4146 266928 ns/op +BenchmarkNextIteration/series_batch_100-12 4399 255991 ns/op + +BenchmarkNextIteration/sequential_200-12 4267 245249 ns/op +BenchmarkNextIteration/parallel_200-12 4233 239597 ns/op +BenchmarkNextIteration/series_200-12 4365 245924 ns/op +BenchmarkNextIteration/series_batch_200-12 4485 235055 ns/op + +BenchmarkNextIteration/sequential_500-12 5108 230085 ns/op +BenchmarkNextIteration/parallel_500-12 4802 230694 ns/op +BenchmarkNextIteration/series_500-12 4831 229797 ns/op +BenchmarkNextIteration/series_batch_500-12 4880 246588 ns/op + +BenchmarkNextIteration/sequential_1000-12 3807 265449 ns/op +BenchmarkNextIteration/parallel_1000-12 5062 254942 ns/op +BenchmarkNextIteration/series_1000-12 4423 236796 ns/op +BenchmarkNextIteration/series_batch_1000-12 4772 251977 ns/op + +BenchmarkNextIteration/sequential_2000-12 4916 243593 ns/op +BenchmarkNextIteration/parallel_2000-12 4743 253677 ns/op +BenchmarkNextIteration/series_2000-12 4078 256375 ns/op +BenchmarkNextIteration/series_batch_2000-12 4465 242323 ns/op */ func BenchmarkNextIteration(b *testing.B) { iterTypes := []iterType{ diff --git a/src/query/storage/m3/storage.go b/src/query/storage/m3/storage.go index f8612d50a5..c61c75f36b 100644 --- a/src/query/storage/m3/storage.go +++ b/src/query/storage/m3/storage.go @@ -28,6 +28,11 @@ import ( "sync" "time" + "github.com/opentracing/opentracing-go/log" + "github.com/prometheus/common/model" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + coordmodel "github.com/m3db/m3/src/cmd/services/m3coordinator/model" "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/storage/index" @@ -45,11 +50,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" xtime "github.com/m3db/m3/src/x/time" - - "github.com/opentracing/opentracing-go/log" - "github.com/prometheus/common/model" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" ) const ( diff --git a/src/query/storage/m3/storage_test.go b/src/query/storage/m3/storage_test.go index 4dc28cbd00..4d4d50aa1c 100644 --- a/src/query/storage/m3/storage_test.go +++ b/src/query/storage/m3/storage_test.go @@ -28,6 +28,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/storage/index" @@ -45,10 +49,6 @@ import ( bytetest "github.com/m3db/m3/src/x/test" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/storage/prom_converter_test.go b/src/query/storage/prom_converter_test.go index e01c6387f6..507195b4db 100644 --- a/src/query/storage/prom_converter_test.go +++ b/src/query/storage/prom_converter_test.go @@ -25,6 +25,10 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/generated/proto/annotation" dts "github.com/m3db/m3/src/dbnode/ts" @@ -38,10 +42,6 @@ import ( xsync "github.com/m3db/m3/src/x/sync" xtest "github.com/m3db/m3/src/x/test" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func buildFetchOpts() *FetchOptions { diff --git a/src/query/storage/prometheus/prometheus_storage_test.go b/src/query/storage/prometheus/prometheus_storage_test.go index 89326c7a9b..07f15510a1 100644 --- a/src/query/storage/prometheus/prometheus_storage_test.go +++ b/src/query/storage/prometheus/prometheus_storage_test.go @@ -27,6 +27,10 @@ import ( "time" "github.com/golang/mock/gomock" + "github.com/prometheus/prometheus/model/labels" + promstorage "github.com/prometheus/prometheus/storage" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/generated/proto/prompb" @@ -34,11 +38,6 @@ import ( "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/x/instrument" xtest "github.com/m3db/m3/src/x/test" - - "github.com/prometheus/prometheus/model/labels" - promstorage "github.com/prometheus/prometheus/storage" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestSelectWithMetaInContext(t *testing.T) { diff --git a/src/query/storage/promremote/options.go b/src/query/storage/promremote/options.go index 921058e640..6197e7cfc2 100644 --- a/src/query/storage/promremote/options.go +++ b/src/query/storage/promremote/options.go @@ -25,13 +25,13 @@ import ( "fmt" "strings" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/cmd/services/m3query/config" "github.com/m3db/m3/src/query/storage/m3" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // NewOptions constructs Options based on the given config. diff --git a/src/query/storage/promremote/options_test.go b/src/query/storage/promremote/options_test.go index 8c9b05e510..3f40b8f417 100644 --- a/src/query/storage/promremote/options_test.go +++ b/src/query/storage/promremote/options_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" - "github.com/m3db/m3/src/cmd/services/m3query/config" - "github.com/m3db/m3/src/query/storage/m3" - "github.com/m3db/m3/src/query/storage/m3/storagemetadata" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" "go.uber.org/zap" + + "github.com/m3db/m3/src/cmd/services/m3query/config" + "github.com/m3db/m3/src/query/storage/m3" + "github.com/m3db/m3/src/query/storage/m3/storagemetadata" ) func TestNewFromConfiguration(t *testing.T) { diff --git a/src/query/storage/promremote/query_converter_test.go b/src/query/storage/promremote/query_converter_test.go index b60a33c772..5d3c613d8c 100644 --- a/src/query/storage/promremote/query_converter_test.go +++ b/src/query/storage/promremote/query_converter_test.go @@ -24,14 +24,14 @@ import ( "testing" "time" + "github.com/prometheus/prometheus/prompb" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/prometheus/prompb" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestWriteQueryConverter(t *testing.T) { diff --git a/src/query/storage/promremote/query_coverter.go b/src/query/storage/promremote/query_coverter.go index ef4a42005d..31e5470cbe 100644 --- a/src/query/storage/promremote/query_coverter.go +++ b/src/query/storage/promremote/query_coverter.go @@ -23,11 +23,11 @@ package promremote import ( "time" - "github.com/m3db/m3/src/query/storage" - "github.com/golang/snappy" "github.com/pkg/errors" "github.com/prometheus/prometheus/prompb" + + "github.com/m3db/m3/src/query/storage" ) var errNilQuery = errors.New("received nil query") diff --git a/src/query/storage/promremote/storage.go b/src/query/storage/promremote/storage.go index 1ed5484b1c..442ee34eea 100644 --- a/src/query/storage/promremote/storage.go +++ b/src/query/storage/promremote/storage.go @@ -30,6 +30,10 @@ import ( "sync" "time" + "github.com/pkg/errors" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/m3/consolidators" @@ -37,10 +41,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/pkg/errors" - "github.com/uber-go/tally" - "go.uber.org/zap" ) const metricsScope = "prom_remote_storage" diff --git a/src/query/storage/promremote/storage_test.go b/src/query/storage/promremote/storage_test.go index a5a2e337cf..2e6a71e4b6 100644 --- a/src/query/storage/promremote/storage_test.go +++ b/src/query/storage/promremote/storage_test.go @@ -28,6 +28,12 @@ import ( "testing" "time" + "github.com/prometheus/prometheus/prompb" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" @@ -36,12 +42,6 @@ import ( xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/tallytest" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/prometheus/prompb" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/uber-go/tally" - "go.uber.org/zap" ) var ( diff --git a/src/query/storage/promremote/types.go b/src/query/storage/promremote/types.go index f544263213..23e0151bf4 100644 --- a/src/query/storage/promremote/types.go +++ b/src/query/storage/promremote/types.go @@ -22,14 +22,14 @@ package promremote import ( + "github.com/uber-go/tally" + "go.uber.org/zap" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/query/storage/m3" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/x/ident" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/uber-go/tally" - "go.uber.org/zap" ) // Options for storage. diff --git a/src/query/storage/promremote/types_test.go b/src/query/storage/promremote/types_test.go index 27f6f57bab..719ab93f5e 100644 --- a/src/query/storage/promremote/types_test.go +++ b/src/query/storage/promremote/types_test.go @@ -23,12 +23,12 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/storage/m3" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) func TestNamespaces(t *testing.T) { diff --git a/src/query/storage/restrict_query_options_test.go b/src/query/storage/restrict_query_options_test.go index 494f5bef1a..00ce3a10bf 100644 --- a/src/query/storage/restrict_query_options_test.go +++ b/src/query/storage/restrict_query_options_test.go @@ -23,11 +23,11 @@ package storage import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/metrics/policy" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" - - "github.com/stretchr/testify/require" ) func TestGetRestrict(t *testing.T) { diff --git a/src/query/storage/types.go b/src/query/storage/types.go index 636fd08b99..033fb9bbcb 100644 --- a/src/query/storage/types.go +++ b/src/query/storage/types.go @@ -26,6 +26,8 @@ import ( "fmt" "time" + "github.com/uber-go/tally" + "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/dbnode/topology" "github.com/m3db/m3/src/metrics/policy" @@ -36,8 +38,6 @@ import ( "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/uber-go/tally" ) var errWriteQueryNoDatapoints = errors.New("write query with no datapoints") diff --git a/src/query/storage/write_test.go b/src/query/storage/write_test.go index 4e46d04209..c35a160296 100644 --- a/src/query/storage/write_test.go +++ b/src/query/storage/write_test.go @@ -23,13 +23,13 @@ package storage import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage/m3/storagemetadata" "github.com/m3db/m3/src/query/ts" xerrors "github.com/m3db/m3/src/x/errors" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/require" ) func TestNewWriteQueryValidateTags(t *testing.T) { diff --git a/src/query/stores/m3db/async_session_test.go b/src/query/stores/m3db/async_session_test.go index f58805790f..0ca040c258 100644 --- a/src/query/stores/m3db/async_session_test.go +++ b/src/query/stores/m3db/async_session_test.go @@ -27,14 +27,14 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/storage/index" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) var ( diff --git a/src/query/test/builder.go b/src/query/test/builder.go index 7ddbad025a..b22de4ce21 100644 --- a/src/query/test/builder.go +++ b/src/query/test/builder.go @@ -24,13 +24,13 @@ import ( "fmt" "time" + "github.com/prometheus/common/model" + "github.com/m3db/m3/src/query/block" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/query/ts" xtime "github.com/m3db/m3/src/x/time" - - "github.com/prometheus/common/model" ) // ValueMod can be used to modify provided values for testing. diff --git a/src/query/test/compare/comparison.go b/src/query/test/compare/comparison.go index ddb4075cdb..f5ed1b162a 100644 --- a/src/query/test/compare/comparison.go +++ b/src/query/test/compare/comparison.go @@ -28,11 +28,11 @@ import ( "sort" "testing" - "github.com/m3db/m3/src/query/block" - "github.com/m3db/m3/src/query/models" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/block" + "github.com/m3db/m3/src/query/models" ) // EqualsWithNans helps compare float slices which have NaNs in them diff --git a/src/query/test/compatibility/promql_test.go b/src/query/test/compatibility/promql_test.go index d5f756800f..7e42ce094b 100644 --- a/src/query/test/compatibility/promql_test.go +++ b/src/query/test/compatibility/promql_test.go @@ -1,3 +1,4 @@ +//go:build compatibility // +build compatibility // Copyright (c) 2020 Uber Technologies, Inc. diff --git a/src/query/test/compatibility/test.go b/src/query/test/compatibility/test.go index 743f35afe4..d6ae66954c 100644 --- a/src/query/test/compatibility/test.go +++ b/src/query/test/compatibility/test.go @@ -47,15 +47,15 @@ import ( "strings" "time" - cparser "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" - "github.com/m3db/m3/src/query/api/v1/handler/prometheus" - "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" "github.com/prometheus/prometheus/util/testutil" + + cparser "github.com/m3db/m3/src/cmd/services/m3comparator/main/parser" + "github.com/m3db/m3/src/query/api/v1/handler/prometheus" ) var ( diff --git a/src/query/test/handler.go b/src/query/test/handler.go index 4086d3ea88..13f41b78dd 100644 --- a/src/query/test/handler.go +++ b/src/query/test/handler.go @@ -27,10 +27,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/generated/proto/prompb" - "github.com/golang/protobuf/proto" "github.com/golang/snappy" + + "github.com/m3db/m3/src/query/generated/proto/prompb" ) // SlowHandler slows down a request by delay diff --git a/src/query/test/m3/test_storage.go b/src/query/test/m3/test_storage.go index 8379dc8efa..73b7ad51d9 100644 --- a/src/query/test/m3/test_storage.go +++ b/src/query/test/m3/test_storage.go @@ -24,6 +24,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/client" "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/models" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/x/ident" "github.com/m3db/m3/src/x/instrument" "github.com/m3db/m3/src/x/sync" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) const ( diff --git a/src/query/test/seriesiter/mock_iter.go b/src/query/test/seriesiter/mock_iter.go index 6df20d0d39..707a7cf2fd 100644 --- a/src/query/test/seriesiter/mock_iter.go +++ b/src/query/test/seriesiter/mock_iter.go @@ -23,12 +23,12 @@ package seriesiter import ( "time" + "github.com/golang/mock/gomock" + "github.com/m3db/m3/src/dbnode/encoding" m3ts "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/ident" xtime "github.com/m3db/m3/src/x/time" - - "github.com/golang/mock/gomock" ) // GenerateSingleSampleTagIterator generates a new tag iterator diff --git a/src/query/test/transformtest/transform.go b/src/query/test/transformtest/transform.go index fe3eb74c75..ff2a6687fa 100644 --- a/src/query/test/transformtest/transform.go +++ b/src/query/test/transformtest/transform.go @@ -23,11 +23,11 @@ package transformtest import ( "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/query/executor/transform" "github.com/m3db/m3/src/query/storage" "github.com/m3db/m3/src/x/instrument" - - "github.com/stretchr/testify/require" ) // Options returns a valid transform options from diff --git a/src/query/ts/series_test.go b/src/query/ts/series_test.go index 1a4b87d639..53c939cfa7 100644 --- a/src/query/ts/series_test.go +++ b/src/query/ts/series_test.go @@ -23,10 +23,10 @@ package ts import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/m3db/m3/src/query/models" xtime "github.com/m3db/m3/src/x/time" - - "github.com/stretchr/testify/assert" ) func TestCreateNewSeries(t *testing.T) { diff --git a/src/query/ts/values_test.go b/src/query/ts/values_test.go index ccb7aae3ec..07ebef1267 100644 --- a/src/query/ts/values_test.go +++ b/src/query/ts/values_test.go @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/query/models" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/query/models" + xtime "github.com/m3db/m3/src/x/time" ) func generateDatapoints(t xtime.UnixNano, times []int) Datapoints { diff --git a/src/query/util/logging/log_test.go b/src/query/util/logging/log_test.go index 00bc1d31e6..b0a0536923 100644 --- a/src/query/util/logging/log_test.go +++ b/src/query/util/logging/log_test.go @@ -24,9 +24,9 @@ import ( "context" "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/x/instrument" ) func TestContextWithID(t *testing.T) { diff --git a/src/query/util/timing.go b/src/query/util/timing.go index 47f5210821..1ba7f5badc 100644 --- a/src/query/util/timing.go +++ b/src/query/util/timing.go @@ -26,8 +26,9 @@ import ( "strconv" "time" - xerrors "github.com/m3db/m3/src/x/errors" "github.com/prometheus/common/model" + + xerrors "github.com/m3db/m3/src/x/errors" ) var ( diff --git a/src/x/cache/lru_cache_test.go b/src/x/cache/lru_cache_test.go index d090ffb79e..47902d6299 100644 --- a/src/x/cache/lru_cache_test.go +++ b/src/x/cache/lru_cache_test.go @@ -30,11 +30,11 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/tallytest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/tallytest" ) func metric(key string) string { diff --git a/src/x/config/configflag/flag.go b/src/x/config/configflag/flag.go index 2e1f5bd873..d0caddfb61 100644 --- a/src/x/config/configflag/flag.go +++ b/src/x/config/configflag/flag.go @@ -64,8 +64,9 @@ func (opts *Options) RegisterFlagSet(cmd *flag.FlagSet) { // MainLoad is a convenience method, intended for use in main(), which handles all // config commandline options. It: -// - Dumps config and exits if -d was passed. -// - Loads configuration otherwise. +// - Dumps config and exits if -d was passed. +// - Loads configuration otherwise. +// // Users who want a subset of this behavior should call individual methods. func (opts *Options) MainLoad(target interface{}, loadOpts config.Options) error { osFns := opts.osFns @@ -94,10 +95,14 @@ func (opts *Options) MainLoad(target interface{}, loadOpts config.Options) error // FlagStringSlice represents a slice of strings. When used as a flag variable, // it allows for multiple string values. For example, it can be used like this: -// var configFiles FlagStringSlice -// flag.Var(&configFiles, "f", "configuration file(s)") +// +// var configFiles FlagStringSlice +// flag.Var(&configFiles, "f", "configuration file(s)") +// // Then it can be invoked like this: -// ./app -f file1.yaml -f file2.yaml -f valueN.yaml +// +// ./app -f file1.yaml -f file2.yaml -f valueN.yaml +// // Finally, when the flags are parsed, the variable contains all the values. type FlagStringSlice struct { Value []string diff --git a/src/x/config/pooling_test.go b/src/x/config/pooling_test.go index 7a513a94d2..4c75734c72 100644 --- a/src/x/config/pooling_test.go +++ b/src/x/config/pooling_test.go @@ -22,9 +22,9 @@ package config import ( "testing" - "github.com/m3db/m3/src/x/sync" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/x/sync" ) func TestWorkerPoolPolicyConvertsToOptionsDefault(t *testing.T) { diff --git a/src/x/context/context.go b/src/x/context/context.go index d2d0ecd3dd..054ac9ab10 100644 --- a/src/x/context/context.go +++ b/src/x/context/context.go @@ -25,14 +25,14 @@ import ( "fmt" "sync" - xopentracing "github.com/m3db/m3/src/x/opentracing" - xresource "github.com/m3db/m3/src/x/resource" - lightstep "github.com/lightstep/lightstep-tracer-go" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/mocktracer" "github.com/uber/jaeger-client-go" + + xopentracing "github.com/m3db/m3/src/x/opentracing" + xresource "github.com/m3db/m3/src/x/resource" ) const ( diff --git a/src/x/context/pool_test.go b/src/x/context/pool_test.go index a2106a4995..6081d1ef76 100644 --- a/src/x/context/pool_test.go +++ b/src/x/context/pool_test.go @@ -23,9 +23,9 @@ package context import ( "testing" - xresource "github.com/m3db/m3/src/x/resource" - "github.com/stretchr/testify/assert" + + xresource "github.com/m3db/m3/src/x/resource" ) func TestContextPool(t *testing.T) { diff --git a/src/x/context/types.go b/src/x/context/types.go index 31ffa6675b..44d995eaa7 100644 --- a/src/x/context/types.go +++ b/src/x/context/types.go @@ -23,10 +23,10 @@ package context import ( stdctx "context" + "github.com/opentracing/opentracing-go" + "github.com/m3db/m3/src/x/pool" xresource "github.com/m3db/m3/src/x/resource" - - "github.com/opentracing/opentracing-go" ) // Cancellable is an object that can be cancelled. diff --git a/src/x/convert/unit_test.go b/src/x/convert/unit_test.go index dc32963df6..fde5aa02d0 100644 --- a/src/x/convert/unit_test.go +++ b/src/x/convert/unit_test.go @@ -24,9 +24,9 @@ import ( "testing" "time" - xtime "github.com/m3db/m3/src/x/time" - "github.com/stretchr/testify/require" + + xtime "github.com/m3db/m3/src/x/time" ) func TestUnitForM3DB(t *testing.T) { diff --git a/src/x/debug/debug.go b/src/x/debug/debug.go index 957fab1480..1715bc7345 100644 --- a/src/x/debug/debug.go +++ b/src/x/debug/debug.go @@ -28,11 +28,11 @@ import ( "net/http" "time" + "go.uber.org/zap" + xerrors "github.com/m3db/m3/src/x/errors" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "go.uber.org/zap" ) const ( diff --git a/src/x/debug/debug_test.go b/src/x/debug/debug_test.go index 4e8aa4cab0..c82e574a6e 100644 --- a/src/x/debug/debug_test.go +++ b/src/x/debug/debug_test.go @@ -31,10 +31,10 @@ import ( "net/http/httptest" "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/instrument" ) const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/src/x/debug/ext/ext_test.go b/src/x/debug/ext/ext_test.go index 8a5c69672c..9b5c7eda7e 100644 --- a/src/x/debug/ext/ext_test.go +++ b/src/x/debug/ext/ext_test.go @@ -28,12 +28,12 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" debugtest "github.com/m3db/m3/src/x/debug/test" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestDefaultSources(t *testing.T) { diff --git a/src/x/debug/ext/namespace.go b/src/x/debug/ext/namespace.go index 7f1fbebd38..b43552686b 100644 --- a/src/x/debug/ext/namespace.go +++ b/src/x/debug/ext/namespace.go @@ -27,6 +27,8 @@ import ( "io" "net/http" + "github.com/gogo/protobuf/jsonpb" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" "github.com/m3db/m3/src/query/api/v1/handler/namespace" @@ -34,8 +36,6 @@ import ( "github.com/m3db/m3/src/x/debug" "github.com/m3db/m3/src/x/instrument" xhttp "github.com/m3db/m3/src/x/net/http" - - "github.com/gogo/protobuf/jsonpb" ) type namespaceInfoSource struct { diff --git a/src/x/debug/ext/namespace_test.go b/src/x/debug/ext/namespace_test.go index fa4ae5f169..35e5cd241e 100644 --- a/src/x/debug/ext/namespace_test.go +++ b/src/x/debug/ext/namespace_test.go @@ -25,12 +25,12 @@ import ( "net/http" "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" debugtest "github.com/m3db/m3/src/x/debug/test" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) func TestNamespaceSource(t *testing.T) { diff --git a/src/x/debug/ext/placement_test.go b/src/x/debug/ext/placement_test.go index b8ab699230..db261a1e3c 100644 --- a/src/x/debug/ext/placement_test.go +++ b/src/x/debug/ext/placement_test.go @@ -25,11 +25,11 @@ import ( "net/http" "testing" - "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" - debugtest "github.com/m3db/m3/src/x/debug/test" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/cluster/placementhandler/handleroptions" + debugtest "github.com/m3db/m3/src/x/debug/test" ) func TestPlacementSource(t *testing.T) { diff --git a/src/x/debug/test/test.go b/src/x/debug/test/test.go index ac29bf9645..9f4c9b36bc 100644 --- a/src/x/debug/test/test.go +++ b/src/x/debug/test/test.go @@ -24,6 +24,9 @@ package debugtest import ( "testing" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + clusterclient "github.com/m3db/m3/src/cluster/client" "github.com/m3db/m3/src/cluster/generated/proto/placementpb" "github.com/m3db/m3/src/cluster/kv" @@ -32,9 +35,6 @@ import ( "github.com/m3db/m3/src/cluster/services" "github.com/m3db/m3/src/query/api/v1/handler/namespace" "github.com/m3db/m3/src/x/instrument" - - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // NewTestHandlerOptsAndClient returns a new test handler. diff --git a/src/x/debug/triggering_profile.go b/src/x/debug/triggering_profile.go index 473e8b6756..188b7a765e 100644 --- a/src/x/debug/triggering_profile.go +++ b/src/x/debug/triggering_profile.go @@ -29,9 +29,9 @@ import ( "text/template" "time" - "github.com/m3db/m3/src/x/instrument" - "go.uber.org/zap" + + "github.com/m3db/m3/src/x/instrument" ) const ( diff --git a/src/x/debug/triggering_profile_test.go b/src/x/debug/triggering_profile_test.go index b769b1cd1e..801f6a9347 100644 --- a/src/x/debug/triggering_profile_test.go +++ b/src/x/debug/triggering_profile_test.go @@ -30,10 +30,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" "go.uber.org/atomic" + + "github.com/m3db/m3/src/x/instrument" ) func TestContinuousFileProfile(t *testing.T) { diff --git a/src/x/dockertest/common.go b/src/x/dockertest/common.go index f14c6261f0..1a2902426c 100644 --- a/src/x/dockertest/common.go +++ b/src/x/dockertest/common.go @@ -24,10 +24,10 @@ import ( "errors" "fmt" - "github.com/m3db/m3/src/x/instrument" - "github.com/ory/dockertest/v3" dc "github.com/ory/dockertest/v3/docker" + + "github.com/m3db/m3/src/x/instrument" ) var ( @@ -50,6 +50,7 @@ type GoalStateVerifier func(output string, err error) error // ResourceOptions returns options for creating // a Resource. +// //nolint:maligned type ResourceOptions struct { OverrideDefaults bool diff --git a/src/x/generics/arraypool/pool.go b/src/x/generics/arraypool/pool.go index b3ca15d7da..b744db9615 100644 --- a/src/x/generics/arraypool/pool.go +++ b/src/x/generics/arraypool/pool.go @@ -21,9 +21,9 @@ package arraypool import ( - "github.com/m3db/m3/src/x/pool" - "github.com/mauricelam/genny/generic" + + "github.com/m3db/m3/src/x/pool" ) // elemType is the generic type for use with the specialized array pool. diff --git a/src/x/generics/arraypool/pool_test.go b/src/x/generics/arraypool/pool_test.go index 6d03756ea5..9950f0c015 100644 --- a/src/x/generics/arraypool/pool_test.go +++ b/src/x/generics/arraypool/pool_test.go @@ -23,9 +23,9 @@ package arraypool import ( "testing" - "github.com/m3db/m3/src/x/pool" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) func TestArrayPool(t *testing.T) { diff --git a/src/x/generics/hashmap/byteskey/map_pool_test.go b/src/x/generics/hashmap/byteskey/map_pool_test.go index 8b46af4108..284bac490c 100644 --- a/src/x/generics/hashmap/byteskey/map_pool_test.go +++ b/src/x/generics/hashmap/byteskey/map_pool_test.go @@ -24,11 +24,11 @@ import ( "testing" "unsafe" - "github.com/m3db/m3/src/x/pool" - "github.com/golang/mock/gomock" "github.com/mauricelam/genny/generic" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/pool" ) // nolint: structcheck diff --git a/src/x/generics/hashmap/byteskey/new_map.go b/src/x/generics/hashmap/byteskey/new_map.go index 62ede699b1..e95570cbbc 100644 --- a/src/x/generics/hashmap/byteskey/new_map.go +++ b/src/x/generics/hashmap/byteskey/new_map.go @@ -23,10 +23,10 @@ package byteskey import ( "bytes" - "github.com/m3db/m3/src/x/pool" - "github.com/cespare/xxhash/v2" "github.com/mauricelam/genny/generic" + + "github.com/m3db/m3/src/x/pool" ) // MapValue is the generic type that needs to be specified when generating. diff --git a/src/x/generics/hashmap/idkey/map_pool_test.go b/src/x/generics/hashmap/idkey/map_pool_test.go index 95e69042d0..3c9177c3d1 100644 --- a/src/x/generics/hashmap/idkey/map_pool_test.go +++ b/src/x/generics/hashmap/idkey/map_pool_test.go @@ -24,12 +24,12 @@ import ( "testing" "unsafe" - "github.com/m3db/m3/src/x/ident" - "github.com/m3db/m3/src/x/pool" - "github.com/golang/mock/gomock" "github.com/mauricelam/genny/generic" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" + "github.com/m3db/m3/src/x/pool" ) // nolint: structcheck diff --git a/src/x/generics/hashmap/idkey/new_map.go b/src/x/generics/hashmap/idkey/new_map.go index 752635f7e3..29d41a60b9 100644 --- a/src/x/generics/hashmap/idkey/new_map.go +++ b/src/x/generics/hashmap/idkey/new_map.go @@ -21,11 +21,11 @@ package idkey import ( - "github.com/m3db/m3/src/x/ident" - "github.com/m3db/m3/src/x/pool" - "github.com/cespare/xxhash/v2" "github.com/mauricelam/genny/generic" + + "github.com/m3db/m3/src/x/ident" + "github.com/m3db/m3/src/x/pool" ) // MapValue is the generic type that needs to be specified when generating. diff --git a/src/x/generics/list/list.go b/src/x/generics/list/list.go index 82b9653d42..69076ad2f8 100644 --- a/src/x/generics/list/list.go +++ b/src/x/generics/list/list.go @@ -58,9 +58,9 @@ package list import ( "sync" - "github.com/m3db/m3/src/x/pool" - "github.com/mauricelam/genny/generic" + + "github.com/m3db/m3/src/x/pool" ) // ValueType is the generic element type for use with the list. diff --git a/src/x/grpc/grpc_metrics.go b/src/x/grpc/grpc_metrics.go index e8fc63a1ce..57b1a5ca0f 100644 --- a/src/x/grpc/grpc_metrics.go +++ b/src/x/grpc/grpc_metrics.go @@ -26,12 +26,12 @@ import ( "strings" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/uber-go/tally" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/m3db/m3/src/x/instrument" ) var ( diff --git a/src/x/grpc/grpc_metrics_test.go b/src/x/grpc/grpc_metrics_test.go index fa62d63ee2..c1c3ad3c23 100644 --- a/src/x/grpc/grpc_metrics_test.go +++ b/src/x/grpc/grpc_metrics_test.go @@ -28,13 +28,13 @@ import ( "testing" "time" - testpb "github.com/m3db/m3/src/x/generated/proto/test" - "github.com/stretchr/testify/require" "github.com/uber-go/tally" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + testpb "github.com/m3db/m3/src/x/generated/proto/test" ) func TestInterceptors(t *testing.T) { diff --git a/src/x/ident/identifier_pool_test.go b/src/x/ident/identifier_pool_test.go index 7592f3737c..7be414620d 100644 --- a/src/x/ident/identifier_pool_test.go +++ b/src/x/ident/identifier_pool_test.go @@ -23,11 +23,11 @@ package ident import ( "testing" + "github.com/stretchr/testify/suite" + "github.com/m3db/m3/src/x/checked" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/pool" - - "github.com/stretchr/testify/suite" ) func TestSimpleIDPool(t *testing.T) { diff --git a/src/x/ident/identifier_test.go b/src/x/ident/identifier_test.go index 06f4fe2012..e811d8f7fa 100644 --- a/src/x/ident/identifier_test.go +++ b/src/x/ident/identifier_test.go @@ -23,10 +23,10 @@ package ident import ( "testing" - "github.com/m3db/m3/src/x/checked" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/checked" ) func TestConstructorEquality(t *testing.T) { diff --git a/src/x/ident/tag_iterator_matcher_test.go b/src/x/ident/tag_iterator_matcher_test.go index 8772e01dcf..a61d25ab22 100644 --- a/src/x/ident/tag_iterator_matcher_test.go +++ b/src/x/ident/tag_iterator_matcher_test.go @@ -24,10 +24,10 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/x/ident" ) func TestTagIteratorMatcher(t *testing.T) { diff --git a/src/x/ident/testutil/tags_convert_test.go b/src/x/ident/testutil/tags_convert_test.go index 320cabdaa1..9d3ccac481 100644 --- a/src/x/ident/testutil/tags_convert_test.go +++ b/src/x/ident/testutil/tags_convert_test.go @@ -24,11 +24,11 @@ import ( "errors" "testing" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" ) func TestNewTagsFromTagIterator(t *testing.T) { diff --git a/src/x/instrument/config_test.go b/src/x/instrument/config_test.go index 8067f8fb50..2b453c437b 100644 --- a/src/x/instrument/config_test.go +++ b/src/x/instrument/config_test.go @@ -27,14 +27,13 @@ import ( "net/http" "testing" - "github.com/sergi/go-diff/diffmatchpatch" - - xjson "github.com/m3db/m3/src/x/json" - "github.com/gogo/protobuf/jsonpb" extprom "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/expfmt" + "github.com/sergi/go-diff/diffmatchpatch" "github.com/stretchr/testify/require" + + xjson "github.com/m3db/m3/src/x/json" ) func TestPrometheusDefaults(t *testing.T) { diff --git a/src/x/instrument/extended.go b/src/x/instrument/extended.go index 3026f1c5ac..04d95c3796 100644 --- a/src/x/instrument/extended.go +++ b/src/x/instrument/extended.go @@ -27,9 +27,9 @@ import ( "sync/atomic" "time" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/uber-go/tally" + + xerrors "github.com/m3db/m3/src/x/errors" ) // ExtendedMetricsType is a type of extended metrics to report. diff --git a/src/x/instrument/invariant_test.go b/src/x/instrument/invariant_test.go index e2c51180e4..d0e55b2587 100644 --- a/src/x/instrument/invariant_test.go +++ b/src/x/instrument/invariant_test.go @@ -24,11 +24,11 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" "github.com/uber-go/tally" "go.uber.org/zap" + + "github.com/m3db/m3/src/x/instrument" ) func ExampleInvariantViolatedMetricInvocation() { diff --git a/src/x/instrument/process.go b/src/x/instrument/process.go index 487f4cdb6a..c1aa027d0c 100644 --- a/src/x/instrument/process.go +++ b/src/x/instrument/process.go @@ -24,9 +24,9 @@ import ( "os" "time" - "github.com/m3db/m3/src/x/process" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/process" ) type processReporter struct { diff --git a/src/x/net/http/errors.go b/src/x/net/http/errors.go index 042233fb90..e4840bf716 100644 --- a/src/x/net/http/errors.go +++ b/src/x/net/http/errors.go @@ -27,10 +27,10 @@ import ( "net/http" "sync" + "github.com/prometheus/prometheus/promql" + "github.com/m3db/m3/src/dbnode/client" xerrors "github.com/m3db/m3/src/x/errors" - - "github.com/prometheus/prometheus/promql" ) // ErrorRewriteFn is a function for rewriting response error. diff --git a/src/x/net/http/errors_test.go b/src/x/net/http/errors_test.go index b228a0b7c1..2e77f49cdc 100644 --- a/src/x/net/http/errors_test.go +++ b/src/x/net/http/errors_test.go @@ -27,13 +27,13 @@ import ( "net/http/httptest" "testing" - terrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/prometheus/prometheus/promql" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/uber/tchannel-go" + + terrors "github.com/m3db/m3/src/dbnode/network/server/tchannelthrift/errors" + xerrors "github.com/m3db/m3/src/x/errors" ) func TestErrorStatus(t *testing.T) { diff --git a/src/x/net/server_test.go b/src/x/net/server_test.go index 5bd4957708..9a07d27628 100644 --- a/src/x/net/server_test.go +++ b/src/x/net/server_test.go @@ -28,9 +28,9 @@ import ( "sync" "testing" - "github.com/m3db/m3/src/x/retry" - "github.com/stretchr/testify/assert" + + "github.com/m3db/m3/src/x/retry" ) func TestStartAcceptLoop(t *testing.T) { diff --git a/src/x/pool/object.go b/src/x/pool/object.go index ebedf02ff3..4f2ce6a894 100644 --- a/src/x/pool/object.go +++ b/src/x/pool/object.go @@ -26,10 +26,10 @@ import ( "sync" "sync/atomic" - "github.com/m3db/m3/src/x/unsafe" - "github.com/uber-go/tally" "golang.org/x/sys/cpu" + + "github.com/m3db/m3/src/x/unsafe" ) var ( diff --git a/src/x/retry/retry.go b/src/x/retry/retry.go index 8ec130ebc8..551ded31d7 100644 --- a/src/x/retry/retry.go +++ b/src/x/retry/retry.go @@ -27,9 +27,9 @@ import ( "math" "time" - xerrors "github.com/m3db/m3/src/x/errors" - "github.com/uber-go/tally" + + xerrors "github.com/m3db/m3/src/x/errors" ) var ( diff --git a/src/x/retry/types.go b/src/x/retry/types.go index b388b7a0fe..04cc3400f2 100644 --- a/src/x/retry/types.go +++ b/src/x/retry/types.go @@ -25,9 +25,9 @@ import ( "context" "time" - "github.com/m3db/m3/src/x/errors" - "github.com/uber-go/tally" + + "github.com/m3db/m3/src/x/errors" ) // RetryableError returns a retryable error. diff --git a/src/x/serialize/decoder_fast_benchmark_test.go b/src/x/serialize/decoder_fast_benchmark_test.go index 79547207c6..e9d2703766 100644 --- a/src/x/serialize/decoder_fast_benchmark_test.go +++ b/src/x/serialize/decoder_fast_benchmark_test.go @@ -36,6 +36,7 @@ type encodedTagsWithTagName struct { } // Samples of encoded tags, taken from metrics generated by promremotebench. +// //nolint:lll var samples = []string{ "dScMAAgAX19uYW1lX18GAGRpc2tpbwQAYXJjaAMAeDY0CgBkYXRhY2VudGVyCgB1cy13ZXN0LTJjCABob3N0bmFtZQcAaG9zdF83OAsAbWVhc3VyZW1lbnQFAHJlYWRzAgBvcwsAVWJ1bnR1MTUuMTAEAHJhY2sCADg3BgByZWdpb24JAHVzLXdlc3QtMgcAc2VydmljZQIAMTETAHNlcnZpY2VfZW52aXJvbm1lbnQKAHByb2R1Y3Rpb24PAHNlcnZpY2VfdmVyc2lvbgEAMQQAdGVhbQIAU0Y=", diff --git a/src/x/serialize/decoder_lifecycle_prop_test.go b/src/x/serialize/decoder_lifecycle_prop_test.go index ba231e8890..86bcb6cc1e 100644 --- a/src/x/serialize/decoder_lifecycle_prop_test.go +++ b/src/x/serialize/decoder_lifecycle_prop_test.go @@ -28,12 +28,12 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/checked" - "github.com/m3db/m3/src/x/ident" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/commands" "github.com/leanovate/gopter/gen" + + "github.com/m3db/m3/src/x/checked" + "github.com/m3db/m3/src/x/ident" ) // NB(prateek): this file uses a SUT prop test to ensure we are correctly reference counting diff --git a/src/x/serialize/decoder_test.go b/src/x/serialize/decoder_test.go index 1e0a1722c5..63e9fedb1c 100644 --- a/src/x/serialize/decoder_test.go +++ b/src/x/serialize/decoder_test.go @@ -24,13 +24,13 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/checked" - "github.com/m3db/m3/src/x/ident" - xtest "github.com/m3db/m3/src/x/test" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/checked" + "github.com/m3db/m3/src/x/ident" + xtest "github.com/m3db/m3/src/x/test" ) var ( diff --git a/src/x/serialize/encode_decode_prop_test.go b/src/x/serialize/encode_decode_prop_test.go index 2c066a7ac5..d6e0880e64 100644 --- a/src/x/serialize/encode_decode_prop_test.go +++ b/src/x/serialize/encode_decode_prop_test.go @@ -24,11 +24,11 @@ import ( "fmt" "testing" - "github.com/m3db/m3/src/x/ident" - "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" + + "github.com/m3db/m3/src/x/ident" ) var ( diff --git a/src/x/serialize/encoder_pool_test.go b/src/x/serialize/encoder_pool_test.go index 67e4f551e5..6e8cf49ec6 100644 --- a/src/x/serialize/encoder_pool_test.go +++ b/src/x/serialize/encoder_pool_test.go @@ -23,9 +23,9 @@ package serialize import ( "testing" - "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/ident" ) func newTestTagEncoderPool() TagEncoderPool { diff --git a/src/x/serialize/encoder_test.go b/src/x/serialize/encoder_test.go index d691b1ea9b..eb12fa43f2 100644 --- a/src/x/serialize/encoder_test.go +++ b/src/x/serialize/encoder_test.go @@ -24,11 +24,11 @@ import ( "strings" "testing" - "github.com/m3db/m3/src/x/checked" - "github.com/m3db/m3/src/x/ident" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/checked" + "github.com/m3db/m3/src/x/ident" ) func newTestEncoderOpts() TagEncoderOptions { diff --git a/src/x/server/config_test.go b/src/x/server/config_test.go index 2f353ad3cd..d2284efd44 100644 --- a/src/x/server/config_test.go +++ b/src/x/server/config_test.go @@ -24,10 +24,10 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" - "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/m3db/m3/src/x/instrument" ) func TestServerConfiguration(t *testing.T) { diff --git a/src/x/server/server.go b/src/x/server/server.go index 09da8c08d0..fbe502da3e 100644 --- a/src/x/server/server.go +++ b/src/x/server/server.go @@ -27,11 +27,11 @@ import ( "sync/atomic" "time" - xnet "github.com/m3db/m3/src/x/net" - "github.com/m3db/m3/src/x/retry" - "github.com/uber-go/tally" "go.uber.org/zap" + + xnet "github.com/m3db/m3/src/x/net" + "github.com/m3db/m3/src/x/retry" ) // Server is a server capable of listening to incoming traffic and closing itself diff --git a/src/x/server/server_test.go b/src/x/server/server_test.go index 20749a638c..c18cc0981f 100644 --- a/src/x/server/server_test.go +++ b/src/x/server/server_test.go @@ -29,9 +29,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/retry" - "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/retry" ) const ( diff --git a/src/x/test/file.go b/src/x/test/file.go index e6d7dfedc7..7e63826369 100644 --- a/src/x/test/file.go +++ b/src/x/test/file.go @@ -42,9 +42,9 @@ func NewCorruptingFile( seed int64, ) xos.File { return &corruptingFile{ - fd: fd, + fd: fd, corruptionProbability: corruptionProbability, - rng: rand.New(rand.NewSource(seed)), + rng: rand.New(rand.NewSource(seed)), } } diff --git a/src/x/test/hash/hash.go b/src/x/test/hash/hash.go index 8a2cb397f2..aa33030169 100644 --- a/src/x/test/hash/hash.go +++ b/src/x/test/hash/hash.go @@ -25,11 +25,11 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + "github.com/m3db/m3/src/dbnode/persist/schema" "github.com/m3db/m3/src/dbnode/ts" "github.com/m3db/m3/src/x/ident" - - "github.com/stretchr/testify/require" ) type parsedIndexHasher struct { diff --git a/src/x/test/ident_cmp_matcher.go b/src/x/test/ident_cmp_matcher.go index 8eee4db015..25d62b4574 100644 --- a/src/x/test/ident_cmp_matcher.go +++ b/src/x/test/ident_cmp_matcher.go @@ -21,9 +21,9 @@ package test import ( - "github.com/m3db/m3/src/x/ident" - "github.com/google/go-cmp/cmp" + + "github.com/m3db/m3/src/x/ident" ) // IdentTransformer transforms any ident.ID into ident.BytesID to make it easier for comparison. diff --git a/src/x/test/namespace_extended_opts.go b/src/x/test/namespace_extended_opts.go index 1dbafc936c..ea758207ba 100644 --- a/src/x/test/namespace_extended_opts.go +++ b/src/x/test/namespace_extended_opts.go @@ -24,11 +24,11 @@ import ( "errors" "fmt" + protobuftypes "github.com/gogo/protobuf/types" + nsproto "github.com/m3db/m3/src/dbnode/generated/proto/namespace" "github.com/m3db/m3/src/dbnode/namespace" xjson "github.com/m3db/m3/src/x/json" - - protobuftypes "github.com/gogo/protobuf/types" ) // TypeURLPrefix is a type URL prefix for storing in protobuf Any messages. diff --git a/src/x/test/reporter.go b/src/x/test/reporter.go index 16c6cb1bc5..c9089ec7c1 100644 --- a/src/x/test/reporter.go +++ b/src/x/test/reporter.go @@ -32,26 +32,28 @@ import ( // when interacting with gomock.Controller. // // For example, consider: -// func TestMyThing(t *testing.T) { -// mockCtrl := gomock.NewController(t) -// defer mockCtrl.Finish() -// mockObj := something.NewMockMyInterface(mockCtrl) -// go func() { -// mockObj.SomeMethod(4, "blah") -// } -// } +// +// func TestMyThing(t *testing.T) { +// mockCtrl := gomock.NewController(t) +// defer mockCtrl.Finish() +// mockObj := something.NewMockMyInterface(mockCtrl) +// go func() { +// mockObj.SomeMethod(4, "blah") +// } +// } // // It hangs without any indication that it's missing an EXPECT() on `mockObj`. // Providing the Reporter to the gomock.Controller ctor avoids this, and terminates // with useful feedback. i.e. -// func TestMyThing(t *testing.T) { -// mockCtrl := gomock.NewController(test.Reporter{t}) -// defer mockCtrl.Finish() -// mockObj := something.NewMockMyInterface(mockCtrl) -// go func() { -// mockObj.SomeMethod(4, "blah") // crashes the test now -// } -// } +// +// func TestMyThing(t *testing.T) { +// mockCtrl := gomock.NewController(test.Reporter{t}) +// defer mockCtrl.Finish() +// mockObj := something.NewMockMyInterface(mockCtrl) +// go func() { +// mockObj.SomeMethod(4, "blah") // crashes the test now +// } +// } type Reporter struct { T require.TestingT } diff --git a/src/x/test/testmarshal/marshal.go b/src/x/test/testmarshal/marshal.go index d1acf73ca2..b76c4288cb 100644 --- a/src/x/test/testmarshal/marshal.go +++ b/src/x/test/testmarshal/marshal.go @@ -22,18 +22,19 @@ // (serialization/deserialization) behavior for types. It is intended to reduce // boilerplate in tests of the form: // -// func TestMyTypeUnmarshals(t *testing.T) { -// type MyType struct{} -// var mt MyType -// require.NoError(t, json.Unmarshal([]byte("{}"), &mt)) -// assert.Equal(t, MyType{}, mt) -// } +// func TestMyTypeUnmarshals(t *testing.T) { +// type MyType struct{} +// var mt MyType +// require.NoError(t, json.Unmarshal([]byte("{}"), &mt)) +// assert.Equal(t, MyType{}, mt) +// } // // with assertion calls: -// func TestMyTypeUnmarshals(t *testing.T) { -// type MyType struct{} -// testmarshal.AssertUnmarshals(t, testmarshal.JSONMarshaler, MyType{}, []byte("{}")) -// } +// +// func TestMyTypeUnmarshals(t *testing.T) { +// type MyType struct{} +// testmarshal.AssertUnmarshals(t, testmarshal.JSONMarshaler, MyType{}, []byte("{}")) +// } package testmarshal import ( @@ -133,11 +134,10 @@ func (sm simpleMarshaler) ID() string { // } // // with: - -// func TestMyTypeRoundtrips(t *testing.T) { -// type MyType struct{} -// testmarshal.AssertMarshalingRoundtrips(t, testmarshal.JSONMarshaler, MyType{}) -// } +// func TestMyTypeRoundtrips(t *testing.T) { +// type MyType struct{} +// testmarshal.AssertMarshalingRoundtrips(t, testmarshal.JSONMarshaler, MyType{}) +// } func AssertMarshalingRoundtrips(t *testing.T, marshaller Marshaler, example interface{}) bool { d, err := marshaller.Marshal(example) if !assert.NoError(t, err) { @@ -180,22 +180,23 @@ func AssertUnmarshals(t *testing.T, marshaller Marshaler, expected interface{}, // AssertMarshals checks that the given value marshals into data equal // to expectedData. -// It is intended to replace tests of the form: // -// func TestMyTypeMarshals(t *testing.T) { -// type MyType struct{} -// mt := MyType{} -// d, err := json.Marshal(mt) -// require.NoError(t, err) -// assert.Equal(t, d, []byte("{}")) -// } +// It is intended to replace tests of the form: +// +// func TestMyTypeMarshals(t *testing.T) { +// type MyType struct{} +// mt := MyType{} +// d, err := json.Marshal(mt) +// require.NoError(t, err) +// assert.Equal(t, d, []byte("{}")) +// } // // with: // -// func TestMyTypeUnmarshals(t *testing.T) { -// type MyType struct{} -// testmarshal.AssertMarshals(t, testmarshal.JSONMarshaler, MyType{}, []byte("{}")) -// } +// func TestMyTypeUnmarshals(t *testing.T) { +// type MyType struct{} +// testmarshal.AssertMarshals(t, testmarshal.JSONMarshaler, MyType{}, []byte("{}")) +// } func AssertMarshals(t *testing.T, marshaller Marshaler, toMarshal interface{}, expectedData []byte) bool { marshalled, err := marshaller.Marshal(toMarshal) if !assert.NoError(t, err) { diff --git a/src/x/time/unix_nano.go b/src/x/time/unix_nano.go index b5251eda4c..78a17a75a3 100644 --- a/src/x/time/unix_nano.go +++ b/src/x/time/unix_nano.go @@ -122,6 +122,7 @@ func (u UnixNano) IsZero() bool { } // String returns the time formatted using the format string +// // "2006-01-02 15:04:05.999999999 -0700 MST" func (u UnixNano) String() string { return u.ToTime().UTC().String() diff --git a/src/x/watch/source.go b/src/x/watch/source.go index aba93b0087..570d8384d1 100644 --- a/src/x/watch/source.go +++ b/src/x/watch/source.go @@ -24,9 +24,9 @@ import ( "errors" "sync" - xresource "github.com/m3db/m3/src/x/resource" - "go.uber.org/zap" + + xresource "github.com/m3db/m3/src/x/resource" ) // ErrSourceClosed indicates that the Source should be closed. diff --git a/src/x/watch/value_test.go b/src/x/watch/value_test.go index a59cd08d49..3f2105c7c9 100644 --- a/src/x/watch/value_test.go +++ b/src/x/watch/value_test.go @@ -26,8 +26,9 @@ import ( "testing" "time" - "github.com/m3db/m3/src/x/instrument" "github.com/stretchr/testify/require" + + "github.com/m3db/m3/src/x/instrument" ) func TestValueWatchAlreadyWatching(t *testing.T) {