Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2410b657
Commit
2410b657
authored
Feb 16, 2018
by
Nick Sardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass ProjectRouter to mocks
parent
26032711
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
39 deletions
+70
-39
gen.go
pkg/cloudprovider/providers/gce/cloud/gen.go
+0
-0
main.go
pkg/cloudprovider/providers/gce/cloud/gen/main.go
+11
-7
gen_test.go
pkg/cloudprovider/providers/gce/cloud/gen_test.go
+48
-24
mock_test.go
pkg/cloudprovider/providers/gce/cloud/mock_test.go
+2
-1
gce_loadbalancer_external_test.go
...dprovider/providers/gce/gce_loadbalancer_external_test.go
+9
-7
No files found.
pkg/cloudprovider/providers/gce/cloud/gen.go
View file @
2410b657
This diff is collapsed.
Click to expand it.
pkg/cloudprovider/providers/gce/cloud/gen/main.go
View file @
2410b657
...
@@ -175,14 +175,14 @@ func (gce *GCE) {{.WrapType}}() {{.WrapType}} {
...
@@ -175,14 +175,14 @@ func (gce *GCE) {{.WrapType}}() {{.WrapType}} {
{{- end}}
{{- end}}
// NewMockGCE returns a new mock for GCE.
// NewMockGCE returns a new mock for GCE.
func NewMockGCE() *MockGCE {
func NewMockGCE(
projectRouter ProjectRouter
) *MockGCE {
{{- range .Groups}}
{{- range .Groups}}
mock{{.Service}}Objs := map[meta.Key]*Mock{{.Service}}Obj{}
mock{{.Service}}Objs := map[meta.Key]*Mock{{.Service}}Obj{}
{{- end}}
{{- end}}
mock := &MockGCE{
mock := &MockGCE{
{{- range .All}}
{{- range .All}}
{{.MockField}}: New{{.MockWrapType}}(mock{{.Service}}Objs),
{{.MockField}}: New{{.MockWrapType}}(
projectRouter,
mock{{.Service}}Objs),
{{- end}}
{{- end}}
}
}
return mock
return mock
...
@@ -306,8 +306,10 @@ type {{.WrapType}} interface {
...
@@ -306,8 +306,10 @@ type {{.WrapType}} interface {
}
}
// New{{.MockWrapType}} returns a new mock for {{.Service}}.
// New{{.MockWrapType}} returns a new mock for {{.Service}}.
func New{{.MockWrapType}}(objs map[meta.Key]*Mock{{.Service}}Obj) *{{.MockWrapType}} {
func New{{.MockWrapType}}(
pr ProjectRouter,
objs map[meta.Key]*Mock{{.Service}}Obj) *{{.MockWrapType}} {
mock := &{{.MockWrapType}}{
mock := &{{.MockWrapType}}{
ProjectRouter: pr,
Objects: objs,
Objects: objs,
{{- if .GenerateGet}}
{{- if .GenerateGet}}
GetError: map[meta.Key]error{},
GetError: map[meta.Key]error{},
...
@@ -326,6 +328,8 @@ func New{{.MockWrapType}}(objs map[meta.Key]*Mock{{.Service}}Obj) *{{.MockWrapTy
...
@@ -326,6 +328,8 @@ func New{{.MockWrapType}}(objs map[meta.Key]*Mock{{.Service}}Obj) *{{.MockWrapTy
type {{.MockWrapType}} struct {
type {{.MockWrapType}} struct {
Lock sync.Mutex
Lock sync.Mutex
ProjectRouter ProjectRouter
// Objects maintained by the mock.
// Objects maintained by the mock.
Objects map[meta.Key]*Mock{{.Service}}Obj
Objects map[meta.Key]*Mock{{.Service}}Obj
...
@@ -534,9 +538,8 @@ func (m *{{.MockWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.F
...
@@ -534,9 +538,8 @@ func (m *{{.MockWrapType}}) Insert(ctx context.Context, key *meta.Key, obj *{{.F
}
}
obj.Name = key.Name
obj.Name = key.Name
if obj.SelfLink == "" {
projectID := m.ProjectRouter.ProjectID(ctx, "{{.Version}}", "{{.Resource}}")
obj.SelfLink = SelfLink(meta.Version{{.VersionTitle}}, "mock-project", "{{.Resource}}", key)
obj.SelfLink = SelfLink(meta.Version{{.VersionTitle}}, projectID, "{{.Resource}}", key)
}
m.Objects[*key] = &Mock{{.Service}}Obj{obj}
m.Objects[*key] = &Mock{{.Service}}Obj{obj}
glog.V(5).Infof("{{.MockWrapType}}.Insert(%v, %v, %+v) = nil", ctx, key, obj)
glog.V(5).Infof("{{.MockWrapType}}.Insert(%v, %v, %+v) = nil", ctx, key, obj)
...
@@ -1036,7 +1039,8 @@ func Test{{.Service}}Group(t *testing.T) {
...
@@ -1036,7 +1039,8 @@ func Test{{.Service}}Group(t *testing.T) {
t.Parallel()
t.Parallel()
ctx := context.Background()
ctx := context.Background()
mock := NewMockGCE()
pr := &SingleProjectRouter{"mock-project"}
mock := NewMockGCE(pr)
var key *meta.Key
var key *meta.Key
{{- if .HasAlpha}}
{{- if .HasAlpha}}
...
...
pkg/cloudprovider/providers/gce/cloud/gen_test.go
View file @
2410b657
...
@@ -38,7 +38,8 @@ func TestAddressesGroup(t *testing.T) {
...
@@ -38,7 +38,8 @@ func TestAddressesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
...
@@ -172,7 +173,8 @@ func TestBackendServicesGroup(t *testing.T) {
...
@@ -172,7 +173,8 @@ func TestBackendServicesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
GlobalKey
(
"key-alpha"
)
keyAlpha
:=
meta
.
GlobalKey
(
"key-alpha"
)
...
@@ -270,7 +272,8 @@ func TestDisksGroup(t *testing.T) {
...
@@ -270,7 +272,8 @@ func TestDisksGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
...
@@ -368,7 +371,8 @@ func TestFirewallsGroup(t *testing.T) {
...
@@ -368,7 +371,8 @@ func TestFirewallsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -430,7 +434,8 @@ func TestForwardingRulesGroup(t *testing.T) {
...
@@ -430,7 +434,8 @@ func TestForwardingRulesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
...
@@ -528,7 +533,8 @@ func TestGlobalAddressesGroup(t *testing.T) {
...
@@ -528,7 +533,8 @@ func TestGlobalAddressesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -590,7 +596,8 @@ func TestGlobalForwardingRulesGroup(t *testing.T) {
...
@@ -590,7 +596,8 @@ func TestGlobalForwardingRulesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -652,7 +659,8 @@ func TestHealthChecksGroup(t *testing.T) {
...
@@ -652,7 +659,8 @@ func TestHealthChecksGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
GlobalKey
(
"key-alpha"
)
keyAlpha
:=
meta
.
GlobalKey
(
"key-alpha"
)
...
@@ -750,7 +758,8 @@ func TestHttpHealthChecksGroup(t *testing.T) {
...
@@ -750,7 +758,8 @@ func TestHttpHealthChecksGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -812,7 +821,8 @@ func TestHttpsHealthChecksGroup(t *testing.T) {
...
@@ -812,7 +821,8 @@ func TestHttpsHealthChecksGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -874,7 +884,8 @@ func TestInstanceGroupsGroup(t *testing.T) {
...
@@ -874,7 +884,8 @@ func TestInstanceGroupsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
ZonalKey
(
"key-ga"
,
"location"
)
keyGA
:=
meta
.
ZonalKey
(
"key-ga"
,
"location"
)
...
@@ -936,7 +947,8 @@ func TestInstancesGroup(t *testing.T) {
...
@@ -936,7 +947,8 @@ func TestInstancesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
...
@@ -1070,7 +1082,8 @@ func TestNetworkEndpointGroupsGroup(t *testing.T) {
...
@@ -1070,7 +1082,8 @@ func TestNetworkEndpointGroupsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
ZonalKey
(
"key-alpha"
,
"location"
)
...
@@ -1132,7 +1145,8 @@ func TestProjectsGroup(t *testing.T) {
...
@@ -1132,7 +1145,8 @@ func TestProjectsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1162,7 +1176,8 @@ func TestRegionBackendServicesGroup(t *testing.T) {
...
@@ -1162,7 +1176,8 @@ func TestRegionBackendServicesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
...
@@ -1260,7 +1275,8 @@ func TestRegionDisksGroup(t *testing.T) {
...
@@ -1260,7 +1275,8 @@ func TestRegionDisksGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
"location"
)
...
@@ -1322,7 +1338,8 @@ func TestRegionsGroup(t *testing.T) {
...
@@ -1322,7 +1338,8 @@ func TestRegionsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1369,7 +1386,8 @@ func TestRoutesGroup(t *testing.T) {
...
@@ -1369,7 +1386,8 @@ func TestRoutesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1431,7 +1449,8 @@ func TestSslCertificatesGroup(t *testing.T) {
...
@@ -1431,7 +1449,8 @@ func TestSslCertificatesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1493,7 +1512,8 @@ func TestTargetHttpProxiesGroup(t *testing.T) {
...
@@ -1493,7 +1512,8 @@ func TestTargetHttpProxiesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1555,7 +1575,8 @@ func TestTargetHttpsProxiesGroup(t *testing.T) {
...
@@ -1555,7 +1575,8 @@ func TestTargetHttpsProxiesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1617,7 +1638,8 @@ func TestTargetPoolsGroup(t *testing.T) {
...
@@ -1617,7 +1638,8 @@ func TestTargetPoolsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
RegionalKey
(
"key-ga"
,
"location"
)
keyGA
:=
meta
.
RegionalKey
(
"key-ga"
,
"location"
)
...
@@ -1679,7 +1701,8 @@ func TestUrlMapsGroup(t *testing.T) {
...
@@ -1679,7 +1701,8 @@ func TestUrlMapsGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
@@ -1741,7 +1764,8 @@ func TestZonesGroup(t *testing.T) {
...
@@ -1741,7 +1764,8 @@ func TestZonesGroup(t *testing.T) {
t
.
Parallel
()
t
.
Parallel
()
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
var
key
*
meta
.
Key
var
key
*
meta
.
Key
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
keyGA
:=
meta
.
GlobalKey
(
"key-ga"
)
...
...
pkg/cloudprovider/providers/gce/cloud/mock_test.go
View file @
2410b657
...
@@ -37,7 +37,8 @@ func TestMocks(t *testing.T) {
...
@@ -37,7 +37,8 @@ func TestMocks(t *testing.T) {
const
region
=
"us-central1"
const
region
=
"us-central1"
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
mock
:=
NewMockGCE
()
pr
:=
&
SingleProjectRouter
{
"mock-project"
}
mock
:=
NewMockGCE
(
pr
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
region
)
keyAlpha
:=
meta
.
RegionalKey
(
"key-alpha"
,
region
)
keyBeta
:=
meta
.
RegionalKey
(
"key-beta"
,
region
)
keyBeta
:=
meta
.
RegionalKey
(
"key-beta"
,
region
)
...
...
pkg/cloudprovider/providers/gce/gce_loadbalancer_external_test.go
View file @
2410b657
...
@@ -281,23 +281,25 @@ func fakeGCECloud() (*GCECloud, error) {
...
@@ -281,23 +281,25 @@ func fakeGCECloud() (*GCECloud, error) {
return
nil
,
err
return
nil
,
err
}
}
cloud
:=
cloud
.
NewMockGCE
()
gce
:=
&
GCECloud
{
cloud
.
MockTargetPools
.
AddInstanceHook
=
mock
.
AddInstanceHook
cloud
.
MockTargetPools
.
RemoveInstanceHook
=
mock
.
RemoveInstanceHook
gce
:=
GCECloud
{
region
:
gceRegion
,
region
:
gceRegion
,
service
:
service
,
service
:
service
,
manager
:
fakeManager
,
manager
:
fakeManager
,
managedZones
:
[]
string
{
zoneName
},
managedZones
:
[]
string
{
zoneName
},
projectID
:
gceProjectId
,
projectID
:
gceProjectId
,
networkProjectID
:
gceProjectId
,
AlphaFeatureGate
:
alphaFeatureGate
,
AlphaFeatureGate
:
alphaFeatureGate
,
nodeZones
:
zonesWithNodes
,
nodeZones
:
zonesWithNodes
,
nodeInformerSynced
:
func
()
bool
{
return
true
},
nodeInformerSynced
:
func
()
bool
{
return
true
},
c
:
cloud
,
}
}
return
&
gce
,
nil
cloud
:=
cloud
.
NewMockGCE
(
&
gceProjectRouter
{
gce
})
cloud
.
MockTargetPools
.
AddInstanceHook
=
mock
.
AddInstanceHook
cloud
.
MockTargetPools
.
RemoveInstanceHook
=
mock
.
RemoveInstanceHook
gce
.
c
=
cloud
return
gce
,
nil
}
}
func
createAndInsertNodes
(
gce
*
GCECloud
,
nodeNames
[]
string
)
([]
*
v1
.
Node
,
error
)
{
func
createAndInsertNodes
(
gce
*
GCECloud
,
nodeNames
[]
string
)
([]
*
v1
.
Node
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment