Skip to content

Commit

Permalink
fix(daemon): attempt to fix idle timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Dec 6, 2024
1 parent 06bc8cf commit 50ed2b8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,21 @@ func TestMain(m *testing.M) {
}

func TestIdleTimeout(t *testing.T) {
c, err := net.Dial("tcp", testDaemon.addr)
if err != nil {
t.Fatal(err)
var err error
var c net.Conn
var tries int
for {
c, err = net.Dial("tcp", testDaemon.addr)
if err != nil && tries >= 3 {
t.Fatal(err)
}
tries++
if testDaemon.conns.Size() != 0 {
break
}
time.Sleep(10 * time.Millisecond)
}
time.Sleep(time.Second)
time.Sleep(2 * time.Second)
_, err = readPktline(c)
if err == nil {
t.Errorf("expected error, got nil")
Expand Down

0 comments on commit 50ed2b8

Please sign in to comment.