Check grpc server ready properly

This commit is contained in:
Penghao Cen 2018-01-13 05:47:49 +08:00
parent 90bc1265cf
commit b96c383ef7
2 changed files with 3 additions and 11 deletions

View File

@ -70,7 +70,7 @@ func (m *Stub) Start() error {
// Wait till grpc server is ready.
for i := 0; i < 10; i++ {
services := m.server.GetServiceInfo()
if len(services) > 1 {
if len(services) > 0 {
break
}
time.Sleep(1 * time.Second)

View File

@ -90,20 +90,12 @@ func TestRun(t *testing.T) {
go e.run()
// Wait for the first callback to be issued.
select {
case <-callbackChan:
break
}
<-callbackChan
p.Update(updated)
// Wait for the second callback to be issued.
select {
case <-callbackChan:
break
}
time.Sleep(time.Second)
<-callbackChan
e.mutex.Lock()
defer e.mutex.Unlock()