Add/improve unit tests for agentendpoint/agentendpoint.go#930
Add/improve unit tests for agentendpoint/agentendpoint.go#930ganochenkodg wants to merge 12 commits intoGoogleCloudPlatform:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ganochenkodg The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @ganochenkodg. Thanks for your PR. I'm waiting for a GoogleCloudPlatform 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. DetailsInstructions 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. |
|
This is draft PR with unit tests for ./agentendpoint/ package. |
|
/gcbrun |
21729d8 to
b3709a7
Compare
|
/gcbrun |
|
/gcbrun |
| @@ -1,4 +1,4 @@ | |||
| // Copyright 2019 Google Inc. All Rights Reserved. | |||
| // Copyright 2026 Google Inc. All Rights Reserved. | |||
There was a problem hiding this comment.
Do not change the copyright year here. It should represent when a file was first published.
There was a problem hiding this comment.
Ah ok, understand, returned 2019
| if tc.client.closed { | ||
| return | ||
| } | ||
| time.Sleep(20 * time.Millisecond) |
There was a problem hiding this comment.
Using sleep in unit tests is not recommended. Can you change it to a timeout with pooling?
There was a problem hiding this comment.
Replaced all sleeps here, check it now please
With this PR better test coverage for ./agentendpoint/agentendpoint.go was reached:
github.com/GoogleCloudPlatform/osconfig/agentendpoint/agentendpoint.go:97: Close 80.0% -> 100.0%
github.com/GoogleCloudPlatform/osconfig/agentendpoint/agentendpoint.go:108: Closed 0.0% -> 100.0%
github.com/GoogleCloudPlatform/osconfig/agentendpoint/agentendpoint.go:113: RegisterAgent 0.0% -> 77.8%
github.com/GoogleCloudPlatform/osconfig/agentendpoint/agentendpoint.go:348: waitForTask 72.7% -> 100.0%
github.com/GoogleCloudPlatform/osconfig/agentendpoint/agentendpoint.go:373: WaitForTaskNotification 0.0% -> 82.9%