diff --git a/pkg/kv/cosmosdb/main_test.go b/pkg/kv/cosmosdb/main_test.go index 00949657e79..15ba010ff94 100644 --- a/pkg/kv/cosmosdb/main_test.go +++ b/pkg/kv/cosmosdb/main_test.go @@ -26,11 +26,11 @@ var ( ) func TestCosmosDB(t *testing.T) { - kvtest.DriverTest(t, func(t testing.TB, ctx context.Context) kv.Store { - if runtime.GOOS == "darwin" { - t.Skipf("this test hangs for macOS users, and fails. skipping - see Issue#8476 for more details") - } + if runtime.GOOS == "darwin" { + t.Skipf("this test hangs for macOS users, and fails. skipping - see Issue#8476 for more details") + } + kvtest.DriverTest(t, func(t testing.TB, ctx context.Context) kv.Store { t.Helper() databaseClient, err := client.NewDatabase(testParams.Database) diff --git a/pkg/testutil/cosmosdb.go b/pkg/testutil/cosmosdb.go index e481932e50c..5e886f2d62d 100644 --- a/pkg/testutil/cosmosdb.go +++ b/pkg/testutil/cosmosdb.go @@ -13,7 +13,7 @@ import ( const ( CosmosDBLocalPort = "8081" - maxWait = 5 * time.Minute // Cosmosdb emulator takes time to start + maxWait = 7 * time.Minute // Cosmosdb emulator takes time to start ) var cosmosdbLocalURI string @@ -59,6 +59,13 @@ func GetCosmosDBInstance() (string, func(), error) { return "", nil, fmt.Errorf("joining urls: %w", err) } + client := http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec // ignore self-signed cert for local testing using the emulator + }, + Timeout: 5 * time.Second, + } + dockerPool.MaxWait = maxWait log.Printf("Waiting up to %v for emulator to start", dockerPool.MaxWait) // Note: this hangs for macOS users, and fails. See https://github.com/treeverse/lakeFS/issues/8476 @@ -66,9 +73,6 @@ func GetCosmosDBInstance() (string, func(), error) { // waiting for cosmosdb container to be ready by issuing an HTTP get request with // exponential backoff retry. The response is not really meaningful for that case // and so is ignored - client := http.Client{Transport: &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec // ignore self-signed cert for local testing using the emulator - }} resp, err := client.Get(p) if err != nil { return err