Browse Source

Try writing null so door can detect socket closed.

Still having issues when running tests with count.
Steve Thielemann 3 years ago
parent
commit
253f845e90
2 changed files with 5 additions and 2 deletions
  1. 3 0
      door/input_test.go
  2. 2 2
      door/menu_test.go

+ 3 - 0
door/input_test.go

@@ -240,6 +240,9 @@ func TestDoorInputConnection(t *testing.T) {
 	if hungup != -2 {
 		t.Errorf("Expected -2 (hangup), got %d", hungup)
 	}
+
+	d.Write("\x00")
+	time.Sleep(time.Millisecond)
 }
 
 func TestDisplayInput(t *testing.T) {

+ 2 - 2
door/menu_test.go

@@ -220,7 +220,6 @@ func TestMenuConnection(t *testing.T) {
 	}
 
 	time.Sleep(time.Millisecond)
-	runtime.Gosched()
 	if d.Disconnected {
 		t.Errorf("Disconnected")
 	}
@@ -330,5 +329,6 @@ func TestMenuConnection(t *testing.T) {
 	// output = string(buffer[:r])
 	server.Close()
 	client.Close()
-	close(d.writerChannel)
+	d.Write("\x00")
+	time.Sleep(time.Millisecond)
 }