chia7712 commented on code in PR #905:
URL: https://github.com/apache/yunikorn-core/pull/905#discussion_r1678723246
##########
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:
@manirajv06 this string can't be matched by `GroupRegExp`
https://github.com/apache/yunikorn-core/blob/6c8fd60b82fd0c1973a1c1aa9717fb6bf4440c30/pkg/common/configs/configvalidator.go#L79
not sure whether we should revise the RegExp or this test string is invalid
--
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]