diff --git a/ssh/ssh_gocrypto_test.go b/ssh/ssh_gocrypto_test.go index f3ded2a8..18e0947c 100644 --- a/ssh/ssh_gocrypto_test.go +++ b/ssh/ssh_gocrypto_test.go @@ -40,13 +40,17 @@ type sshServer struct { } func (s *sshServer) run(c *gc.C, running chan<- struct{}) { + // Attempt to introduce a synchronization point so that we can + // be sure that the server is running before we try to connect. go func() { + time.Sleep(testing.ShortWait) select { case running <- struct{}{}: case <-time.After(testing.ShortWait): c.Fatalf("timed out waiting to send start signal") } }() + netconn, err := s.listener.Accept() c.Assert(err, jc.ErrorIsNil) defer netconn.Close()