kaichiachen commented on code in PR #950:
URL: https://github.com/apache/yunikorn-k8shim/pull/950#discussion_r1950426345
##########
pkg/dispatcher/dispatch_test.go:
##########
@@ -283,7 +283,14 @@ func TestExceedAsyncDispatchLimit(t *testing.T) {
Stop()
// check error
if err := recover(); err != nil {
- assert.Assert(t, strings.Contains(err.(error).Error(),
"dispatcher exceeds async-dispatch limit"))
+ errStr, ok := err.(error)
+ if !ok {
+ t.Errorf("Expected error type from panic, got
%T", err)
+ return
+ }
+ if !strings.Contains(errStr.Error(), "dispatcher
exceeds async-dispatch limit") {
+ t.Errorf("Expected panic with 'dispatcher
exceeds async-dispatch limit', got: %v", errStr)
+ }
Review Comment:
Make sense, we should use assert for all possible errors
--
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]