Skip to content

Commit

Permalink
usm: kafka: test: Add deadline to raw client read (#27762)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitkyrka authored Jul 20, 2024
1 parent d699e3b commit 431f2b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/network/usm/kafka_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ func (can *CannedClientServer) runClient(msgs []Message) {
require.NoError(can.t, err)
can.t.Cleanup(func() { _ = conn.Close() })

// Safety measure to avoid blocking forever in the case of bugs.
conn.SetDeadline(time.Now().Add(30 * time.Second))

reader := bufio.NewReader(conn)
for _, msg := range msgs {
buf := make([]byte, 0)
Expand Down

0 comments on commit 431f2b1

Please sign in to comment.