Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
c9825a57
Commit
c9825a57
authored
Nov 27, 2012
by
Michal 'vorner' Vaner
Browse files
[2378] Test throwing when missing zone
parent
c842187a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/tests/zone_loader_unittest.cc
View file @
c9825a57
...
...
@@ -41,7 +41,8 @@ namespace {
class
MockClient
:
public
DataSourceClient
{
public:
MockClient
()
:
commit_called_
(
false
)
commit_called_
(
false
),
missing_zone_
(
false
)
{}
virtual
FindResult
findZone
(
const
Name
&
)
const
{
isc_throw
(
isc
::
NotImplemented
,
"Method not used in tests"
);
...
...
@@ -64,6 +65,8 @@ public:
// we get them as references.
vector
<
string
>
rrsets_
;
bool
commit_called_
;
// If set to true, getUpdater returns NULL
bool
missing_zone_
;
};
// The updater isn't really correct according to the API. For example,
...
...
@@ -97,6 +100,9 @@ private:
ZoneUpdaterPtr
MockClient
::
getUpdater
(
const
Name
&
name
,
bool
replace
,
bool
journaling
)
const
{
if
(
missing_zone_
)
{
return
(
ZoneUpdaterPtr
());
}
EXPECT_TRUE
(
replace
);
EXPECT_FALSE
(
journaling
);
provided_updaters_
.
push_back
(
name
);
...
...
@@ -222,4 +228,18 @@ TEST_F(ZoneLoaderTest, copySigned) {
destination_client_
.
rrsets_
[
1
]);
}
// If the destination zone does not exist, it throws
TEST_F
(
ZoneLoaderTest
,
copyMissingDestination
)
{
destination_client_
.
missing_zone_
=
true
;
prepareSource
(
Name
::
ROOT_NAME
(),
"root.zone"
);
EXPECT_THROW
(
ZoneLoader
(
destination_client_
,
Name
::
ROOT_NAME
(),
source_client_
),
DataSourceError
);
}
// If the source zone does not exist, it throws
TEST_F
(
ZoneLoaderTest
,
copyMissingSource
)
{
EXPECT_THROW
(
ZoneLoader
(
destination_client_
,
Name
::
ROOT_NAME
(),
source_client_
),
DataSourceError
);
}
}
Write
Preview
Supports
Markdown
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