Skip to content

Commit

Permalink
Use flags instead of docker auto-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed May 10, 2022
1 parent f2b884f commit ceac823
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions components/content-service/pkg/storage/gcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"context"
"crypto/rand"
"crypto/tls"
"flag"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
}

0 comments on commit ceac823

Please sign in to comment.