Commit 0d17e963 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5468] Return status code indicating empty set for lease4-get-all.

parent 4a538fe8
......@@ -516,8 +516,8 @@ LeaseCmdsImpl::lease4GetAllHandler(CalloutHandle& handle) {
s << leases_json->size() << " IPv4 lease(s) found.";
ElementPtr args = Element::createMap();
args->set("leases", leases_json);
ConstElementPtr response = createAnswer(CONTROL_RESULT_SUCCESS,
s.str(), args);
ConstElementPtr response = createAnswer((leases_json->size() == 0 ? CONTROL_RESULT_EMPTY :
CONTROL_RESULT_SUCCESS), s.str(), args);
setResponse(handle, response);
......
......@@ -1170,7 +1170,7 @@ TEST_F(LeaseCmdsTest, Lease4GetAllNoLeases) {
" \"command\": \"lease4-get-all\"\n"
"}";
string exp_rsp = "0 IPv4 lease(s) found.";
ConstElementPtr rsp = testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
ConstElementPtr rsp = testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
// Now check that the lease parameters were indeed returned.
ASSERT_TRUE(rsp);
......@@ -1237,7 +1237,7 @@ TEST_F(LeaseCmdsTest, Lease4GetAllBySubnetIdNoLeases) {
" }\n"
"}";
string exp_rsp = "0 IPv4 lease(s) found.";
ConstElementPtr rsp = testCommand(cmd, CONTROL_RESULT_SUCCESS, exp_rsp);
ConstElementPtr rsp = testCommand(cmd, CONTROL_RESULT_EMPTY, exp_rsp);
// Now check that the lease parameters were indeed returned.
ASSERT_TRUE(rsp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment