Copilot commented on code in PR #3591:
URL: https://github.com/apache/dubbo-go/pull/3591#discussion_r3718683006


##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -204,4 +204,122 @@ func TestLoadBalance(t *testing.T) {
                assert.Equal(t, ivkArr[1].GetURL().String(), 
ivk.GetURL().String())
        })
 
+       t.Run("metrics i nil", func(t *testing.T) {
+               ctrl := gomock.NewController(t)
+               defer ctrl.Finish()
+
+               m := metrics.NewMockMetrics(ctrl)
+               metrics.LocalMetrics = m

Review Comment:
   `metrics.LocalMetrics` is a global and the new subtests assign to it but 
don’t restore the prior value. This can make tests order-dependent and fragile 
if additional tests are added later (or if any tests in-package are made 
parallel). Save the original value and restore it with `t.Cleanup(...)` in each 
subtest that mutates `metrics.LocalMetrics` (the same applies to the other 
newly added subtests in this hunk).



##########
graceful_shutdown/shutdown.go:
##########
@@ -134,6 +136,24 @@ func Done() <-chan struct{} {
        return shutdownDone
 }
 
+// ShutdownError returns the error channel for an internal signal-triggered
+// shutdown that could not complete before its timeout.
+func ShutdownError() <-chan error {
+       return shutdownSignalError
+}

Review Comment:
   The docstring says `ShutdownError` is only for shutdowns that time out, but 
`reportShutdownError(err)` is called for any `Shutdown(ctx)` error in the 
internal-signal handler (not strictly timeouts). Update the comment to reflect 
that it may carry any internal-signal-triggered shutdown error (including 
timeout/context errors and other shutdown failures), not only timeouts.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to