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
b7da638f
Commit
b7da638f
authored
May 21, 2014
by
Thomas Markwalder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[3382] A few more review changes.
Added unit tests for null DUIDs. Minor nit fixes.
parent
403663bb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
2 deletions
+37
-2
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/lease_mgr.h
+1
-1
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.h
+1
-1
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
+12
-0
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
+3
-0
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+10
-0
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
+6
-0
src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
+4
-0
No files found.
src/lib/dhcpsrv/lease_mgr.h
View file @
b7da638f
...
...
@@ -122,7 +122,7 @@ public:
/// see the documentation of those classes for details.
class
LeaseMgr
{
public:
/// @brief Defines maxi
u
mum value for time that can be reliably stored.
/// @brief Defines maximum value for time that can be reliably stored.
// If I'm still alive I'll be too old to care. You fix it.
static
const
time_t
MAX_DB_TIME
;
...
...
src/lib/dhcpsrv/pgsql_lease_mgr.h
View file @
b7da638f
...
...
@@ -99,7 +99,7 @@ struct PsqlBindArray {
/// Converts the given boolean value to its corresponding to PostgreSQL
/// string value and adds it as a TEXT_FMT value to the bind array.
///
/// @param value
std::string containing the
value to add.
/// @param value
bool
value to add.
void
add
(
const
bool
&
value
);
/// @brief Dumps the contents of the array to a string.
...
...
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
View file @
b7da638f
...
...
@@ -1552,6 +1552,18 @@ GenericLeaseMgrTest::testRecreateLease6() {
detailCompareLease
(
lease
,
l_returned
);
}
void
GenericLeaseMgrTest
::
testNullDuid
()
{
// Create leases, although we need only one.
vector
<
Lease6Ptr
>
leases
=
createLeases6
();
// Set DUID to empty pointer.
leases
[
1
]
->
duid_
.
reset
();
// Insert should throw.
ASSERT_THROW
(
lmptr_
->
addLease
(
leases
[
1
]),
DbOperationError
);
}
};
// namespace test
};
// namespace dhcp
...
...
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.h
View file @
b7da638f
...
...
@@ -252,6 +252,9 @@ public:
/// persistent storage has been updated as expected.
void
testRecreateLease6
();
/// @brief Verifies that a null DUID is not allowed.
void
testNullDuid
();
/// @brief String forms of IPv4 addresses
std
::
vector
<
std
::
string
>
straddress4_
;
...
...
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
View file @
b7da638f
...
...
@@ -411,4 +411,14 @@ TEST_F(MemfileLeaseMgrTest, testRecreateLease6) {
// testGetLease4HWAddrSubnetIdSize() - memfile just keeps Lease structure
// and does not do any checks of HWAddr content
/// @brief Checks that null DUID is not allowed.
/// Test is disabled as Memfile does not currently defend against a null DUID.
TEST_F
(
MemfileLeaseMgrTest
,
DISABLED_nullDuid
)
{
// Create leases, although we need only one.
vector
<
Lease6Ptr
>
leases
=
createLeases6
();
leases
[
1
]
->
duid_
.
reset
();
ASSERT_THROW
(
lmptr_
->
addLease
(
leases
[
1
]),
DbOperationError
);
}
};
// end of anonymous namespace
src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
View file @
b7da638f
...
...
@@ -516,4 +516,10 @@ TEST_F(MySqlLeaseMgrTest, testRecreateLease6) {
testRecreateLease6
();
}
/// @brief Checks that null DUID is not allowed.
/// Test is disabled as MySqlLeaseMgr does not currently defend against a null DUID.
TEST_F
(
MySqlLeaseMgrTest
,
DISABLED_nullDuid
)
{
testNullDuid
();
}
};
// Of anonymous namespace
src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
View file @
b7da638f
...
...
@@ -464,4 +464,8 @@ TEST_F(PgSqlLeaseMgrTest, updateLease6) {
testUpdateLease6
();
}
TEST_F
(
PgSqlLeaseMgrTest
,
nullDuid
)
{
testNullDuid
();
}
};
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