pbacsko commented on code in PR #970:
URL: https://github.com/apache/yunikorn-core/pull/970#discussion_r1763000978
##########
pkg/webservice/handlers_test.go:
##########
@@ -1358,17 +1364,42 @@ func TestGetPartitionNodes(t *testing.T) {
assertParamsMissing(t, resp)
// Test specific node
- req, err = createRequest(t, "/ws/v1/partition/default/node/node-1",
map[string]string{"node": "node-1"})
+ req, err = createRequest(t, "/ws/v1/partition/default/node/node-1",
map[string]string{"partition": "default", "node": "node-1"})
assert.NilError(t, err, "Get Node for PartitionNode Handler request
failed")
resp = &MockResponseWriter{}
getPartitionNode(resp, req)
+ var nodeInfo dao.NodeDAOInfo
+ err = json.Unmarshal(resp.outputBytes, &nodeInfo)
+ assert.NilError(t, err, unmarshalError)
+ assertNodeInfo(t, &nodeInfo, node1ID, "alloc-1", attributesOfnode1,
map[string]int64{"memory": 50, "vcore": 30})
// Test node id is missing
req, err = createRequest(t, "/ws/v1/partition/default/node/node-1",
map[string]string{"partition": "default", "node": ""})
assert.NilError(t, err, "Get Node for PartitionNode Handler request
failed")
resp = &MockResponseWriter{}
getPartitionNode(resp, req)
assertNodeIDNotExists(t, resp)
+
+ // Test param missing
+ req, err = http.NewRequest("GET", "/ws/v1/partition/default/node",
strings.NewReader(""))
+ assert.NilError(t, err, "Get Node for PartitionNode Handler request
failed")
+ resp = &MockResponseWriter{}
+ getPartitionNode(resp, req)
+ assertParamsMissing(t, resp)
+
+ // Test partition not exist
Review Comment:
nit: "does not exist"
--
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]