- Split run_test into 4 separate tests
- Add 2 tests, getconnectioncount and getnettotals
- getnettotals - Strategy of test is to get the network stats before and after a ping. The difference in bytes sent/received is the bytes needed for a ping/pong.
[test] Add tests for getconnectioncount, getnettotals and ping #10264
pull jimmysong wants to merge 1 commits into bitcoin:master from jimmysong:test_netrpccalls changing 1 files +34 −1-
jimmysong commented at 11:00 PM on April 23, 2017: contributor
- fanquake added the label Tests on Apr 23, 2017
-
TheBlueMatt commented at 12:47 AM on April 26, 2017: member
utACK
-
in test/functional/net.py:41 in 2c1d06bbff outdated
36 | + self._test_getnettotals() 37 | + self._test_getnetworkinginfo() 38 | + self._test_getaddednodeinfo() 39 | + 40 | + def _test_connection_count(self): 41 | + assert_equal(self.nodes[0].getconnectioncount(), self.num_nodes)
jnewbery commented at 9:06 PM on April 28, 2017:nit: I wouldn't assert these two things are equal. Number of nodes is 2, and the test framework sets up two connections between each node (see
connect_nodes_bi()). The fact that these are the same number is a coincidence.Just
assert_equal(self.nodes[0].getconnectioncount(), 2)is better, with a comment explaining why.in test/functional/net.py:47 in 2c1d06bbff outdated
42 | + 43 | + def _test_getnettotals(self): 44 | + # check that getnettotals totalbytesrecv and totalbytessent 45 | + # are consistent with getpeerinfo 46 | + peer_info = self.nodes[0].getpeerinfo() 47 | + assert_equal(len(peer_info), self.num_nodes)
jnewbery commented at 9:07 PM on April 28, 2017:again, this should just assert equality to 2
in test/functional/net.py:62 in 2c1d06bbff outdated
57 | + time.sleep(0.1) 58 | + peer_info_after_ping = self.nodes[0].getpeerinfo() 59 | + net_totals_after_ping = self.nodes[0].getnettotals() 60 | + for before, after in zip(peer_info, peer_info_after_ping): 61 | + assert_equal(before['bytesrecv_per_msg']['pong'] + 32, 62 | + after['bytesrecv_per_msg']['pong'])
jnewbery commented at 9:12 PM on April 28, 2017:micro-nit: I think because of indentation these are clearer if you don't wrap them over two lines. That's just my personal preference though.
jnewbery approvedjnewbery commented at 9:12 PM on April 28, 2017: membertested ACK 2c1d06bbff74ec852d88d19196b7794e13547992. Thanks for adding these tests. Just some minor nits.
85f950a5c4[test] Add tests for getconnectioncount, getnettotals and ping
* Split run_test into 4 separate tests * Add 2 tests, getconnectioncount and getnettotals * getnettotals - Strategy of test is to get the network stats before and after a ping. The difference in bytes sent/received is the bytes needed for a ping/pong.
jimmysong force-pushed on Apr 28, 2017jnewbery commented at 9:40 PM on April 28, 2017: memberreACK 85f950a5c4cabddda23d7c5732ba25aa6e272b88. Looks good, thanks
in test/functional/net.py:51 in 85f950a5c4
46 | + # are consistent with getpeerinfo 47 | + peer_info = self.nodes[0].getpeerinfo() 48 | + assert_equal(len(peer_info), 2) 49 | + net_totals = self.nodes[0].getnettotals() 50 | + assert_equal(sum([peer['bytesrecv'] for peer in peer_info]), 51 | + net_totals['totalbytesrecv'])
MarcoFalke commented at 10:14 AM on May 1, 2017:nit: personally I'd prefer if it was on a single line, such that it shows up as a whole in case of a print traceback.
MarcoFalke merged this on May 1, 2017MarcoFalke closed this on May 1, 2017MarcoFalke referenced this in commit 492d22f929 on May 1, 2017PastaPastaPasta referenced this in commit f5d5918969 on Jun 10, 2019PastaPastaPasta referenced this in commit 09cf18d19e on Jun 10, 2019PastaPastaPasta referenced this in commit c495ca1499 on Jun 11, 2019PastaPastaPasta referenced this in commit a9cf8b693e on Jun 11, 2019PastaPastaPasta referenced this in commit fb30c7fa7a on Jun 12, 2019PastaPastaPasta referenced this in commit 77a54b10aa on Jun 14, 2019PastaPastaPasta referenced this in commit 8eedb85d8d on Jun 14, 2019PastaPastaPasta referenced this in commit b47ca4213d on Jun 14, 2019PastaPastaPasta referenced this in commit 109b96ff0d on Jun 14, 2019PastaPastaPasta referenced this in commit dfabead29c on Jun 14, 2019PastaPastaPasta referenced this in commit 8263f19c88 on Jun 15, 2019PastaPastaPasta referenced this in commit aaa2f9e7fe on Jun 19, 2019barrystyle referenced this in commit 8a232007fb on Jan 22, 2020MarcoFalke locked this on Sep 8, 2021ContributorsLabels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-27 15:16 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me