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
ISC Open Source Projects
Kea
Commits
7ff2ddee
Commit
7ff2ddee
authored
Oct 22, 2012
by
JINMEI Tatuya
Browse files
[2212] ported command test's loadBrokenZone test.
now catch exceptions from reload().
parent
3519306b
Changes
2
Show whitespace changes
Inline
Side-by-side
src/bin/auth/datasrc_clients_mgr.h
View file @
7ff2ddee
...
@@ -490,9 +490,16 @@ DataSrcClientsBuilderBase<MutexType, CondVarType>::doLoadZone(
...
@@ -490,9 +490,16 @@ DataSrcClientsBuilderBase<MutexType, CondVarType>::doLoadZone(
assert
(
client_list
);
assert
(
client_list
);
datasrc
::
ConfigurableClientList
::
ReloadResult
result
;
datasrc
::
ConfigurableClientList
::
ReloadResult
result
;
{
try
{
typename
MutexType
::
Locker
locker
(
*
map_mutex_
);
typename
MutexType
::
Locker
locker
(
*
map_mutex_
);
result
=
client_list
->
reload
(
origin
);
result
=
client_list
->
reload
(
origin
);
}
catch
(
const
isc
::
Exception
&
ex
)
{
// We catch our internal exceptions (which will be just ignored) and
// propagated others (which should generally be considered fatal and
// will make the thread terminate)
isc_throw
(
InternalCommandError
,
"failed to load a zone "
<<
origin
<<
"/"
<<
rrclass
<<
": error occurred in reload: "
<<
ex
.
what
());
}
}
switch
(
result
)
{
switch
(
result
)
{
case
datasrc
::
ConfigurableClientList
::
ZONE_RELOADED
:
case
datasrc
::
ConfigurableClientList
::
ZONE_RELOADED
:
...
...
src/bin/auth/tests/datasrc_clients_builder_unittest.cc
View file @
7ff2ddee
...
@@ -372,4 +372,20 @@ TEST_F(DataSrcClientsBuilderTest,
...
@@ -372,4 +372,20 @@ TEST_F(DataSrcClientsBuilderTest,
find
(
Name
(
"example.org"
),
RRType
::
SOA
())
->
code
);
find
(
Name
(
"example.org"
),
RRType
::
SOA
())
->
code
);
}
}
TEST_F
(
DataSrcClientsBuilderTest
,
loadBrokenZone
)
{
configureZones
();
ASSERT_EQ
(
0
,
std
::
system
(
INSTALL_PROG
" -c "
TEST_DATA_DIR
"/test1-broken.zone.in "
TEST_DATA_BUILDDIR
"/test1.zone.copied"
));
// there's an error in the new zone file. reload will be rejected.
const
Command
loadzone_cmd
(
LOADZONE
,
isc
::
data
::
Element
::
fromJSON
(
"{
\"
class
\"
:
\"
IN
\"
,"
"
\"
origin
\"
:
\"
test1.example
\"
}"
));
EXPECT_THROW
(
builder
.
handleCommand
(
loadzone_cmd
),
TestDataSrcClientsBuilder
::
InternalCommandError
);
zoneChecks
(
clients_map
,
rrclass
);
// zone shouldn't be replaced
}
}
// unnamed namespace
}
// unnamed namespace
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