Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
c362eac0
Commit
c362eac0
authored
Feb 27, 2017
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5107] Modified agent's unit tests to use list of answers.
parent
ac671e61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
src/bin/agent/tests/ctrl_agent_command_mgr_unittest.cc
src/bin/agent/tests/ctrl_agent_command_mgr_unittest.cc
+11
-7
No files found.
src/bin/agent/tests/ctrl_agent_command_mgr_unittest.cc
View file @
c362eac0
...
...
@@ -46,9 +46,17 @@ 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
);
// 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
CtrlAgentCommandMgr
&
mgr_
;
...
...
@@ -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