From 084b1f5f73bc73d2498559de100f92601a4fdb53 Mon Sep 17 00:00:00 2001 From: Jordan Neufeld Date: Thu, 10 Mar 2022 08:41:19 -0600 Subject: [PATCH] added sleep to racy metrics test --- metrics_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metrics_test.go b/metrics_test.go index f83ffcde7..dec51fa1f 100644 --- a/metrics_test.go +++ b/metrics_test.go @@ -8,6 +8,7 @@ import ( "reflect" "strings" "testing" + "time" "github.com/Shopify/toxiproxy/v2/collectors" "github.com/Shopify/toxiproxy/v2/stream" @@ -31,6 +32,7 @@ func TestProxyMetricsReceivedSentBytes(t *testing.T) { bufio.NewWriter(bytes.NewBuffer([]byte{})), } proxy.Toxics.StartLink(srv, "testupstream", r, w, stream.Upstream) + time.Sleep(time.Millisecond * 100) gotMetrics := prometheusOutput(t, srv, "toxiproxy") if !reflect.DeepEqual(gotMetrics, expectedMetrics) { t.Fatalf("expected: %v got: %v", expectedMetrics, gotMetrics)