test: Make ua_comment test pass on 0.16.0 #12302

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2017_01_uacomment_test_fix changing 1 files +1 −1
  1. laanwj commented at 5:58 pm on January 30, 2018: member

    The specific length of the uacomment is one shorter on 0.16.0 than on 0.15.99 causing the (stupid) test to fail.

    This change makes assert_start_raises_init_error optionally take a regexp, so that the error message can be checked without being specific about the reported length.

  2. laanwj added the label Tests on Jan 30, 2018
  3. laanwj added this to the milestone 0.16.0 on Jan 30, 2018
  4. theuni commented at 6:01 pm on January 30, 2018: member
    utACK 0224be7bb45f0faed13ba067d14082f19cc0685a
  5. in test/functional/feature_uacomment.py:26 in 0224be7bb4 outdated
    22@@ -23,8 +23,8 @@ def run_test(self):
    23 
    24         self.log.info("test -uacomment max length")
    25         self.stop_node(0)
    26-        expected = "Total length of network version string (286) exceeds maximum length (256). Reduce the number or size of uacomments."
    27-        self.assert_start_raises_init_error(0, ["-uacomment=" + 'a' * 256], expected)
    28+        expected = r"Total length of network version string \([0-9]+\) exceeds maximum length \(256\). Reduce the number or size of uacomments."
    


    promag commented at 6:08 pm on January 30, 2018:
    nit, \d+
  6. in test/functional/test_framework/test_framework.py:288 in 0224be7bb4 outdated
    283@@ -283,7 +284,11 @@ def assert_start_raises_init_error(self, i, extra_args=None, expected_msg=None,
    284                 if expected_msg is not None:
    285                     log_stderr.seek(0)
    286                     stderr = log_stderr.read().decode('utf-8')
    287-                    if expected_msg not in stderr:
    288+                    if use_re:
    289+                        match = re.search(expected_msg, stderr)
    


    promag commented at 6:12 pm on January 30, 2018:
    nit nit, always treat as regexp and remove option?

    laanwj commented at 6:15 pm on January 30, 2018:
    no, then I’d have to change all the tests
  7. promag commented at 6:12 pm on January 30, 2018: member
    utACK.
  8. laanwj force-pushed on Jan 30, 2018
  9. jnewbery commented at 6:37 pm on January 30, 2018: member

    Why not just the minimal fix of:

    0--- a/test/functional/feature_uacomment.py
    1+++ b/test/functional/feature_uacomment.py
    2@@ -23,7 +23,7 @@ class UacommentTest(BitcoinTestFramework):
    3 
    4         self.log.info("test -uacomment max length")
    5         self.stop_node(0)
    6-        expected = "Total length of network version string (286) exceeds maximum length (256). Reduce the number or size of uacomments."
    7+        expected = "exceeds maximum length (256). Reduce the number or size of uacomments."
    8         self.assert_start_raises_init_error(0, ["-uacomment=" + 'a' * 256], expected)
    

    Rather than changing the assert_start_raises_init_error() util function for this one case.

  10. laanwj commented at 6:38 pm on January 30, 2018: member
    Sigh…
  11. laanwj closed this on Jan 30, 2018

  12. laanwj commented at 6:38 pm on January 30, 2018: member
    Closing this, feel free to fix it in your own way.
  13. sdaftuar commented at 6:45 pm on January 30, 2018: member

    ACK 0224be7bb45f0faed13ba067d14082f19cc0685a (verified that it fixes 0.16.0) utACK 031c9a0

    Let’s just merge a fix and move on, this is too much bikeshedding imo.

  14. laanwj reopened this on Jan 30, 2018

  15. laanwj force-pushed on Jan 30, 2018
  16. test: Make ua_comment test pass on 0.16.0
    The specific length of the uacomment is one shorter on `0.16.0` than on
    `0.15.99` causing the (stupid) test to fail.
    Just match the latter part of the message only.
    aac6bce112
  17. laanwj force-pushed on Jan 30, 2018
  18. jnewbery commented at 8:50 pm on January 30, 2018: member

    ACK aac6bce11219574e097a51da867e736c3d6ad96e

    I agree with the longer term goal of changing assert_start_raises_init_error() to compare regexs. There are lots of other tests that check substrings which could be improved.

  19. MarcoFalke commented at 8:53 pm on January 30, 2018: member

    utACK aac6bce11219574e097a51da867e736c3d6ad96e

    Didn’t test that this fixes 0.16. Going to merge and cross fingers…

  20. MarcoFalke merged this on Jan 30, 2018
  21. MarcoFalke closed this on Jan 30, 2018

  22. MarcoFalke referenced this in commit f0295becbf on Jan 30, 2018
  23. jnewbery commented at 8:59 pm on January 30, 2018: member
    (also tested it fixes v0.16 for me)
  24. MarcoFalke deleted a comment on Jan 30, 2018
  25. jnewbery referenced this in commit c4134f8efc on Jan 30, 2018
  26. laanwj referenced this in commit 6c2788c7c8 on Jan 30, 2018
  27. HashUnlimited referenced this in commit cb0b197cca on Mar 16, 2018
  28. ccebrecos referenced this in commit 0647916147 on Sep 14, 2018
  29. PastaPastaPasta referenced this in commit 5fd6510360 on Mar 14, 2020
  30. PastaPastaPasta referenced this in commit b79f3e1a0c on Mar 14, 2020
  31. PastaPastaPasta referenced this in commit 1948435b4a on Mar 15, 2020
  32. ckti referenced this in commit 6ab085096c on Mar 28, 2021
  33. 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-11-17 12:12 UTC

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