-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: report cloudRunReadyEvent for Cloud Run worker pools
#9921
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,15 @@ func CloudRunServiceReady(r, url, revision string) { | |
| }) | ||
| } | ||
|
|
||
| func CloudRunWorkerPoolReady(r, revision string) { | ||
| handler.handleCloudRunReady(&proto.CloudRunReadyEvent{ | ||
| Id: r, | ||
| TaskId: fmt.Sprintf("%s-%d", constants.Deploy, handler.iteration), | ||
| Resource: r, | ||
| ReadyRevision: revision, | ||
| }) | ||
| } | ||
|
Comment on lines
+36
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function's implementation is very similar to To remove the duplication, you could reuse func CloudRunWorkerPoolReady(r, revision string) {
CloudRunServiceReady(r, "", revision)
} |
||
|
|
||
| func (ev *eventHandler) handleCloudRunReady(e *proto.CloudRunReadyEvent) { | ||
| ev.handle(&proto.Event{ | ||
| EventType: &proto.Event_CloudRunReadyEvent{ | ||
|
|
||
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.
This change adds new behavior but lacks corresponding tests. The existing test suite, specifically
TestPrintSummaryStatusinstatus_test.go, does not correctly test this code path for worker pools because it uses arunServiceResourcemock instead of arunWorkerPoolResource.Please add a unit test that:
runWorkerPoolResourcefor the test case.eventV2.CloudRunWorkerPoolReadyis called with the correct parameters whenreportSuccessis invoked.Without tests, we can't be sure this feature works as expected or protect it from future regressions.
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 add a unit test as mentioned by the bot?
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.
I haven't added tests because there aren't any existing tests for sending the CloudRunServiceReady event, and this is a relatively simple change.
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.
Aren't these service events tested here? https://github.com/GoogleContainerTools/skaffold/blob/3b3a801033e4aae90aa4805cb1efdc216e3971f9/pkg/skaffold/deploy/cloudrun/status_test.go
Even if there aren't tests, tests should be added to guard against future regression, if anything. Having tests is helpful for any type of future development, either for refactoring or adding new functionality.