-
Notifications
You must be signed in to change notification settings - Fork 301
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 unit tests to validate error states are detected #2028
Add unit tests to validate error states are detected #2028
Conversation
Hi @sawsa307. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @swetharepakula |
462d8ff
to
f0e6048
Compare
/assign @bowei |
f0e6048
to
a480de6
Compare
a480de6
to
c450b4a
Compare
cefd23f
to
f80f542
Compare
f80f542
to
37893ab
Compare
6e41cb7
to
e315e8a
Compare
/unhold |
pkg/neg/syncers/transaction_test.go
Outdated
_, transactionSyncer := newTestTransactionSyncer(fakeCloud, negtypes.VmIpPortEndpointType, false) | ||
|
||
err := transactionSyncer.cloud.AttachNetworkEndpoints(transactionSyncer.NegSyncerKey.NegName, zone, networkEndpoints, transactionSyncer.NegSyncerKey.GetAPIVersion()) | ||
err = checkEndpointBatchErr(err, tc.endpointOperation) |
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 we not directly pass in the return error here?
Why do we need the transaction syncer and the mock attachnetwork endpoint hook?
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.
Make sense. Updated.
pkg/neg/syncers/utils_test.go
Outdated
expectErr: nil, | ||
}, | ||
{ | ||
desc: "include one endpoint that does correspond to an existing node", |
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.
nit: does not correspond
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.
Updated. Thanks!
pkg/neg/syncers/utils_test.go
Outdated
}, | ||
expectSets: nil, | ||
expectMap: nil, | ||
expectErr: negtypes.ErrEPZoneMissing, |
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.
shouldn't this be ErrEPNodeNotFound ?
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.
Makes sense. Updated.
We get zone information from zoneGetter, which basically list all the nodes, look for the matching one, and extract its zone information.
e315e8a
to
343c505
Compare
343c505
to
dbf7247
Compare
/ok-to-test |
pkg/neg/syncers/transaction.go
Outdated
s.syncLock.Lock() | ||
s.logger.V(3).Info("Updating error state", "error state", syncErr.Reason) |
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.
nit: should you remove the V(3)
here too?
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.
Updated. Thanks!
dbf7247
to
1a0fc46
Compare
984c67b
to
b26795f
Compare
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.
Some small nits, otherwise LGTM
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.
Some small nits, otherwise LGTM
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: sawsa307, swetharepakula 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 |
Add TestParseEndpointBatchErr to verify invalid endpoint batch error state. Add TestValidateEndpointFields to verify invalid endpoint information error state.