mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-12 23:27:17 +03:00
Fix unit tests / Travis (#238)
* Fix net_test * Update host test to add carriage return char * Fix host_test so it will not hang if the SSH connection fails Fixes #231, closes #235.
This commit is contained in:
parent
a631215f5b
commit
05597b3e6a
@ -71,7 +71,7 @@ func TestHostNameCollision(t *testing.T) {
|
||||
// Consume the initial buffer
|
||||
scanner.Scan()
|
||||
actual := stripPrompt(scanner.Text())
|
||||
expected := " * foo joined. (Connected: 1)"
|
||||
expected := " * foo joined. (Connected: 1)\r"
|
||||
if actual != expected {
|
||||
t.Errorf("Got %q; expected %q", actual, expected)
|
||||
}
|
||||
@ -87,7 +87,7 @@ func TestHostNameCollision(t *testing.T) {
|
||||
t.Errorf("First client failed to get 'foo' name: %q", actual)
|
||||
}
|
||||
actual = stripPrompt(actual)
|
||||
expected = " * Guest1 joined. (Connected: 2)"
|
||||
expected = " * Guest1 joined. (Connected: 2)\r"
|
||||
if actual != expected {
|
||||
t.Errorf("Got %q; expected %q", actual, expected)
|
||||
}
|
||||
@ -97,6 +97,7 @@ func TestHostNameCollision(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
done <- struct{}{}
|
||||
t.Fatal(err)
|
||||
}
|
||||
}()
|
||||
@ -203,6 +204,7 @@ func TestHostKick(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
connected <- struct{}{}
|
||||
close(connected)
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -218,6 +220,7 @@ func TestHostKick(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
close(done)
|
||||
t.Fatal(err)
|
||||
}
|
||||
close(done)
|
||||
|
@ -26,6 +26,7 @@ func NewClientConfig(name string) *ssh.ClientConfig {
|
||||
return
|
||||
}),
|
||||
},
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ func TestServeTerminals(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
_, err = term.Write([]byte("echo: " + line + "\r\n"))
|
||||
_, err = term.Write([]byte("echo: " + line + "\n"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user