From 25bd17a2147d7169695772c2a887cdd54caff770 Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Fri, 10 Apr 2020 10:30:20 +0200 Subject: Add timeout to connection_handler_test --- connection_handler_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/connection_handler_test.go b/connection_handler_test.go index 85aee0c..aefa058 100644 --- a/connection_handler_test.go +++ b/connection_handler_test.go @@ -154,8 +154,14 @@ func TestConnectionFactory(t *testing.T) { go testInteraction(serverClientNetFlow, serverClientTransportFlow, otherSeenChan, completed) } + timeout := time.Tick(1 * time.Second) for i := 0; i < n; i++ { - <-completed + select { + case <- completed: + continue + case <- timeout: + t.Fatal("timeout") + } } assert.Len(t, factory.connections, 0) -- cgit v1.2.3-70-g09d2