Fix more silly race conditions in tests
This commit is contained in:
parent
cc6ab7fc90
commit
2b8c0d7b5c
|
@ -184,10 +184,13 @@ func TestHostKick(t *testing.T) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
// First client
|
// First client
|
||||||
err = sshd.ConnectShell(addr, "foo", func(r io.Reader, w io.WriteCloser) {
|
err := sshd.ConnectShell(addr, "foo", func(r io.Reader, w io.WriteCloser) {
|
||||||
// Make op
|
// Make op
|
||||||
member, _ := host.Room.MemberById("foo")
|
member, _ := host.Room.MemberById("foo")
|
||||||
member.Op = true
|
if member == nil {
|
||||||
|
t.Fatal("failed to load MemberById")
|
||||||
|
}
|
||||||
|
host.Room.Ops.Add(member)
|
||||||
|
|
||||||
// Block until second client is here
|
// Block until second client is here
|
||||||
connected <- struct{}{}
|
connected <- struct{}{}
|
||||||
|
@ -200,7 +203,7 @@ func TestHostKick(t *testing.T) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
// Second client
|
// Second client
|
||||||
err = sshd.ConnectShell(addr, "bar", func(r io.Reader, w io.WriteCloser) {
|
err := sshd.ConnectShell(addr, "bar", func(r io.Reader, w io.WriteCloser) {
|
||||||
<-connected
|
<-connected
|
||||||
|
|
||||||
// Consume while we're connected. Should break when kicked.
|
// Consume while we're connected. Should break when kicked.
|
||||||
|
|
Loading…
Reference in New Issue