Skip to content

Add/improve unit tests for agentendpoint/agentendpoint.go#930

Open
ganochenkodg wants to merge 12 commits intoGoogleCloudPlatform:masterfrom
ganochenkodg:agentendpoint-unittests
Open

Add/improve unit tests for agentendpoint/agentendpoint.go#930
ganochenkodg wants to merge 12 commits intoGoogleCloudPlatform:masterfrom
ganochenkodg:agentendpoint-unittests

Conversation

@ganochenkodg
Copy link
Copy Markdown
Contributor

@ganochenkodg ganochenkodg commented Mar 17, 2026

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%

@ganochenkodg ganochenkodg marked this pull request as draft March 17, 2026 17:48
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ganochenkodg
Once this PR has been reviewed and has the lgtm label, please assign burov for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link
Copy Markdown

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@ganochenkodg
Copy link
Copy Markdown
Contributor Author

This is draft PR with unit tests for ./agentendpoint/ package.

@google-oss-prow google-oss-prow Bot added size/M and removed size/L labels Mar 17, 2026
@burov
Copy link
Copy Markdown
Member

burov commented Mar 17, 2026

/gcbrun

@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Mar 18, 2026
@ganochenkodg ganochenkodg force-pushed the agentendpoint-unittests branch from 21729d8 to b3709a7 Compare March 18, 2026 15:01
@ganochenkodg ganochenkodg changed the title Add/improve unit tests for agentendpoint Add/improve unit tests for agentendpoint/agentendpoint.go Mar 19, 2026
@ganochenkodg ganochenkodg marked this pull request as ready for review March 27, 2026 01:45
@google-oss-prow google-oss-prow Bot requested a review from savija-tv March 27, 2026 01:46
@burov
Copy link
Copy Markdown
Member

burov commented Mar 29, 2026

/gcbrun

@burov
Copy link
Copy Markdown
Member

burov commented Apr 14, 2026

/gcbrun

@@ -1,4 +1,4 @@
// Copyright 2019 Google Inc. All Rights Reserved.
// Copyright 2026 Google Inc. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not change the copyright year here. It should represent when a file was first published.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, understand, returned 2019

Comment thread agentendpoint/agentendpoint_test.go Outdated
if tc.client.closed {
return
}
time.Sleep(20 * time.Millisecond)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using sleep in unit tests is not recommended. Can you change it to a timeout with pooling?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced all sleeps here, check it now please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants