From ceac82391f563ea7eb769b26f18df49f6197ff86 Mon Sep 17 00:00:00 2001 From: Manuel Alejandro de Brito Fontes Date: Sun, 8 May 2022 09:55:06 -0400 Subject: [PATCH] Use flags instead of docker auto-detection --- .../content-service/pkg/storage/gcloud_test.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/components/content-service/pkg/storage/gcloud_test.go b/components/content-service/pkg/storage/gcloud_test.go index a3a8af9b7cf585..90d9d8e81cba8d 100644 --- a/components/content-service/pkg/storage/gcloud_test.go +++ b/components/content-service/pkg/storage/gcloud_test.go @@ -9,6 +9,7 @@ import ( "context" "crypto/rand" "crypto/tls" + "flag" "io" "io/ioutil" "net/http" @@ -65,6 +66,8 @@ func TestObjectAccessToNonExistentObj(t *testing.T) { } } +var runWithDocker = flag.Bool("with-docker", false, "run fake-gcs-server in docker") + func TestObjectUpload(t *testing.T) { tests := []struct { Desc string @@ -90,7 +93,7 @@ func TestObjectUpload(t *testing.T) { // use docker to run the fake GCS server // or start an embed server otherwise - switch isDockerRunning() { + switch *runWithDocker { case true: var gcsContainer *fakeGCSContainer gcsContainer, err = setupFakeStorage(ctx) @@ -289,12 +292,3 @@ func setupFakeStorage(ctx context.Context) (*fakeGCSContainer, error) { URI: "https://localhost:4443/storage/v1/", }, nil } - -func isDockerRunning() bool { - p, err := testcontainers.NewDockerProvider() - if err != nil { - return false - } - - return p.Health(context.Background()) == nil -}