Commit b96c383e authored by Penghao Cen's avatar Penghao Cen

Check grpc server ready properly

parent 90bc1265
...@@ -70,7 +70,7 @@ func (m *Stub) Start() error { ...@@ -70,7 +70,7 @@ func (m *Stub) Start() error {
// Wait till grpc server is ready. // Wait till grpc server is ready.
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
services := m.server.GetServiceInfo() services := m.server.GetServiceInfo()
if len(services) > 1 { if len(services) > 0 {
break break
} }
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
......
...@@ -90,20 +90,12 @@ func TestRun(t *testing.T) { ...@@ -90,20 +90,12 @@ func TestRun(t *testing.T) {
go e.run() go e.run()
// Wait for the first callback to be issued. // Wait for the first callback to be issued.
select { <-callbackChan
case <-callbackChan:
break
}
p.Update(updated) p.Update(updated)
// Wait for the second callback to be issued. // Wait for the second callback to be issued.
select { <-callbackChan
case <-callbackChan:
break
}
time.Sleep(time.Second)
e.mutex.Lock() e.mutex.Lock()
defer e.mutex.Unlock() defer e.mutex.Unlock()
......
Markdown is supported
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