FIX: waiting for worker fireup was making the test slow

Dodging the race condition with a sleep was fine, but we slept
for a whole second which was longer than this test takes to run!

I've scaled the sleep down to 250 miliseconds and increased the tries.

Even this is probably excessively long but now the test is fast agin.
This commit is contained in:
Joe Higton 2014-06-07 05:35:05 +01:00
parent 0a4489d1fe
commit 2f72b28d76

View File

@ -115,7 +115,7 @@ func TestWorkWithoutReady(t * testing.T){
// With the all-in-one Work() we don't know if the // With the all-in-one Work() we don't know if the
// worker is ready at this stage so we may have to wait a sec: // worker is ready at this stage so we may have to wait a sec:
go func(){ go func(){
tries := 3 tries := 5
for( tries > 0 ){ for( tries > 0 ){
if other_worker.ready { if other_worker.ready {
other_worker.Echo([]byte("Hello")) other_worker.Echo([]byte("Hello"))
@ -123,7 +123,7 @@ func TestWorkWithoutReady(t * testing.T){
} }
// still waiting for it to be ready.. // still waiting for it to be ready..
time.Sleep(1 * time.Second) time.Sleep(250 * time.Millisecond)
tries-- tries--
} }
}() }()