mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #86713 from liggitt/fix-gce-unit-test
Fix unit test to run in non-gce environments
This commit is contained in:
commit
f7e9a7c194
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
|
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
|
||||||
compute "google.golang.org/api/compute/v1"
|
compute "google.golang.org/api/compute/v1"
|
||||||
|
option "google.golang.org/api/option"
|
||||||
"k8s.io/client-go/tools/cache"
|
"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.
|
// NewFakeGCECloud constructs a fake GCE Cloud from the cluster values.
|
||||||
func NewFakeGCECloud(vals TestClusterValues) *Cloud {
|
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{
|
gce := &Cloud{
|
||||||
region: vals.Region,
|
region: vals.Region,
|
||||||
service: service,
|
service: service,
|
||||||
|
Loading…
Reference in New Issue
Block a user