From 80e3cc36294358724c000de85b1e594ad02d3a93 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Sun, 29 Dec 2019 22:28:41 -0500 Subject: [PATCH] Fix unit test to run in non-gce environments --- staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go index 07c42477f9e..09a516c6550 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go +++ b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go @@ -23,6 +23,7 @@ import ( "github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud" compute "google.golang.org/api/compute/v1" + option "google.golang.org/api/option" "k8s.io/client-go/tools/cache" ) @@ -62,7 +63,10 @@ func fakeClusterID(clusterID string) ClusterID { // NewFakeGCECloud constructs a fake GCE Cloud from the cluster values. func NewFakeGCECloud(vals TestClusterValues) *Cloud { - service, _ := compute.NewService(context.Background()) + service, err := compute.NewService(context.Background(), option.WithoutAuthentication()) + if err != nil { + panic(err) + } gce := &Cloud{ region: vals.Region, service: service,