Skip to content

test: include two more interruptions points - #23782

Merged
maflcko merged 2 commits into
bitcoin:masterfrom
seaona:2021-12-feature-init-test-interruptions
Dec 16, 2021
Merged

maflcko merged 2 commits into
bitcoin:masterfrom
seaona:2021-12-feature-init-test-interruptions

Conversation

@seaona

@seaona seaona commented Dec 15, 2021

Copy link
Copy Markdown
Contributor

This PR aims to introduce 2 more interruption points in the process of initialization, in order to make thefeature_inittestcase more complete. These are the following:

- Checking all blk files are present
- init message: Starting network threads

It is a small improvement for increasing the coverage of potential interruptions, and making sure that the node can restart successfully after these interruptions.

@fanquake fanquake added the Tests label Dec 15, 2021

@shaavan shaavan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK

Increasing number of interruption points in the test will make the test more rigorous as the logfile will be scrutinized with more sentences and phrases.

I have some suggestions to improve upon this PR.

Firstly, how about also adding the following phrases to the lines_to_interuppt_after list

  • ‘Validating signatures for all blocks’
  • ‘Starting HTTP server.’

Secondly, you should reorder the lines in the lines_to_interuppt_after list according to the order in which they appear in the logfile. Using the following patch, you can quickly know the line number in which the phrase appears.

if line and terminate_line.lower() in line.lower():
-                    self.log.debug(f"Terminating node after {num_lines} log lines seen")
+                    self.log.info(f"Terminating node after {num_lines} log lines seen")
                     sigterm_node()
                     break

When the test is run, this patch will print the phrase with the line number on the terminal.

@seaona

seaona commented Dec 15, 2021

Copy link
Copy Markdown
Contributor Author

@shaavan your feedback makes a lot of sense. Thank you. I've included your suggested phrases and also re-ordered the array, according to the order they appear on the logs (I didn't notice that they were following this order).
I've changed the command self.log.debug to self.log.info for checking the lines.
Do you suggest me to also include this change on the PR? or should I leave it back to self.log.debug?

@jamesob

jamesob commented Dec 15, 2021 •

Copy link
Copy Markdown
Contributor

ACK 618f4d2, pending CI

More init coverage is better. 👍

@seaona

seaona commented Dec 15, 2021

Copy link
Copy Markdown
Contributor Author

[Update] Seems that ci is failing for some reason. All the steps of interrupting and re-starting the node seem that are working fine though. Working on debugging.
https://cirrus-ci.com/task/4602015652249600?logs=ci#L4088
image

@jamesob

jamesob commented Dec 15, 2021

Copy link
Copy Markdown
Contributor

@seaona probably related to #23737.

@DrahtBot

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23737 (test: make feature_init more robust by jamesob)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@jarolrod jarolrod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 618f4d2

This is a nice improvement, and welcome as a first-time contributor 🥃. I ran the test locally, and the CI failure looks unrelated.

'net thread start',
'addcon thread start',
'msghand thread start',
'msghand thread start'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Any reason to remove the trailing comma? This makes this diff (and potential future ones) larger than necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@MarcoFalke you are right. Having the comma would have been a better choice, as you are pointing. I see PR is merged already but will keep this in mind for next times. Thank you!

@maflcko
maflcko merged commit 98c362a into bitcoin:master Dec 16, 2021

@shaavan shaavan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test looks a lot more complete and in order now!

Do you suggest me to also include this change on the PR? or should I leave it back to self.log.debug?

This was just a temporary patch to know the line number of each phrase occurrence. It is better the way it is in the master branch. You wouldn't like to crowd up your terminal each time you run the test :)

I rerun the test with the patch, and I observed there is still some phrases not following the ordering:

Screenshot from 2021-12-16 12-30-41

Edit: Since this PR is now merged, maybe correcting the ordering could be taken up in a follow-up PR that touches this section.

@seaona

seaona commented Dec 16, 2021

Copy link
Copy Markdown
Contributor Author

This was just a temporary patch to know the line number of each phrase occurrence. It is better the way it is in the master branch. You wouldn't like to crowd up your terminal each time you run the test :)

@shaavan, I also thought that logging too much info would be over-crowding the terminal, so I left it as it was previously. The command was very useful for debugging though :)

Edit: Since this PR is now merged, maybe correcting the ordering could be taken up in a follow-up PR that touches this section.

I didn't realize 2 lines where the other way around, thank you very much for pointing this and for all your help!

Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 25, 2022
Summary:
Reorganized array according to order of logs and included 4 more interruption events:
- 'Checking all blk files are present'
- 'init message: Starting network threads'
- 'Validating signatures for all blocks'
- 'Starting HTTP server'

This is a backport of [[bitcoin/bitcoin#23782 | core#23782]]

Test Plan: `ninja check-functional`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12612
@bitcoin bitcoin locked and limited conversation to collaborators Dec 16, 2022
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.

7 participants