[tests] various improvements to zmq_test.py #10555

pull jnewbery wants to merge 5 commits into bitcoin:master from jnewbery:zmqtestimprovements changing 2 files +41 −31
  1. jnewbery commented at 2:47 pm on June 8, 2017: member

    This PR contains various improvements to zmq_test.py, including stopping it from hanging and causing travis builds to time out. Individual commits are:

    • update zmq test to use correct config.ini file - follows #10331, which moved the config.ini file from /bitcoin/test/functional to /bitcoin/test. zmq_test.py was not updated to find the config file in the correct location. This isn’t a problem when running through test_runner.py, but would prevent zmq_test.py from being run directly.
    • tidy up zmq_test.py - general code tidy-up. Cuts run time from ~12s to ~6s
    • in zmq test, timeout if message not received - stops a race condition where we could try to receive a message on the zmq socket before it’s been sent
    • destroy zmq context in zmq_tests.py - fixes an issue where the zmq contest would not be close properly at the end of the test, causing sys.exit() to fail. This would cause travis builds to hang. See https://stackoverflow.com/questions/17140417/termination-of-python-script-while-using-zeromq-with-dead-server for more details.
    • timeout integration tests on travis after 20 minutes - causes travis builds to timeout individual tests if they run for more than 20 minutes. That means we’ll get logs from hung tests, rather than travis itself timing out after ~50 minutes (in which case we don’t get any useful diagnostics).

    I need this for the next step of #10082, since this test was causing the next PR to hang in travis.

    I believe this will also fix #10552 once that is rebased on top of this.

  2. [tests] update zmq test to use correct config.ini file 4a0c08fdcf
  3. jnewbery force-pushed on Jun 8, 2017
  4. achow101 commented at 6:53 pm on June 8, 2017: member
    ~utACK~ Tested ACK c4f6b7f2bc540c368e2ba1a5ab332432b0e93889
  5. [tests] tidy up zmq_test.py 5ebd5f9e15
  6. jnewbery force-pushed on Jun 8, 2017
  7. jimmysong approved
  8. jimmysong commented at 7:24 pm on June 8, 2017: contributor
    tested ACK c4f6b7f2bc540c368e2ba1a5ab332432b0e93889
  9. jnewbery commented at 7:24 pm on June 8, 2017: member

    Oops. Accidentally squashed two commits together in my last fixup. I’ve divided this PR back into the correct number of commits.

    https://github.com/jnewbery/bitcoin/tree/pr10555.1 == https://github.com/jnewbery/bitcoin/tree/pr10555.2

  10. fanquake added the label Tests on Jun 8, 2017
  11. in test/functional/zmq_test.py:119 in c4f6b7f2bc outdated
    142 
    143-        assert_equal(hashRPC, hashZMQ) #blockhash from generate must be equal to the hash received over zmq
    144+        assert_equal(hashRPC, hashZMQ)  # txid from sendtoaddress must be equal to the hash received over zmq
    145 
    146+        # Destroy the zmq context
    147+        self.zmqContext.destroy(linger=None)
    


    somdoron commented at 7:54 pm on June 10, 2017:
    when test failed this won’t be called and the process will hang, might be good to call this in finally block

    jnewbery commented at 10:46 pm on June 11, 2017:
    Good point @somdoron. Added a fixup commit 72a54cce9ebc3ee1efd69c5d16b11ca54c25783a. Can you take a look and let me know what you think. If you’re happy I’ll squash with the previous commit.

    somdoron commented at 6:27 am on June 12, 2017:
    looks good
  12. jnewbery force-pushed on Jun 11, 2017
  13. [tests] in zmq test, timeout if message not received b1bac1cb7e
  14. in test/functional/zmq_test.py:17 in a2106d8ae3 outdated
    13+from test_framework.util import (assert_equal,
    14+                                 bytes_to_hex_str,
    15+                                 )
    16+
    17+def wait_for_multipart(socket, timeout=60):
    18+    interval = 0.1
    


    somdoron commented at 6:32 am on June 12, 2017:
    You can also call socket.SET(zmq.RCVTIMEO, 60000) when creating the socket instead of the NOBLOCK and the loop. It will raise zmq.error.Again when time is over

    jnewbery commented at 1:16 pm on June 12, 2017:
    Thanks! I didn’t know about zmq.RCVTIMEO. Updated to use that instead of the timeout loop in https://github.com/bitcoin/bitcoin/pull/10555/commits/b1bac1cb7ea1560b46ff758864660a21a228ed67
  15. jnewbery force-pushed on Jun 12, 2017
  16. [tests] destroy zmq context in zmq_tests.py 7c51e9f0dc
  17. [tests] timeout integration tests on travis after 20 minutes 0a4912e46a
  18. jnewbery force-pushed on Jun 12, 2017
  19. somdoron approved
  20. MarcoFalke commented at 12:00 pm on June 18, 2017: member
    Concept ACK 0a4912e46aecef6f04c6287508020ec60424ed24
  21. MarcoFalke merged this on Jun 18, 2017
  22. MarcoFalke closed this on Jun 18, 2017

  23. MarcoFalke referenced this in commit 643fa0b22d on Jun 18, 2017
  24. PastaPastaPasta referenced this in commit ee8e477f17 on Jul 5, 2019
  25. PastaPastaPasta referenced this in commit 18683bb634 on Jul 5, 2019
  26. PastaPastaPasta referenced this in commit 1cc17115e8 on Jul 6, 2019
  27. PastaPastaPasta referenced this in commit c91084499a on Jul 8, 2019
  28. PastaPastaPasta referenced this in commit a178c263b6 on Jul 9, 2019
  29. PastaPastaPasta referenced this in commit aa364bf7af on Jul 9, 2019
  30. barrystyle referenced this in commit d1d9b897f7 on Jan 22, 2020
  31. DrahtBot locked this on Sep 8, 2021

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: 2024-07-05 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me