Permalink
Browse files

Merge #7802: [qa] httpbasics: Actually test second connection

fa24456 [qa] httpbasics: Actually test second connection (MarcoFalke)
  • Loading branch information...
laanwj committed Apr 6, 2016
2 parents 401c65c + fa24456 commit 3bc71e1572cbe2e1f85bd487c77a63c46cf4b5bb
Showing with 9 additions and 9 deletions.
  1. +9 −9 qa/rpc-tests/httpbasics.py
View
@@ -37,13 +37,13 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
#send 2nd request without closing connection
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
out2 = conn.getresponse().read()
assert('"error":null' in out1) #must also response with a correct json-rpc message
out1 = conn.getresponse().read()
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
conn.close()
@@ -54,13 +54,13 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
#send 2nd request without closing connection
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
out2 = conn.getresponse().read()
assert('"error":null' in out1) #must also response with a correct json-rpc message
out1 = conn.getresponse().read()
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
conn.close()
@@ -71,7 +71,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock==None) #now the connection must be closed after the response
#node1 (2nd node) is running with disabled keep-alive option
@@ -83,7 +83,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
#node2 (third node) is running with standard keep-alive parameters which means keep-alive is on
urlNode2 = urlparse.urlparse(self.nodes[2].url)
@@ -94,7 +94,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #connection must be closed because bitcoind should use keep-alive by default
# Check excessive request size

0 comments on commit 3bc71e1

Please sign in to comment.