Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
567fdab0
Commit
567fdab0
authored
Mar 10, 2017
by
Tomek Mrugalski
🛰
Browse files
[5114] Minor test improvements after review
parent
fe07268a
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
567fdab0
...
...
@@ -1165,7 +1165,7 @@ TEST_F(Dhcp6ParserTest, subnetLocal) {
TEST_F
(
Dhcp6ParserTest
,
subnetInterface
)
{
// There should be at least one interface
// As far as I can tell, this is the first lambda in Kea code. Cool.
auto
config
=
[
this
](
string
iface
)
{
return
(
"{ "
+
genIfaceConfig
()
+
","
"
\"
preferred-lifetime
\"
: 3000,"
...
...
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
View file @
567fdab0
...
...
@@ -703,21 +703,7 @@ public:
void
runCfgOptionsTest
(
uint16_t
family
,
std
::
string
config
)
{
ConstElementPtr
json
;
ASSERT_NO_THROW
(
json
=
Element
::
fromJSON
(
config
))
<<
config
;
ConstElementPtr
option_def
=
json
->
get
(
"option-def"
);
if
(
option_def
)
{
SimpleParser
::
setListDefaults
(
option_def
,
family
==
AF_INET
?
ParseConfigTest
::
OPTION4_DEF_DEFAULTS
:
ParseConfigTest
::
OPTION6_DEF_DEFAULTS
);
}
ConstElementPtr
option_data
=
json
->
get
(
"option-data"
);
if
(
option_data
)
{
SimpleParser
::
setListDefaults
(
option_data
,
family
==
AF_INET
?
ParseConfigTest
::
OPTION4_DEFAULTS
:
ParseConfigTest
::
OPTION6_DEFAULTS
);
}
runToElementTest
<
CfgOptionsTest
>
(
json
,
*
this
);
runCfgOptionsTest
(
family
,
json
);
}
private:
...
...
src/lib/dhcpsrv/tests/host_reservation_parser_unittest.cc
View file @
567fdab0
...
...
@@ -356,7 +356,7 @@ TEST_F(HostReservationParserTest, dhcp4ClientIdHexWithPrefix) {
// This test verifies that the parser can parse the reservation entry
// when IPv4 address is specified, but hostname is not.
TEST_F
(
HostReservationParserTest
,
dhcp4NoHostname
)
{
std
::
string
config
=
"{
\"
duid
\"
:
\"
01:02:03:04:05:06:07:08:09:0
A
\"
,"
std
::
string
config
=
"{
\"
duid
\"
:
\"
01:02:03:04:05:06:07:08:09:0
a
\"
,"
"
\"
ip-address
\"
:
\"
192.0.2.10
\"
}"
;
ElementPtr
config_element
=
Element
::
fromJSON
(
config
);
...
...
@@ -376,7 +376,6 @@ TEST_F(HostReservationParserTest, dhcp4NoHostname) {
EXPECT_TRUE
(
hosts
[
0
]
->
getHostname
().
empty
());
// lower duid value
boost
::
algorithm
::
to_lower
(
config
);
CfgMgr
::
instance
().
setFamily
(
AF_INET
);
CfgHostsSubnet
cfg_subnet
(
cfg_hosts
,
SubnetID
(
10
));
runToElementTest
<
CfgHostsSubnet
>
(
"["
+
config
+
"]"
,
cfg_subnet
);
...
...
src/lib/dhcpsrv/tests/ifaces_config_parser_unittest.cc
View file @
567fdab0
...
...
@@ -60,6 +60,7 @@ TEST_F(IfacesConfigParserTest, interfaces) {
// Parse the configuration.
IfacesConfigParser
parser
(
AF_INET
);
CfgIfacePtr
cfg_iface
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgIface
();
ASSERT_TRUE
(
cfg_iface
);
ASSERT_NO_THROW
(
parser
.
parse
(
cfg_iface
,
config_element
));
// Check it can be unparsed.
...
...
@@ -84,6 +85,7 @@ TEST_F(IfacesConfigParserTest, interfaces) {
config_element
=
Element
::
fromJSON
(
config
);
cfg_iface
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgIface
();
ASSERT_TRUE
(
cfg_iface
);
ASSERT_NO_THROW
(
parser
.
parse
(
cfg_iface
,
config_element
));
runToElementTest
<
CfgIface
>
(
config
,
*
cfg_iface
);
...
...
@@ -137,6 +139,7 @@ TEST_F(IfacesConfigParserTest, socketTypeDatagram) {
// Parse the configuration.
IfacesConfigParser
parser
(
AF_INET
);
CfgIfacePtr
cfg_iface
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgIface
();
ASSERT_TRUE
(
cfg_iface
);
ASSERT_NO_THROW
(
parser
.
parse
(
cfg_iface
,
config_element
));
// Check it can be unparsed.
...
...
@@ -147,6 +150,7 @@ TEST_F(IfacesConfigParserTest, socketTypeDatagram) {
SrvConfigPtr
cfg
=
CfgMgr
::
instance
().
getStagingCfg
();
ASSERT_TRUE
(
cfg
);
cfg_ref
.
useSocketType
(
AF_INET
,
CfgIface
::
SOCKET_UDP
);
ASSERT_TRUE
(
cfg
->
getCfgIface
());
EXPECT_TRUE
(
*
cfg
->
getCfgIface
()
==
cfg_ref
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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