agent: optimize rpc monitor test

pull/404/head
Ryan Uber 10 years ago
parent 35157659a3
commit b2ae3434b1

@ -232,7 +232,7 @@ func TestRPCClientMonitor(t *testing.T) {
found := false found := false
OUTER1: OUTER1:
for { for i := 0; ; i++ {
select { select {
case e := <-eventCh: case e := <-eventCh:
if strings.Contains(e, "Accepted client") { if strings.Contains(e, "Accepted client") {
@ -240,6 +240,10 @@ OUTER1:
break OUTER1 break OUTER1
} }
default: default:
if i > 100 {
break OUTER1
}
time.Sleep(10 * time.Millisecond)
} }
} }
if !found { if !found {
@ -249,18 +253,20 @@ OUTER1:
// Join a bad thing to generate more events // Join a bad thing to generate more events
p1.agent.JoinLAN(nil) p1.agent.JoinLAN(nil)
time.Sleep(1 * time.Second)
found = false found = false
OUTER2: OUTER2:
for { for i := 0; ; i++ {
select { select {
case e := <-eventCh: case e := <-eventCh:
if strings.Contains(e, "joining") { if strings.Contains(e, "joining") {
found = true found = true
break OUTER2
} }
default: default:
break OUTER2 if i > 100 {
break OUTER2
}
time.Sleep(10 * time.Millisecond)
} }
} }
if !found { if !found {

Loading…
Cancel
Save