-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NEG mocks for alpha API and a new transactions test #955
Conversation
Added conversion functions from composite to compute for NetworkEndpoint and other resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems okay overall, a few comments
pkg/neg/readiness/poller_test.go
Outdated
"net" | ||
"strconv" | ||
"testing" | ||
|
||
"k8s.io/ingress-gce/pkg/composite" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this to the group below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
pkg/neg/syncers/transaction_test.go
Outdated
if err != nil { | ||
t.Errorf("For case %q,, endpointSets error == nil, but got %v", tc.desc, err) | ||
t.Errorf("For case %q, endpointSets error == nil, but got %v", tc.desc, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might make sense to update this error to something like
t.Errorf("desc: %q, syncNetworkEndpoints() = %v, want nil", tc.desc. err)
Same with below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the new log message is much clearer, fixed.
pkg/neg/types/mock.go
Outdated
@@ -192,21 +332,26 @@ func MockDetachNetworkEndpointsHook(ctx context.Context, key *meta.Key, obj *com | |||
return nil | |||
} | |||
|
|||
func isNetworkEndpointsEqual(left, right *compute.NetworkEndpoint) bool { | |||
func toComposite(input interface{}) *composite.NetworkEndpoint { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might make sense to just use the composite function directly and not eat the err here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: MrHohn, prameshj The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This enables creation of NEGs in unit tests using Alpha or GA api. The transactions test has been modified to create both VM_IP_PORT as well as PRIMARY_VM_IP negs.