Skip to content

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Jan 30, 2018

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.

@laanwj laanwj added the Tests label Jan 30, 2018
@laanwj laanwj added this to the 0.16.0 milestone Jan 30, 2018
@theuni
Copy link
Member

theuni commented Jan 30, 2018

utACK 0224be7bb45f0faed13ba067d14082f19cc0685a

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK.

@@ -23,8 +23,8 @@ def run_test(self):

self.log.info("test -uacomment max length")
self.stop_node(0)
expected = "Total length of network version string (286) exceeds maximum length (256). Reduce the number or size of uacomments."
self.assert_start_raises_init_error(0, ["-uacomment=" + 'a' * 256], expected)
expected = r"Total length of network version string \([0-9]+\) exceeds maximum length \(256\). Reduce the number or size of uacomments."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, \d+

@@ -283,7 +284,11 @@ def assert_start_raises_init_error(self, i, extra_args=None, expected_msg=None,
if expected_msg is not None:
log_stderr.seek(0)
stderr = log_stderr.read().decode('utf-8')
if expected_msg not in stderr:
if use_re:
match = re.search(expected_msg, stderr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit nit, always treat as regexp and remove option?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, then I'd have to change all the tests

@laanwj laanwj force-pushed the 2017_01_uacomment_test_fix branch from 0224be7 to 031c9a0 Compare January 30, 2018 18:28
@jnewbery
Copy link
Contributor

jnewbery commented Jan 30, 2018

Why not just the minimal fix of:

--- a/test/functional/feature_uacomment.py
+++ b/test/functional/feature_uacomment.py
@@ -23,7 +23,7 @@ class UacommentTest(BitcoinTestFramework):
 
         self.log.info("test -uacomment max length")
         self.stop_node(0)
-        expected = "Total length of network version string (286) exceeds maximum length (256). Reduce the number or size of uacomments."
+        expected = "exceeds maximum length (256). Reduce the number or size of uacomments."
         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.

@laanwj
Copy link
Member Author

laanwj commented Jan 30, 2018

Sigh...

@laanwj laanwj closed this Jan 30, 2018
@laanwj
Copy link
Member Author

laanwj commented Jan 30, 2018

Closing this, feel free to fix it in your own way.

@sdaftuar
Copy link
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.

@laanwj laanwj reopened this Jan 30, 2018
@laanwj laanwj force-pushed the 2017_01_uacomment_test_fix branch from 031c9a0 to 197982b Compare January 30, 2018 20:19
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.
@laanwj laanwj force-pushed the 2017_01_uacomment_test_fix branch from 197982b to aac6bce Compare January 30, 2018 20:20
@jnewbery
Copy link
Contributor

ACK aac6bce

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.

@maflcko
Copy link
Member

maflcko commented Jan 30, 2018

utACK aac6bce

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

@maflcko maflcko merged commit aac6bce into bitcoin:master Jan 30, 2018
maflcko pushed a commit that referenced this pull request Jan 30, 2018
aac6bce test: Make ua_comment test pass on 0.16.0 (Wladimir J. van der Laan)

Pull request description:

  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.

Tree-SHA512: 1c5e9f1d0b36f004f8113c7e211e8281194ce8057869ac3702172d8b021df3c3aa3b8f79b9434678ed0fb7146f848802410647d434fc884aa200b6a5e26afe8b
@jnewbery
Copy link
Contributor

(also tested it fixes v0.16 for me)

@bitcoin bitcoin deleted a comment Jan 30, 2018
jnewbery pushed a commit to jnewbery/bitcoin that referenced this pull request Jan 30, 2018
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.

Github-Pull: bitcoin#12302
Rebased-From: aac6bce
laanwj added a commit that referenced this pull request Jan 30, 2018
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.

Github-Pull: #12302
Rebased-From: aac6bce
Tree-SHA512: 9edecbe2529584d6d01296ec153330bb44add8445fef139d7b7a667b86fef8ee3aafea55d95ac109c9fef079133709f69798477e3eba92744ea2f6c8f5acbb7d
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Mar 16, 2018
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.

Github-Pull: bitcoin#12302
Rebased-From: aac6bce
Tree-SHA512: 9edecbe2529584d6d01296ec153330bb44add8445fef139d7b7a667b86fef8ee3aafea55d95ac109c9fef079133709f69798477e3eba92744ea2f6c8f5acbb7d
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 14, 2020
aac6bce test: Make ua_comment test pass on 0.16.0 (Wladimir J. van der Laan)

Pull request description:

  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.

Tree-SHA512: 1c5e9f1d0b36f004f8113c7e211e8281194ce8057869ac3702172d8b021df3c3aa3b8f79b9434678ed0fb7146f848802410647d434fc884aa200b6a5e26afe8b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 14, 2020
aac6bce test: Make ua_comment test pass on 0.16.0 (Wladimir J. van der Laan)

Pull request description:

  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.

Tree-SHA512: 1c5e9f1d0b36f004f8113c7e211e8281194ce8057869ac3702172d8b021df3c3aa3b8f79b9434678ed0fb7146f848802410647d434fc884aa200b6a5e26afe8b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Mar 15, 2020
aac6bce test: Make ua_comment test pass on 0.16.0 (Wladimir J. van der Laan)

Pull request description:

  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.

Tree-SHA512: 1c5e9f1d0b36f004f8113c7e211e8281194ce8057869ac3702172d8b021df3c3aa3b8f79b9434678ed0fb7146f848802410647d434fc884aa200b6a5e26afe8b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants