Skip to content

Commit

Permalink
fix 1.5 ut (#1204)
Browse files Browse the repository at this point in the history
* update

* update
  • Loading branch information
gaoxinge authored May 15, 2021
1 parent 3df419d commit 6b190b8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions registry/nacos/service_discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ import (
"github.com/apache/dubbo-go/registry"
)

var (
testName = "test"
)
var testName = "test"

func Test_newNacosServiceDiscovery(t *testing.T) {
name := "nacos1"
Expand Down Expand Up @@ -67,7 +65,6 @@ func Test_newNacosServiceDiscovery(t *testing.T) {
res, err := newNacosServiceDiscovery(name)
assert.Nil(t, err)
assert.NotNil(t, res)

}

func TestNacosServiceDiscovery_CRUD(t *testing.T) {
Expand Down Expand Up @@ -111,8 +108,8 @@ func TestNacosServiceDiscovery_CRUD(t *testing.T) {
err = serviceDiscovery.Register(instance)
assert.Nil(t, err)

//sometimes nacos may be failed to push update of instance,
//so it need 10s to pull, we sleep 10 second to make sure instance has been update
// sometimes nacos may be failed to push update of instance,
// so it need 10s to pull, we sleep 10 second to make sure instance has been update
time.Sleep(11 * time.Second)
page := serviceDiscovery.GetHealthyInstancesByPage(serviceName, 0, 10, true)
assert.NotNil(t, page)
Expand All @@ -126,7 +123,7 @@ func TestNacosServiceDiscovery_CRUD(t *testing.T) {
assert.Equal(t, host, instance.GetHost())
assert.Equal(t, port, instance.GetPort())
// TODO: console.nacos.io has updated to nacos 2.0 and serviceName has changed in 2.0, so ignore temporarily.
//assert.Equal(t, serviceName, instance.GetServiceName())
// assert.Equal(t, serviceName, instance.GetServiceName())
assert.Equal(t, 0, len(instance.GetMetadata()))

instance.Metadata["a"] = "b"
Expand Down

0 comments on commit 6b190b8

Please sign in to comment.