Skip to content

Commit 8669263

Browse files
committed
uasyncio: Add missing Boom HTTP testing tool support script.
1 parent 4e34fe9 commit 8669263

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# This is validation script for "boom" tool https://github.com/tarekziade/boom
3+
# To use it:
4+
#
5+
# boom -n1000 --post-hook=boom_uasyncio.validate <rest of boom args>
6+
#
7+
# Note that if you'll use other -n value, you should update NUM_REQS below
8+
# to match.
9+
#
10+
11+
NUM_REQS = 1000
12+
seen = []
13+
cnt = 0
14+
15+
def validate(resp):
16+
global cnt
17+
t = resp.text
18+
l = t.split("\r\n", 1)[0]
19+
no = int(l.split()[1])
20+
seen.append(no)
21+
c = t.count(l + "\r\n")
22+
assert c == 400101
23+
assert t.endswith("=== END ===")
24+
25+
cnt += 1
26+
if cnt == NUM_REQS:
27+
seen.sort()
28+
print
29+
print seen
30+
print
31+
el = None
32+
for i in seen:
33+
if el is None:
34+
el = i
35+
else:
36+
el += 1
37+
assert i == el
38+
return resp

0 commit comments

Comments
 (0)