Merge remote-tracking branch 'origin/3.0' into 3.0
diff --git a/registry/polaris/core_test.go b/registry/polaris/core_test.go
deleted file mode 100644
index 26a573c..0000000
--- a/registry/polaris/core_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package polaris
-
-import (
- "sync"
- "testing"
-)
-
-import (
- "github.com/polarismesh/polaris-go/api"
- "github.com/polarismesh/polaris-go/pkg/model"
-
- "github.com/stretchr/testify/assert"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/remoting"
-)
-
-func TestPolarisServiceWatcher_AddSubscriber(t *testing.T) {
- var (
- newParam api.WatchServiceRequest
- newConsumer api.ConsumerAPI
- )
- type fields struct {
- consumer api.ConsumerAPI
- subscribeParam *api.WatchServiceRequest
- lock *sync.RWMutex
- subscribers []item
- execOnce *sync.Once
- }
- type args struct {
- subscriber func(remoting.EventType, []model.Instance)
- }
- var tests []struct {
- name string
- fields fields
- args args
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- watcher := &PolarisServiceWatcher{
- subscribeParam: &newParam,
- consumer: newConsumer,
- lock: &sync.RWMutex{},
- subscribers: make([]item, 0),
- execOnce: &sync.Once{},
- }
- assert.Empty(t, watcher)
- })
- }
-}
diff --git a/registry/polaris/registry.go b/registry/polaris/registry.go
index 255acdb..e1ef292 100644
--- a/registry/polaris/registry.go
+++ b/registry/polaris/registry.go
@@ -171,7 +171,8 @@
watcher, err := newPolarisWatcher(&newParam, newConsumer)
if err != nil {
logger.Warnf("getwatcher() = err:%v", perrors.WithStack(err))
- <-time.After(time.Duration(RegistryConnDelay) * time.Second)
+ timer := time.NewTimer(time.Duration(RegistryConnDelay) * time.Second)
+ timer.Reset(time.Duration(RegistryConnDelay) * time.Second)
continue
}
for {
diff --git a/registry/polaris/registry_test.go b/registry/polaris/registry_test.go
deleted file mode 100644
index 45068b0..0000000
--- a/registry/polaris/registry_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package polaris
-
-import (
- "reflect"
- "sync"
- "testing"
-)
-
-import (
- "github.com/polarismesh/polaris-go/api"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/common"
-)
-
-func Test_createDeregisterParam(t *testing.T) {
- type args struct {
- url *common.URL
- serviceName string
- }
- tests := []struct {
- name string
- args args
- want *api.InstanceDeRegisterRequest
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- if got := createDeregisterParam(tt.args.url, tt.args.serviceName); !reflect.DeepEqual(got, tt.want) {
- t.Errorf("createDeregisterParam() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func Test_polarisRegistry_Destroy(t *testing.T) {
- type fields struct {
- url *common.URL
- provider api.ProviderAPI
- lock *sync.RWMutex
- registryUrls map[string]*PolarisHeartbeat
- listenerLock *sync.RWMutex
- }
- tests := []struct {
- name string
- fields fields
- }{
- {
- name: "Test_polarisRegistry_Destroy",
- fields: fields{
- url: nil,
- provider: nil,
- registryUrls: nil,
- },
- },
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- })
- }
-}