manirajv06 commented on code in PR #970:
URL: https://github.com/apache/yunikorn-core/pull/970#discussion_r1764420174
##########
pkg/webservice/handlers_test.go:
##########
@@ -318,6 +318,18 @@ func newApplication(appID, partitionName, queueName, rmID
string, ugi security.U
return objects.NewApplication(siApp, userGroup, nil, rmID)
}
+func TestGetStackInfo(t *testing.T) {
+ req, err := http.NewRequest("GET", "", strings.NewReader(baseConf))
+ assert.NilError(t, err, "Error creating request")
+ resp := &MockResponseWriter{}
+ getStackInfo(resp, req)
+
+ // assert stack trace
+ assert.Assert(t, strings.Contains(string(resp.outputBytes),
"goroutine"), "Stack trace should be present in the response")
+ assert.Assert(t, strings.Contains(string(resp.outputBytes), "test"),
"Stack trace should be present in the response")
+ assert.Assert(t, strings.Contains(string(resp.outputBytes),
"github.com/apache/yunikorn-core/pkg/webservice.getStackInfo"), "Stack trace
should be present in the response")
+}
Review Comment:
StatusInternalServerError is returned only when go built in write() method
fails. Yes, not required to cover the case. Just to be safer, we can assert
status code against valid response code (200).
--
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]