Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix confirm_election_by_request test #3905

Conversation

pwojcikdev
Copy link
Contributor

When testing election confirmations by requesting votes we don't want the other node to have the same election active, as in that case votes would be eagerly generated. Previously the election would get confirmed anyway, even if we didn't request any votes.

@pwojcikdev pwojcikdev force-pushed the prs/fix-confirm-election-by-request branch from 0d035bd to 5421ad2 Compare August 24, 2022 18:20
@pwojcikdev pwojcikdev added the unit test Related to a new, changed or fixed unit test label Aug 24, 2022
@pwojcikdev pwojcikdev force-pushed the prs/fix-confirm-election-by-request branch from 5421ad2 to 1fb5909 Compare August 29, 2022 11:05
@pwojcikdev pwojcikdev force-pushed the prs/fix-confirm-election-by-request branch from 1fb5909 to 312c989 Compare August 29, 2022 11:12
* Waits specified number of time while keeping system running.
* Useful for asserting conditions that should still hold after some delay of time
*/
#define WAIT(time) \
Copy link
Contributor

Choose a reason for hiding this comment

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

this code is a duplicate. We already have system::delay_ms.
However, this implementation looks better. It should replace the implementation in delay_ms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup it's more ergonomic to use, just write WAIT(1s) instead of system.delay_ms (std::chrono::milliseconds (1000));

{
i->stop ();
}
// Only stop system in destructor to avoid confusing and random bugs when debugging assertions that hit deadline expired condition
Copy link
Contributor

Choose a reason for hiding this comment

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

This change should really be in a different PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably should be, I just got annoyed at system stopping everything for no good reason and making it harder for me to debug things. It's a relatively small change though

@pwojcikdev pwojcikdev merged commit e237941 into nanocurrency:develop Aug 29, 2022
@pwojcikdev pwojcikdev deleted the prs/fix-confirm-election-by-request branch August 29, 2022 15:52
@thsfs thsfs added the exclude from changelog Indicates the change is not relevant for appearing in the release changelog label Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog Indicates the change is not relevant for appearing in the release changelog unit test Related to a new, changed or fixed unit test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants