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
a96c5f28
Commit
a96c5f28
authored
May 25, 2018
by
Ashley Gau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mocks must return true in order to trigger err
parent
06906236
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
mock.go
pkg/cloudprovider/providers/gce/cloud/mock/mock.go
+8
-8
No files found.
pkg/cloudprovider/providers/gce/cloud/mock/mock.go
View file @
a96c5f28
...
...
@@ -94,7 +94,7 @@ func RemoveInstanceHook(ctx context.Context, key *meta.Key, req *ga.TargetPoolsR
func
convertAndInsertAlphaForwardingRule
(
key
*
meta
.
Key
,
obj
gceObject
,
mRules
map
[
meta
.
Key
]
*
cloud
.
MockForwardingRulesObj
,
version
meta
.
Version
,
projectID
string
)
(
bool
,
error
)
{
if
!
key
.
Valid
()
{
return
fals
e
,
fmt
.
Errorf
(
"invalid GCE key (%+v)"
,
key
)
return
tru
e
,
fmt
.
Errorf
(
"invalid GCE key (%+v)"
,
key
)
}
if
_
,
ok
:=
mRules
[
*
key
];
ok
{
...
...
@@ -102,16 +102,16 @@ func convertAndInsertAlphaForwardingRule(key *meta.Key, obj gceObject, mRules ma
Code
:
http
.
StatusConflict
,
Message
:
fmt
.
Sprintf
(
"MockForwardingRule %v exists"
,
key
),
}
return
fals
e
,
err
return
tru
e
,
err
}
enc
,
err
:=
obj
.
MarshalJSON
()
if
err
!=
nil
{
return
fals
e
,
err
return
tru
e
,
err
}
var
fwdRule
alpha
.
ForwardingRule
if
err
:=
json
.
Unmarshal
(
enc
,
&
fwdRule
);
err
!=
nil
{
return
fals
e
,
err
return
tru
e
,
err
}
// Set the default values for the Alpha fields.
if
fwdRule
.
NetworkTier
==
""
{
...
...
@@ -162,7 +162,7 @@ type AddressAttributes struct {
func
convertAndInsertAlphaAddress
(
key
*
meta
.
Key
,
obj
gceObject
,
mAddrs
map
[
meta
.
Key
]
*
cloud
.
MockAddressesObj
,
version
meta
.
Version
,
projectID
string
,
addressAttrs
AddressAttributes
)
(
bool
,
error
)
{
if
!
key
.
Valid
()
{
return
fals
e
,
fmt
.
Errorf
(
"invalid GCE key (%+v)"
,
key
)
return
tru
e
,
fmt
.
Errorf
(
"invalid GCE key (%+v)"
,
key
)
}
if
_
,
ok
:=
mAddrs
[
*
key
];
ok
{
...
...
@@ -170,16 +170,16 @@ func convertAndInsertAlphaAddress(key *meta.Key, obj gceObject, mAddrs map[meta.
Code
:
http
.
StatusConflict
,
Message
:
fmt
.
Sprintf
(
"MockAddresses %v exists"
,
key
),
}
return
fals
e
,
err
return
tru
e
,
err
}
enc
,
err
:=
obj
.
MarshalJSON
()
if
err
!=
nil
{
return
fals
e
,
err
return
tru
e
,
err
}
var
addr
alpha
.
Address
if
err
:=
json
.
Unmarshal
(
enc
,
&
addr
);
err
!=
nil
{
return
fals
e
,
err
return
tru
e
,
err
}
// Set default address type if not present.
...
...
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