mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-20 18:57:41 +03:00
possibly fix the test timeout in HostNameCollision
This commit is contained in:
parent
1d63444579
commit
664dbb0976
12
host_test.go
12
host_test.go
@ -108,9 +108,11 @@ func TestHostNameCollision(t *testing.T) {
|
||||
s, host := getHost(t, nil)
|
||||
defer s.Close()
|
||||
|
||||
newUsers := make(chan *message.User)
|
||||
newUsers1 := make(chan *message.User)
|
||||
newUsers2 := make(chan *message.User)
|
||||
host.OnUserJoined = func(u *message.User) {
|
||||
newUsers <- u
|
||||
newUsers1 <- u
|
||||
newUsers2 <- u
|
||||
}
|
||||
go host.Serve()
|
||||
|
||||
@ -119,6 +121,7 @@ func TestHostNameCollision(t *testing.T) {
|
||||
// First client
|
||||
g.Go(func() error {
|
||||
return sshd.ConnectShell(s.Addr().String(), "foo", func(r io.Reader, w io.WriteCloser) error {
|
||||
<-newUsers1
|
||||
scanner := bufio.NewScanner(r)
|
||||
|
||||
// Consume the initial buffer
|
||||
@ -130,7 +133,7 @@ func TestHostNameCollision(t *testing.T) {
|
||||
}
|
||||
|
||||
// wait for the second client
|
||||
<-newUsers
|
||||
<-newUsers1
|
||||
|
||||
scanner.Scan()
|
||||
actual = scanner.Text()
|
||||
@ -152,8 +155,9 @@ func TestHostNameCollision(t *testing.T) {
|
||||
// Second client
|
||||
g.Go(func() error {
|
||||
// wait for the first client
|
||||
<-newUsers
|
||||
<-newUsers2
|
||||
return sshd.ConnectShell(s.Addr().String(), "foo", func(r io.Reader, w io.WriteCloser) error {
|
||||
<-newUsers2
|
||||
scanner := bufio.NewScanner(r)
|
||||
// Consume the initial buffer
|
||||
scanner.Scan()
|
||||
|
Loading…
x
Reference in New Issue
Block a user