Browse Source

Add timeout to async_producer_test

Maxim Vladimirskiy 7 years ago
parent
commit
1596275bc3
1 changed files with 4 additions and 1 deletions
  1. 4 1
      async_producer_test.go

+ 4 - 1
async_producer_test.go

@@ -131,9 +131,12 @@ func TestAsyncProducer(t *testing.T) {
 			if msg.Metadata.(int) != i {
 				t.Error("Message metadata did not match")
 			}
+		case <-time.After(time.Second):
+			t.Errorf("Timeout waiting for msg #%d", i)
+			goto done
 		}
 	}
-
+done:
 	closeProducer(t, producer)
 	leader.Close()
 	seedBroker.Close()