pbacsko commented on code in PR #897:
URL: https://github.com/apache/yunikorn-core/pull/897#discussion_r1689993330


##########
pkg/webservice/handlers_test.go:
##########
@@ -1690,6 +1694,28 @@ func TestGetApplicationHandler(t *testing.T) {
        assert.Equal(t, http.StatusBadRequest, resp.statusCode, statusCodeError)
        assert.Equal(t, errInfo.Message, "invalid URL escape \"%Zt\"", 
jsonMessageError)
        assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest)
+
+       // test additional application details
+       var req6 *http.Request
+       req6, err = http.NewRequest("GET", 
"/ws/v1/partition/default/queue/root.default/application/app-1", 
strings.NewReader(""))
+       assert.NilError(t, err, "HTTP request create failed")
+       req6 = req6.WithContext(context.WithValue(req.Context(), 
httprouter.ParamsKey, httprouter.Params{
+               httprouter.Param{Key: "partition", Value: 
partitionNameWithoutClusterID},
+               httprouter.Param{Key: "queue", Value: "root.default"},
+               httprouter.Param{Key: "application", Value: "app-1"},
+       }))
+       assert.NilError(t, err, "Get Application Handler request failed")
+       resp6 := &MockResponseWriter{}
+       var appDao *dao.ApplicationDAOInfo
+       getApplication(resp6, req6)
+       appSummary := app.GetApplicationSummary(partitionNameWithoutClusterID)
+       err = json.Unmarshal(resp6.outputBytes, &appDao)
+       assert.NilError(t, err, unmarshalError)
+       assert.Equal(t, "app-1", appDao.ApplicationID)
+       assert.Equal(t, app.StartTime().UnixMilli(), appDao.StartTime)
+       assert.Equal(t, appSummary.ResourceUsage.String(), 
appDao.ResourceUsage.String())
+       assert.Equal(t, appSummary.PreemptedResource.String(), 
appDao.PreemptedResource.String())
+       assert.Equal(t, appSummary.PlaceholderResource.String(), 
appDao.PlaceholderResource.String())

Review Comment:
   Use `resources.Equals()` to verify equality



-- 
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]

Reply via email to