Skip to content

✨ [pkg/test] Add context to ConcurrentT. #112

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

Merged
merged 2 commits into from
Jun 17, 2021

Conversation

RmbRT
Copy link
Contributor

@RmbRT RmbRT commented Jun 16, 2021

ConcurrentT can now be constructed with an optional context which will cause all stages and waiting operations to fail on expiry.
I diverged from the issue's initial plan, because introducing custom contexts would have made the ConcurrentT object harder to use correctly. Now, there is only one context per ConcurrentT, and not one per wait call. The only adaption needed to use the new feature is to swap out the ConcurrentT's constructor in tests.

Closes #110.

ConcurrentT can now be constructed with an optional context which will
cause all stages and waiting operations to fail on expiry.

Signed-off-by: Steffen Rattay <steffen@perun.network>
@RmbRT RmbRT requested a review from ggwpez June 16, 2021 23:45
Copy link
Contributor

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

Thanks for adding the context errors via t.Errorf, but it seems that Errorf is not thread safe 🤷‍♂️, see CI.
@RmbRT

Now, whenever a stage fails or the test context expires, a t.Errorf()
call is made.

Signed-off-by: Steffen Rattay <steffen@perun.network>
@RmbRT RmbRT force-pushed the 110-concurrentt-waitctx branch from def74ec to 9cb3942 Compare June 17, 2021 15:47
@ggwpez ggwpez self-requested a review June 17, 2021 15:51
Copy link
Contributor

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

Great

@ggwpez ggwpez merged commit c7113e1 into hyperledger-labs:dev Jun 17, 2021
@ggwpez ggwpez deleted the 110-concurrentt-waitctx branch June 17, 2021 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pkg/test] Improve ConcurrentT.Wait()
2 participants