From 5ba052227110a4834251ee88b109885ee4644e76 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Thu, 17 Dec 2020 16:40:12 +0100 Subject: [PATCH] Wait for mock metrics server to have started before running commands Signed-off-by: Guillaume Tardif --- tests/framework/mockmetrics.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/framework/mockmetrics.go b/tests/framework/mockmetrics.go index 541868e9d..90ee9799b 100644 --- a/tests/framework/mockmetrics.go +++ b/tests/framework/mockmetrics.go @@ -22,6 +22,7 @@ import ( "net" "net/http" "strings" + "time" "github.com/labstack/echo" ) @@ -77,4 +78,7 @@ func (s *MockMetricsServer) Start() { s.e.POST("/usage", s.handlePostUsage) _ = s.e.Start(":1323") }() + + // wait a bit for the mock metrics server to actually listen + time.Sleep(500 * time.Millisecond) }