Skip to content
Snippets Groups Projects
Commit 3e4eb0ab authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #669 from lzp0412/develop

Fix: nacos unit test failed
parents 8ed12a0e bf364f7e
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,10 @@
package nacos
import (
"math/rand"
"strconv"
"testing"
"time"
)
import (
......@@ -84,8 +87,8 @@ func TestNacosServiceDiscovery_CRUD(t *testing.T) {
})
extension.SetAndInitGlobalDispatcher("mock")
serviceName := "service-name"
rand.Seed(time.Now().Unix())
serviceName := "service-name" + strconv.Itoa(rand.Intn(10000))
id := "id"
host := "host"
port := 123
......@@ -113,7 +116,9 @@ func TestNacosServiceDiscovery_CRUD(t *testing.T) {
err := serviceDiscovry.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
time.Sleep(11 * time.Second)
page := serviceDiscovry.GetHealthyInstancesByPage(serviceName, 0, 10, true)
assert.NotNil(t, page)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment