You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/10/07 09:46:37 UTC

[skywalking-banyandb] branch main updated: Fix test cases with Eventually semantics (#183) (#185)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new e814b62  Fix test cases with Eventually semantics (#183) (#185)
e814b62 is described below

commit e814b62a91799dbfc57e2394021dd97dee75fdbe
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Fri Oct 7 17:46:33 2022 +0800

    Fix test cases with Eventually semantics (#183) (#185)
---
 .golangci-format.yml                    |  8 +++++++-
 .golangci.yml                           |  7 ++++++-
 banyand/liaison/grpc/registry_test.go   |  1 -
 banyand/stream/metadata.go              |  1 -
 banyand/tsdb/block.go                   |  3 ++-
 banyand/tsdb/retention.go               |  3 ++-
 banyand/tsdb/segment.go                 |  3 ++-
 bydbctl/internal/cmd/group.go           |  2 +-
 bydbctl/internal/cmd/root.go            |  3 ++-
 bydbctl/internal/cmd/stream.go          |  2 +-
 bydbctl/internal/cmd/stream_test.go     | 14 +++++++-------
 bydbctl/internal/cmd/use.go             |  3 ++-
 deprecated-golangci.yml                 |  7 ++++++-
 pkg/index/lsm/lsm.go                    |  3 ++-
 pkg/query/logical/index_filter.go       |  3 ++-
 pkg/query/logical/measure/schema.go     |  6 +++---
 pkg/query/logical/tag_filter.go         |  3 ++-
 pkg/signal/handler.go                   |  6 ++++--
 pkg/test/setup/setup.go                 |  4 ++--
 pkg/test/stream/traffic/traffic.go      |  1 -
 pkg/timestamp/nano.go                   |  1 -
 scripts/build/lint-bin.mk               |  2 +-
 test/integration/other/property_test.go |  2 +-
 23 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/.golangci-format.yml b/.golangci-format.yml
index 50c5c15..bc5db6b 100644
--- a/.golangci-format.yml
+++ b/.golangci-format.yml
@@ -27,9 +27,15 @@ run:
 linters:
   disable-all: true
   enable:
-  - goimports
+  - gci
   - gofumpt
   fast: false
+linters-settings:
+  gci:
+    sections:
+      - standard
+      - default
+      - prefix(github.com/apache/skywalking-banyandb/) 
 
 issues:
   max-per-linter: 0
diff --git a/.golangci.yml b/.golangci.yml
index 1bc0bed..b6b547f 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -21,7 +21,7 @@ linters:
     - gocritic
     - goconst
     - gofumpt
-    - goimports
+    - gci
     - gosimple
     - govet
     - ineffassign
@@ -49,6 +49,11 @@ linters-settings:
     check-exported: false
   unparam:
     check-exported: false
+  gci:
+    sections:
+      - standard
+      - default
+      - prefix(github.com/apache/skywalking-banyandb/) 
   gocritic:
     enabled-checks:
       - appendCombine
diff --git a/banyand/liaison/grpc/registry_test.go b/banyand/liaison/grpc/registry_test.go
index f22cd0a..03c6d84 100644
--- a/banyand/liaison/grpc/registry_test.go
+++ b/banyand/liaison/grpc/registry_test.go
@@ -34,7 +34,6 @@ import (
 	"github.com/apache/skywalking-banyandb/banyand/metadata"
 	"github.com/apache/skywalking-banyandb/banyand/queue"
 	"github.com/apache/skywalking-banyandb/pkg/test"
-
 	teststream "github.com/apache/skywalking-banyandb/pkg/test/stream"
 )
 
diff --git a/banyand/stream/metadata.go b/banyand/stream/metadata.go
index 870a887..980c347 100644
--- a/banyand/stream/metadata.go
+++ b/banyand/stream/metadata.go
@@ -32,7 +32,6 @@ import (
 	"github.com/apache/skywalking-banyandb/banyand/tsdb"
 	"github.com/apache/skywalking-banyandb/pkg/encoding"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
-
 	pb_v1 "github.com/apache/skywalking-banyandb/pkg/pb/v1"
 	resourceSchema "github.com/apache/skywalking-banyandb/pkg/schema"
 )
diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go
index 5e8c699..2d930de 100644
--- a/banyand/tsdb/block.go
+++ b/banyand/tsdb/block.go
@@ -29,6 +29,8 @@ import (
 	"sync/atomic"
 	"time"
 
+	"github.com/pkg/errors"
+
 	"github.com/apache/skywalking-banyandb/api/common"
 	"github.com/apache/skywalking-banyandb/banyand/kv"
 	"github.com/apache/skywalking-banyandb/banyand/observability"
@@ -39,7 +41,6 @@ import (
 	"github.com/apache/skywalking-banyandb/pkg/index/lsm"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
 	"github.com/apache/skywalking-banyandb/pkg/timestamp"
-	"github.com/pkg/errors"
 )
 
 const (
diff --git a/banyand/tsdb/retention.go b/banyand/tsdb/retention.go
index 957c268..ab61a8d 100644
--- a/banyand/tsdb/retention.go
+++ b/banyand/tsdb/retention.go
@@ -21,8 +21,9 @@ import (
 	"sync"
 	"time"
 
-	"github.com/apache/skywalking-banyandb/pkg/logger"
 	"github.com/robfig/cron/v3"
+
+	"github.com/apache/skywalking-banyandb/pkg/logger"
 )
 
 type retentionController struct {
diff --git a/banyand/tsdb/segment.go b/banyand/tsdb/segment.go
index bbdad22..ed1bd3c 100644
--- a/banyand/tsdb/segment.go
+++ b/banyand/tsdb/segment.go
@@ -27,13 +27,14 @@ import (
 	"sync"
 	"time"
 
+	"go.uber.org/multierr"
+
 	"github.com/apache/skywalking-banyandb/api/common"
 	"github.com/apache/skywalking-banyandb/banyand/kv"
 	"github.com/apache/skywalking-banyandb/banyand/observability"
 	"github.com/apache/skywalking-banyandb/banyand/tsdb/bucket"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
 	"github.com/apache/skywalking-banyandb/pkg/timestamp"
-	"go.uber.org/multierr"
 )
 
 var ErrEndOfSegment = errors.New("reached the end of the segment")
diff --git a/bydbctl/internal/cmd/group.go b/bydbctl/internal/cmd/group.go
index 7938a38..cf5e5d0 100644
--- a/bydbctl/internal/cmd/group.go
+++ b/bydbctl/internal/cmd/group.go
@@ -21,13 +21,13 @@ import (
 	"encoding/json"
 	"fmt"
 
-	"github.com/apache/skywalking-banyandb/pkg/version"
 	"github.com/go-resty/resty/v2"
 	"github.com/spf13/cobra"
 	"google.golang.org/protobuf/encoding/protojson"
 
 	common_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
 	database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+	"github.com/apache/skywalking-banyandb/pkg/version"
 )
 
 func newGroupCmd() *cobra.Command {
diff --git a/bydbctl/internal/cmd/root.go b/bydbctl/internal/cmd/root.go
index c7fd7e3..d6669a1 100644
--- a/bydbctl/internal/cmd/root.go
+++ b/bydbctl/internal/cmd/root.go
@@ -22,9 +22,10 @@ import (
 	"fmt"
 	"os"
 
-	"github.com/apache/skywalking-banyandb/pkg/version"
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
+
+	"github.com/apache/skywalking-banyandb/pkg/version"
 )
 
 var (
diff --git a/bydbctl/internal/cmd/stream.go b/bydbctl/internal/cmd/stream.go
index 00316ad..719ec32 100644
--- a/bydbctl/internal/cmd/stream.go
+++ b/bydbctl/internal/cmd/stream.go
@@ -21,13 +21,13 @@ import (
 	"encoding/json"
 	"fmt"
 
-	"github.com/apache/skywalking-banyandb/pkg/version"
 	"github.com/go-resty/resty/v2"
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
 	"google.golang.org/protobuf/encoding/protojson"
 
 	database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+	"github.com/apache/skywalking-banyandb/pkg/version"
 )
 
 const streamSchemaPath = "/api/v1/stream/schema"
diff --git a/bydbctl/internal/cmd/stream_test.go b/bydbctl/internal/cmd/stream_test.go
index 479c136..966d99f 100644
--- a/bydbctl/internal/cmd/stream_test.go
+++ b/bydbctl/internal/cmd/stream_test.go
@@ -22,6 +22,13 @@ import (
 	"strings"
 	"time"
 
+	"github.com/ghodss/yaml"
+	. "github.com/onsi/ginkgo/v2"
+	. "github.com/onsi/gomega"
+	"github.com/spf13/cobra"
+	"github.com/zenizh/go-capturer"
+
+	database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
 	"github.com/apache/skywalking-banyandb/banyand/discovery"
 	"github.com/apache/skywalking-banyandb/banyand/liaison/grpc"
 	"github.com/apache/skywalking-banyandb/banyand/liaison/http"
@@ -33,13 +40,6 @@ import (
 	"github.com/apache/skywalking-banyandb/bydbctl/internal/cmd"
 	"github.com/apache/skywalking-banyandb/pkg/test"
 	"github.com/apache/skywalking-banyandb/pkg/test/helpers"
-	"github.com/ghodss/yaml"
-	. "github.com/onsi/ginkgo/v2"
-	. "github.com/onsi/gomega"
-	"github.com/spf13/cobra"
-	"github.com/zenizh/go-capturer"
-
-	database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
 )
 
 var _ = Describe("Stream", func() {
diff --git a/bydbctl/internal/cmd/use.go b/bydbctl/internal/cmd/use.go
index a4429bf..33cc9af 100644
--- a/bydbctl/internal/cmd/use.go
+++ b/bydbctl/internal/cmd/use.go
@@ -20,9 +20,10 @@ package cmd
 import (
 	"fmt"
 
-	"github.com/apache/skywalking-banyandb/pkg/version"
 	"github.com/spf13/cobra"
 	"github.com/spf13/viper"
+
+	"github.com/apache/skywalking-banyandb/pkg/version"
 )
 
 func newUserCmd() *cobra.Command {
diff --git a/deprecated-golangci.yml b/deprecated-golangci.yml
index f79312b..61c209d 100644
--- a/deprecated-golangci.yml
+++ b/deprecated-golangci.yml
@@ -26,7 +26,7 @@ linters:
     - unconvert
     - varcheck
     - govet
-    - goimports
+    - gci
     - prealloc
     - unused
     - staticcheck
@@ -41,6 +41,11 @@ linters-settings:
     min-occurrences: 4
   govet:
     check-shadowing: true
+  gci:
+    sections:
+      - standard
+      - default
+      - prefix(github.com/apache/skywalking-banyandb/) 
 run:
   deadline: 10m
   skip-files:
diff --git a/pkg/index/lsm/lsm.go b/pkg/index/lsm/lsm.go
index 7af6cd2..8c366ad 100644
--- a/pkg/index/lsm/lsm.go
+++ b/pkg/index/lsm/lsm.go
@@ -18,13 +18,14 @@
 package lsm
 
 import (
+	"go.uber.org/multierr"
+
 	"github.com/apache/skywalking-banyandb/api/common"
 	"github.com/apache/skywalking-banyandb/banyand/kv"
 	"github.com/apache/skywalking-banyandb/banyand/observability"
 	"github.com/apache/skywalking-banyandb/pkg/convert"
 	"github.com/apache/skywalking-banyandb/pkg/index"
 	"github.com/apache/skywalking-banyandb/pkg/logger"
-	"go.uber.org/multierr"
 )
 
 var _ index.Store = (*store)(nil)
diff --git a/pkg/query/logical/index_filter.go b/pkg/query/logical/index_filter.go
index ef49386..847dbd3 100644
--- a/pkg/query/logical/index_filter.go
+++ b/pkg/query/logical/index_filter.go
@@ -23,6 +23,8 @@ import (
 	"encoding/json"
 	"strings"
 
+	"github.com/pkg/errors"
+
 	"github.com/apache/skywalking-banyandb/api/common"
 	database_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
 	model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
@@ -30,7 +32,6 @@ import (
 	"github.com/apache/skywalking-banyandb/pkg/convert"
 	"github.com/apache/skywalking-banyandb/pkg/index"
 	"github.com/apache/skywalking-banyandb/pkg/index/posting"
-	"github.com/pkg/errors"
 )
 
 var (
diff --git a/pkg/query/logical/measure/schema.go b/pkg/query/logical/measure/schema.go
index a7a2ed5..7dcf54d 100644
--- a/pkg/query/logical/measure/schema.go
+++ b/pkg/query/logical/measure/schema.go
@@ -18,12 +18,12 @@
 package measure
 
 import (
-	databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
+	"github.com/google/go-cmp/cmp"
+	"github.com/pkg/errors"
 
+	databasev1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1"
 	"github.com/apache/skywalking-banyandb/banyand/tsdb"
 	"github.com/apache/skywalking-banyandb/pkg/query/logical"
-	"github.com/google/go-cmp/cmp"
-	"github.com/pkg/errors"
 )
 
 type schema struct {
diff --git a/pkg/query/logical/tag_filter.go b/pkg/query/logical/tag_filter.go
index 6402972..08718b4 100644
--- a/pkg/query/logical/tag_filter.go
+++ b/pkg/query/logical/tag_filter.go
@@ -22,8 +22,9 @@ import (
 	"fmt"
 	"strings"
 
-	model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
 	"github.com/pkg/errors"
+
+	model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
 )
 
 var ErrUnsupportedLogicalOperation = errors.New("unsupported logical operation")
diff --git a/pkg/signal/handler.go b/pkg/signal/handler.go
index 79cab77..0ff833f 100644
--- a/pkg/signal/handler.go
+++ b/pkg/signal/handler.go
@@ -28,8 +28,10 @@ import (
 )
 
 // ErrSignal is returned when a termination signal is received.
-var ErrSignal = errors.New("signal received")
-var _ run.Service = (*Handler)(nil)
+var (
+	ErrSignal             = errors.New("signal received")
+	_         run.Service = (*Handler)(nil)
+)
 
 // Handler implements a unix signal handler as run.GroupService.
 type Handler struct {
diff --git a/pkg/test/setup/setup.go b/pkg/test/setup/setup.go
index b96092c..50997c3 100644
--- a/pkg/test/setup/setup.go
+++ b/pkg/test/setup/setup.go
@@ -21,6 +21,8 @@ import (
 	"context"
 	"fmt"
 
+	"github.com/onsi/gomega"
+
 	"github.com/apache/skywalking-banyandb/banyand/discovery"
 	"github.com/apache/skywalking-banyandb/banyand/liaison/grpc"
 	"github.com/apache/skywalking-banyandb/banyand/measure"
@@ -31,8 +33,6 @@ import (
 	"github.com/apache/skywalking-banyandb/pkg/test"
 	test_measure "github.com/apache/skywalking-banyandb/pkg/test/measure"
 	test_stream "github.com/apache/skywalking-banyandb/pkg/test/stream"
-
-	"github.com/onsi/gomega"
 )
 
 const host = "127.0.0.1"
diff --git a/pkg/test/stream/traffic/traffic.go b/pkg/test/stream/traffic/traffic.go
index 93ac164..09bed21 100644
--- a/pkg/test/stream/traffic/traffic.go
+++ b/pkg/test/stream/traffic/traffic.go
@@ -20,7 +20,6 @@ package traffic
 import (
 	"context"
 	"crypto/rand"
-
 	// Load some tag templates
 	_ "embed"
 	"encoding/base64"
diff --git a/pkg/timestamp/nano.go b/pkg/timestamp/nano.go
index c83decb..259629a 100644
--- a/pkg/timestamp/nano.go
+++ b/pkg/timestamp/nano.go
@@ -19,7 +19,6 @@ package timestamp
 import (
 	"math"
 	"time"
-
 	// link runtime pkg fastrand
 	_ "unsafe"
 
diff --git a/scripts/build/lint-bin.mk b/scripts/build/lint-bin.mk
index b33b5a5..0668b74 100644
--- a/scripts/build/lint-bin.mk
+++ b/scripts/build/lint-bin.mk
@@ -1,4 +1,4 @@
 
 LINTER := $(tool_bin)/golangci-lint
 $(LINTER):
-	@GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0
+	@GOBIN=$(tool_bin) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
diff --git a/test/integration/other/property_test.go b/test/integration/other/property_test.go
index 07dbdfb..37282b7 100644
--- a/test/integration/other/property_test.go
+++ b/test/integration/other/property_test.go
@@ -20,7 +20,6 @@ package integration_other_test
 import (
 	"context"
 
-	"github.com/apache/skywalking-banyandb/pkg/test/setup"
 	. "github.com/onsi/ginkgo/v2"
 	. "github.com/onsi/gomega"
 	grpclib "google.golang.org/grpc"
@@ -29,6 +28,7 @@ import (
 	common_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/common/v1"
 	model_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/model/v1"
 	property_v1 "github.com/apache/skywalking-banyandb/api/proto/banyandb/property/v1"
+	"github.com/apache/skywalking-banyandb/pkg/test/setup"
 )
 
 var _ = Describe("Property application", func() {