Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
c362eac0
Commit
c362eac0
authored
Feb 27, 2017
by
Marcin Siodelski
Browse files
[5107] Modified agent's unit tests to use list of answers.
parent
ac671e61
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/agent/tests/ctrl_agent_command_mgr_unittest.cc
View file @
c362eac0
...
...
@@ -46,8 +46,16 @@ public:
/// @param expected_code code expected to be returned in the answer
void
checkAnswer
(
ConstElementPtr
answer
,
int
expected_code
)
{
int
status_code
;
isc
::
config
::
parseAnswer
(
status_code
,
answer
);
EXPECT_EQ
(
expected_code
,
status_code
);
// There may be multiple answers returned within a list.
std
::
vector
<
ElementPtr
>
answer_list
=
answer
->
listValue
();
// There must be at least one answer.
ASSERT_GE
(
answer_list
.
size
(),
1
);
// Check that all answers indicate success.
for
(
auto
ans
=
answer_list
.
cbegin
();
ans
!=
answer_list
.
cend
();
++
ans
)
{
ASSERT_NO_THROW
(
isc
::
config
::
parseAnswer
(
status_code
,
*
ans
));
EXPECT_EQ
(
expected_code
,
status_code
);
}
}
/// @brief a convenience reference to control agent command manager
...
...
@@ -57,9 +65,7 @@ public:
/// Just a basic test checking that non-existent command is handled
/// properly.
TEST_F
(
CtrlAgentCommandMgrTest
,
bogus
)
{
ConstElementPtr
answer
;
EXPECT_NO_THROW
(
answer
=
mgr_
.
handleCommand
(
"fish-and-chips-please"
,
ConstElementPtr
()));
checkAnswer
(
answer
,
isc
::
config
::
CONTROL_RESULT_ERROR
);
...
...
@@ -67,12 +73,10 @@ TEST_F(CtrlAgentCommandMgrTest, bogus) {
/// Just a basic test checking that 'list-commands' is supported.
TEST_F
(
CtrlAgentCommandMgrTest
,
listCommands
)
{
ConstElementPtr
answer
;
EXPECT_NO_THROW
(
answer
=
mgr_
.
handleCommand
(
"list-commands"
,
ConstElementPtr
()));
checkAnswer
(
answer
,
isc
::
config
::
CONTROL_RESULT_
ERROR
);
checkAnswer
(
answer
,
isc
::
config
::
CONTROL_RESULT_
SUCCESS
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment