From fe5628e28697f20a11c5b2255e81a2d81d83f56e Mon Sep 17 00:00:00 2001 From: Jake Coffman Date: Wed, 25 Oct 2023 15:33:54 -0500 Subject: [PATCH] fix flaky test (#185) --- 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)))