mitigate race against server readiness in test

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
mpl 2022-12-15 11:18:05 +01:00 committed by GitHub
parent da93dab828
commit 74ef79ea23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import (
"crypto/tls" "crypto/tls"
"net/http" "net/http"
"testing" "testing"
"time"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -113,6 +114,9 @@ func TestHTTP3AdvertisedPort(t *testing.T) {
}) })
require.NoError(t, err) require.NoError(t, err)
// We are racing with the http3Server readiness happening in the goroutine starting the entrypoint
time.Sleep(time.Second)
request, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:8090", nil) request, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:8090", nil)
require.NoError(t, err) require.NoError(t, err)