Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
7cd60567
Commit
7cd60567
authored
Jul 10, 2013
by
Michal 'vorner' Vaner
Browse files
[2862] Test the SEGMENT_INFO_UPDATE command
parent
d6c9e292
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/auth/tests/datasrc_clients_builder_unittest.cc
View file @
7cd60567
...
...
@@ -641,4 +641,68 @@ TEST_F(DataSrcClientsBuilderTest,
TestDataSrcClientsBuilder
::
InternalCommandError
);
}
// Test the SEGMENT_INFO_UPDATE command. This test is little bit
// indirect. It doesn't seem possible to fake the client list inside
// easily. So we create a real image to load and load it. Then we check
// the segment is used.
TEST_F
(
DataSrcClientsBuilderTest
,
#ifdef USE_SHARED_MEMORY
segmentInfoUpdate
#else
DISABLED_segmentInfoUpdate
#endif
)
{
// First, prepare the file image to be mapped
const
ConstElementPtr
config
=
Element
::
fromJSON
(
"{"
"
\"
IN
\"
: [{"
"
\"
type
\"
:
\"
MasterFiles
\"
,"
"
\"
params
\"
: {"
"
\"
test1.example
\"
:
\"
"
TEST_DATA_BUILDDIR
"/test1.zone.copied
\"
},"
"
\"
cache-enable
\"
: true,"
"
\"
cache-type
\"
:
\"
mapped
\"
"
"}]}"
);
const
ConstElementPtr
segment_config
=
Element
::
fromJSON
(
"{"
"
\"
mapped-file
\"
:
\"
"
TEST_DATA_BUILDDIR
"/test1.zone.image"
"
\"
}"
);
clients_map
=
configureDataSource
(
config
);
{
const
boost
::
shared_ptr
<
ConfigurableClientList
>
list
=
(
*
clients_map
)[
RRClass
::
IN
()];
list
->
resetMemorySegment
(
"MasterFiles"
,
memory
::
ZoneTableSegment
::
CREATE
,
segment_config
);
const
ConfigurableClientList
::
ZoneWriterPair
result
=
list
->
getCachedZoneWriter
(
isc
::
dns
::
Name
(
"test1.example"
),
false
,
"MasterFiles"
);
ASSERT_EQ
(
ConfigurableClientList
::
ZONE_SUCCESS
,
result
.
first
);
result
.
second
->
load
();
result
.
second
->
install
();
// not absolutely necessary, but just in case
result
.
second
->
cleanup
();
}
// Release this list. That will release the file with the image too,
// so we can map it read only from somewhere else.
// Create a new map, with the same configuration, but without the segments
// set
clients_map
=
configureDataSource
(
config
);
const
boost
::
shared_ptr
<
ConfigurableClientList
>
list
=
(
*
clients_map
)[
RRClass
::
IN
()];
EXPECT_EQ
(
SEGMENT_WAITING
,
list
->
getStatus
()[
0
].
getSegmentState
());
// Send the command
const
ElementPtr
command_args
=
Element
::
fromJSON
(
"{"
"
\"
data-source-name
\"
:
\"
MasterFiles
\"
,"
"
\"
data-source-class
\"
:
\"
IN
\"
"
"}"
);
command_args
->
set
(
"segment-params"
,
segment_config
);
builder
.
handleCommand
(
Command
(
SEGMENT_INFO_UPDATE
,
command_args
,
FinishedCallback
()));
// The segment is now used.
EXPECT_EQ
(
SEGMENT_INUSE
,
list
->
getStatus
()[
0
].
getSegmentState
());
}
}
// unnamed namespace
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