Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
eos
QuarkDB
Commits
b27d0450
Commit
b27d0450
authored
May 29, 2018
by
Georgios Bitzes
Browse files
Add QSet::Iterator test
parent
6c8e9f98
Pipeline
#401212
passed with stages
in 47 minutes and 56 seconds
Changes
2
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
qclient
@
59de8ef8
Compare
89ab6505
...
59de8ef8
Subproject commit
89ab65054dbe35ea27245946191ffd82d3190a13
Subproject commit
59de8ef866becddf089eb6931ed99cec45edccde
test/e2e.cc
View file @
b27d0450
...
...
@@ -256,6 +256,7 @@ TEST_F(Raft_e2e, test_qclient_convenience_classes) {
RETRY_ASSERT_TRUE
(
checkStateConsensus
(
0
,
1
,
2
));
int
leaderID
=
getLeaderID
();
// QHash iterator
std
::
vector
<
std
::
future
<
redisReplyPtr
>>
replies
;
for
(
size_t
i
=
0
;
i
<
9
;
i
++
)
{
replies
.
push_back
(
tunnel
(
leaderID
)
->
exec
(
"HSET"
,
"myhash"
,
SSTR
(
"f"
<<
i
),
SSTR
(
"v"
<<
i
)));
...
...
@@ -277,8 +278,41 @@ TEST_F(Raft_e2e, test_qclient_convenience_classes) {
ASSERT_FALSE
(
it
.
valid
());
ASSERT_EQ
(
it
.
requestsSoFar
(),
5u
);
}
// QSet iterator
replies
.
clear
();
for
(
size_t
i
=
0
;
i
<
9
;
i
++
)
{
replies
.
push_back
(
tunnel
(
leaderID
)
->
exec
(
"SADD"
,
"myset"
,
SSTR
(
"item-"
<<
i
)));
}
for
(
size_t
i
=
0
;
i
<
9
;
i
++
)
{
ASSERT_REPLY
(
replies
[
i
],
1
);
}
qclient
::
QSet
qset
(
*
tunnel
(
leaderID
),
"myset"
);
for
(
size_t
count
=
1
;
count
<
15
;
count
++
)
{
qclient
::
QSet
::
Iterator
it
=
qset
.
getIterator
(
count
);
for
(
size_t
i
=
0
;
i
<
9
;
i
++
)
{
ASSERT_TRUE
(
it
.
valid
());
ASSERT_EQ
(
it
.
getElement
(),
SSTR
(
"item-"
<<
i
));
it
.
next
();
}
ASSERT_FALSE
(
it
.
valid
());
ASSERT_EQ
(
it
.
requestsSoFar
(),
(
9
/
count
)
+
(
9
%
count
!=
0
)
);
}
qclient
::
QSet
::
Iterator
it2
=
qset
.
getIterator
(
3
,
"next:item-4"
);
for
(
size_t
i
=
4
;
i
<
9
;
i
++
)
{
ASSERT_TRUE
(
it2
.
valid
());
ASSERT_EQ
(
it2
.
getElement
(),
SSTR
(
"item-"
<<
i
));
it2
.
next
();
}
ASSERT_FALSE
(
it2
.
valid
());
ASSERT_EQ
(
it2
.
requestsSoFar
(),
2u
);
}
TEST_F
(
Raft_e2e
,
test_many_redis_commands
)
{
spinup
(
0
);
spinup
(
1
);
spinup
(
2
);
...
...
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