Skip to content

Commit f7e9a7c

Browse files
authored
Merge pull request kubernetes#86713 from liggitt/fix-gce-unit-test
Fix unit test to run in non-gce environments
2 parents a443014 + 80e3cc3 commit f7e9a7c

File tree

1 file changed

+5
-1
lines changed
  • staging/src/k8s.io/legacy-cloud-providers/gce

1 file changed

+5
-1
lines changed

staging/src/k8s.io/legacy-cloud-providers/gce/gce_fake.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
2525
compute "google.golang.org/api/compute/v1"
26+
option "google.golang.org/api/option"
2627
"k8s.io/client-go/tools/cache"
2728
)
2829

@@ -62,7 +63,10 @@ func fakeClusterID(clusterID string) ClusterID {
6263

6364
// NewFakeGCECloud constructs a fake GCE Cloud from the cluster values.
6465
func NewFakeGCECloud(vals TestClusterValues) *Cloud {
65-
service, _ := compute.NewService(context.Background())
66+
service, err := compute.NewService(context.Background(), option.WithoutAuthentication())
67+
if err != nil {
68+
panic(err)
69+
}
6670
gce := &Cloud{
6771
region: vals.Region,
6872
service: service,

0 commit comments

Comments
 (0)