richscott commented on code in PR #897:
URL: https://github.com/apache/yunikorn-core/pull/897#discussion_r1690496154
##########
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:
@pbacsko (background: I am collaborating with @suprjinx on this PR.) I just
added the `//nolint:funlen` as you requested. I attempted to use
`resources.Equals()` on those 3 checks for `ResourceUsage`,
`PreemptedResource`, and `PlaceholderResource`, however `resources.Equals()`
takes two `*resource.Resource` arguments, and these 3 items are actually
`*resources.TrackedResource`, which the compiler won't allow. I wasn't able to
implement an analogous `Equals(a, b *TrackedResource)` func, since the
`resources` package already has `Equals(a, b *Resource)` and both `Resource`
and `TrackedResource` are in the same `resources` package. So, should I make a
`EqualsTrackedResource()` func, and rename the first to `EqualsResource()`, or
just stay with the current test logic of `String()` comparison? Thanks.
--
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]