manirajv06 commented on code in PR #905:
URL: https://github.com/apache/yunikorn-core/pull/905#discussion_r1678769324
##########
pkg/webservice/handlers_test.go:
##########
@@ -1976,22 +1999,43 @@ func TestSpecificUserAndGroupResourceUsage(t
*testing.T) {
})
// Test non-existing group query
- req, err = http.NewRequest("GET",
"/ws/v1/partition/default/usage/group/", strings.NewReader(""))
- assert.NilError(t, err, "Get Group Resource Usage Handler request
failed")
- req = req.WithContext(context.WithValue(req.Context(),
httprouter.ParamsKey, httprouter.Params{
- httprouter.Param{Key: "user", Value: "testuser"},
- httprouter.Param{Key: "group", Value: "testNonExistingGroup"},
- }))
+ req, err = createRequest(t, "/ws/v1/partition/default/usage/group",
map[string]string{"user": "testuser", "group": "testNonExistingGroup"})
+ assert.NilError(t, err)
resp = &MockResponseWriter{}
getGroupResourceUsage(resp, req)
assertGroupNotExists(t, resp)
// Test params name missing
req, err = http.NewRequest("GET",
"/ws/v1/partition/default/usage/group/", strings.NewReader(""))
- assert.NilError(t, err, "Get Group Resource Usage Handler request
failed")
+ assert.NilError(t, err)
resp = &MockResponseWriter{}
getGroupResourceUsage(resp, req)
assertParamsMissing(t, resp)
+
+ // Test group name with special characters escaped properly
+ validGroup := url.QueryEscape("test_a-b_c@#d@do:mai/n.com")
Review Comment:
@chia7712 Yes, you are right.
https://issues.apache.org/jira/browse/YUNIKORN-2719 has been filed for the same
reason. Same applies for user name too. In this test case, it simply moves on
with "group not exists" error message.
--
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]