Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pavel Zhukov
Kea
Commits
ed69c4be
Commit
ed69c4be
authored
Jan 25, 2011
by
Michal 'vorner' Vaner
Browse files
[trac420] Check the returned data
The tests only received data, but did not check it is correct. Now it is checked.
parent
83033bbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/msgq/tests/msgq_test.py
View file @
ed69c4be
...
...
@@ -6,6 +6,7 @@ import socket
import
signal
import
sys
import
time
import
isc.cc
#
# Currently only the subscription part and some sending is implemented...
...
...
@@ -195,13 +196,15 @@ class SendNonblock(unittest.TestCase):
os
.
kill
(
queue_pid
,
signal
.
SIGTERM
)
sys
.
exit
(
1
)
signal
.
signal
(
signal
.
SIGALRM
,
killall
)
msg
=
msgq
.
preparemsg
({
"type"
:
"ping"
},
{
"
data
"
:
data
}
)
msg
=
msgq
.
preparemsg
({
"type"
:
"ping"
},
data
)
now
=
time
.
clock
()
while
time
.
clock
()
-
now
<
0.2
:
out
.
sendall
(
msg
)
amount
=
0
while
amount
<
length
:
amount
+=
len
(
out
.
recv
(
1024
+
length
-
amount
))
# Check the answer
(
routing
,
received
)
=
msgq
.
read_packet
(
out
.
fileno
(),
out
)
self
.
assertEqual
({
"type"
:
"pong"
},
isc
.
cc
.
message
.
from_wire
(
routing
))
self
.
assertEqual
(
data
,
received
)
os
.
kill
(
queue_pid
,
signal
.
SIGTERM
)
self
.
terminate_check
(
run
)
...
...
@@ -209,13 +212,13 @@ class SendNonblock(unittest.TestCase):
"""
Tests sending small data many times.
"""
self
.
send_many
(
"data"
)
self
.
send_many
(
b
"data"
)
def
test_large_sends
(
self
):
"""
Tests sending large data many times.
"""
data
=
"data"
data
=
b
"data"
for
i
in
range
(
1
,
20
):
data
=
data
+
data
self
.
send_many
(
data
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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