From 032c516fc7a8ca12defc71146264fc77bcacc1e3 Mon Sep 17 00:00:00 2001 From: Jake Coffman Date: Wed, 25 Oct 2023 15:00:36 -0500 Subject: [PATCH] fix flaky test --- internal/server/input_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/server/input_test.go b/internal/server/input_test.go index ac73f3a..c5981a3 100644 --- a/internal/server/input_test.go +++ b/internal/server/input_test.go @@ -5,6 +5,7 @@ import ( "net/http" "sync" "testing" + "time" "github.com/dependabot/cli/internal/model" ) @@ -17,6 +18,8 @@ func TestInput(t *testing.T) { input, _ = Input(8080) wg.Done() }() + // give the server time to start + time.Sleep(10 * time.Millisecond) data := `{"job":{"package-manager":"test"},"credentials":[{"credential":"value"}]}` resp, err := http.Post("http://localhost:8080", "application/json", bytes.NewReader([]byte(data)))