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

Use ASSERT_TIMELY in tests where possible #2780

Merged
merged 3 commits into from
Jun 19, 2020

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented May 19, 2020

ASSERT_TIMELY provides a more concise syntactic way to express:

system.deadline_set (10s);
while (!condition)
{
	ASSERT_NO_ERROR (system.poll ());
}

as
ASSERT_TIMELY (10s, condition);

This cannot be used in more complex examples such as when there are other contents of the body. For that we do have system::poll_until_true, but that has not been used here.

Also modified some places which used a read db transaction variable in each iteration inside the loop body and doing a comparison there. This can be changed to create a temporary transaction as an argument, allowing the use of ASSERT_TIMELY with it.

@wezrule wezrule added the unit test Related to a new, changed or fixed unit test label May 19, 2020
@wezrule wezrule added this to the V22.0 milestone May 19, 2020
@wezrule wezrule self-assigned this May 19, 2020
clemahieu
clemahieu previously approved these changes May 19, 2020
@wezrule wezrule merged commit bc80582 into nanocurrency:develop Jun 19, 2020
@wezrule wezrule deleted the use_assert_timely branch June 19, 2020 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unit test Related to a new, changed or fixed unit test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants