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
416
Issues
416
List
Boards
Labels
Service Desk
Milestones
Merge Requests
66
Merge Requests
66
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
d8fdd817
Commit
d8fdd817
authored
Dec 13, 2019
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#1041
] Extended statusGet unittests
The uptime, reload and pid returned are validated.
parent
b3242fb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
9 deletions
+75
-9
src/bin/agent/tests/ca_controller_unittests.cc
src/bin/agent/tests/ca_controller_unittests.cc
+19
-2
src/bin/d2/tests/d2_command_unittest.cc
src/bin/d2/tests/d2_command_unittest.cc
+19
-3
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
+18
-2
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
+19
-2
No files found.
src/bin/agent/tests/ca_controller_unittests.cc
View file @
d8fdd817
...
...
@@ -13,6 +13,7 @@
#include <process/testutils/d_test_stubs.h>
#include <boost/pointer_cast.hpp>
#include <sstream>
#include <unistd.h>
using
namespace
std
;
using
namespace
isc
::
agent
;
...
...
@@ -676,8 +677,24 @@ TEST_F(CtrlAgentControllerTest, statusGet) {
EXPECT_EQ
(
0
,
result
->
intValue
());
ConstElementPtr
arguments
=
response
->
get
(
"arguments"
);
ASSERT_EQ
(
Element
::
map
,
arguments
->
getType
());
EXPECT_TRUE
(
arguments
->
contains
(
"pid"
));
EXPECT_TRUE
(
arguments
->
contains
(
"uptime"
));
// The returned pid should be the pid of our process.
auto
found_pid
=
arguments
->
get
(
"pid"
);
ASSERT_TRUE
(
found_pid
);
EXPECT_EQ
(
static_cast
<
int64_t
>
(
getpid
()),
found_pid
->
intValue
());
// It is hard to check the actual uptime (and reload) as it is based
// on current time. Let's just make sure it is within a reasonable
// range.
auto
found_uptime
=
arguments
->
get
(
"uptime"
);
ASSERT_TRUE
(
found_uptime
);
EXPECT_LE
(
found_uptime
->
intValue
(),
5
);
EXPECT_GE
(
found_uptime
->
intValue
(),
0
);
auto
found_reload
=
arguments
->
get
(
"reload"
);
ASSERT_TRUE
(
found_reload
);
EXPECT_LE
(
found_reload
->
intValue
(),
5
);
EXPECT_GE
(
found_reload
->
intValue
(),
0
);
}
}
src/bin/d2/tests/d2_command_unittest.cc
View file @
d8fdd817
...
...
@@ -23,6 +23,7 @@
#include <iostream>
#include <sstream>
#include <thread>
#include <unistd.h>
using
namespace
std
;
using
namespace
isc
;
...
...
@@ -632,9 +633,24 @@ TEST_F(CtrlChannelD2Test, statusGet) {
EXPECT_EQ
(
0
,
result
->
intValue
());
ConstElementPtr
arguments
=
response
->
get
(
"arguments"
);
ASSERT_EQ
(
Element
::
map
,
arguments
->
getType
());
EXPECT_TRUE
(
arguments
->
contains
(
"pid"
));
// launch is not called so we have only reload, not uptime.
EXPECT_TRUE
(
arguments
->
contains
(
"reload"
));
// The returned pid should be the pid of our process.
auto
found_pid
=
arguments
->
get
(
"pid"
);
ASSERT_TRUE
(
found_pid
);
EXPECT_EQ
(
static_cast
<
int64_t
>
(
getpid
()),
found_pid
->
intValue
());
// It is hard to check the actual reload time as it is based
// on current time. Let's just make sure it is within a reasonable
// range.
auto
found_reload
=
arguments
->
get
(
"reload"
);
ASSERT_TRUE
(
found_reload
);
EXPECT_LE
(
found_reload
->
intValue
(),
5
);
EXPECT_GE
(
found_reload
->
intValue
(),
0
);
/// @todo uptime is not available in this test, because the launch()
/// function is not called. This is not critical to test here,
/// because the same logic is tested for CA and in that case the
/// uptime is tested.
}
// Tests if the server returns its configuration using config-get.
...
...
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
View file @
d8fdd817
...
...
@@ -1049,8 +1049,24 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) {
EXPECT_EQ
(
0
,
result
->
intValue
());
ConstElementPtr
arguments
=
response
->
get
(
"arguments"
);
ASSERT_EQ
(
Element
::
map
,
arguments
->
getType
());
EXPECT_TRUE
(
arguments
->
contains
(
"pid"
));
EXPECT_TRUE
(
arguments
->
contains
(
"uptime"
));
// The returned pid should be the pid of our process.
auto
found_pid
=
arguments
->
get
(
"pid"
);
ASSERT_TRUE
(
found_pid
);
EXPECT_EQ
(
static_cast
<
int64_t
>
(
getpid
()),
found_pid
->
intValue
());
// It is hard to check the actual uptime (and reload) as it is based
// on current time. Let's just make sure it is within a reasonable
// range.
auto
found_uptime
=
arguments
->
get
(
"uptime"
);
ASSERT_TRUE
(
found_uptime
);
EXPECT_LE
(
found_uptime
->
intValue
(),
5
);
EXPECT_GE
(
found_uptime
->
intValue
(),
0
);
auto
found_reload
=
arguments
->
get
(
"reload"
);
ASSERT_TRUE
(
found_reload
);
EXPECT_LE
(
found_reload
->
intValue
(),
5
);
EXPECT_GE
(
found_reload
->
intValue
(),
0
);
}
// This test verifies that the DHCP server handles config-backend-pull command
...
...
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
View file @
d8fdd817
...
...
@@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <cstdlib>
#include <unistd.h>
#include <thread>
...
...
@@ -941,8 +942,24 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) {
EXPECT_EQ
(
0
,
result
->
intValue
());
ConstElementPtr
arguments
=
response
->
get
(
"arguments"
);
ASSERT_EQ
(
Element
::
map
,
arguments
->
getType
());
EXPECT_TRUE
(
arguments
->
contains
(
"pid"
));
EXPECT_TRUE
(
arguments
->
contains
(
"uptime"
));
// The returned pid should be the pid of our process.
auto
found_pid
=
arguments
->
get
(
"pid"
);
ASSERT_TRUE
(
found_pid
);
EXPECT_EQ
(
static_cast
<
int64_t
>
(
getpid
()),
found_pid
->
intValue
());
// It is hard to check the actual uptime (and reload) as it is based
// on current time. Let's just make sure it is within a reasonable
// range.
auto
found_uptime
=
arguments
->
get
(
"uptime"
);
ASSERT_TRUE
(
found_uptime
);
EXPECT_LE
(
found_uptime
->
intValue
(),
5
);
EXPECT_GE
(
found_uptime
->
intValue
(),
0
);
auto
found_reload
=
arguments
->
get
(
"reload"
);
ASSERT_TRUE
(
found_reload
);
EXPECT_LE
(
found_reload
->
intValue
(),
5
);
EXPECT_GE
(
found_reload
->
intValue
(),
0
);
}
// This test verifies that the DHCP server handles server-tag-get command
...
...
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