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

Ensure assertion success/failure is reported in EventMonitor #495

Merged
merged 3 commits into from
Apr 26, 2021

Conversation

azawlocki
Copy link
Contributor

@azawlocki azawlocki commented Apr 21, 2021

Summary of changes

Ensure that assertion success or failure is logged by an event monitor.

Description copied from the docstring in a unit test case added in 9b96799:

Test that assertion success and failure are logged.

This used to be a problem for assertions that do not succeed or fail
immediately after consuming an event. For example if an assertion
contains `asyncio.wait_for()` then it may raise an exception some time
after it consumed any event. After the failure, the monitor will not
feed new events to the assertion. But it should report the failure
(exactly once).

Add optional list of extra_monitors to Runner.check_assertion_errors()

This would simplify checking errors in monitors created ad hoc, not associated with a probe or an agent.
For example, one yapapi integration test ends with:

        for a in monitor.failed:
            raise a.result()

(https://github.com/golemfactory/yapapi/blob/d33d676081a7a29c30b695bb13f7b88c89bc9a46/tests/goth/test_resubscription.py#L190-L191).
After this change, one would be able to write instead:

        runner.check_assertion_errors(monitor)

Add colors to "Running test ..." and "Test finished ..." messages

A bonus. See e.g. https://github.com/golemfactory/goth/runs/2398454134?check_suite_focus=true#step:9:17 and https://github.com/golemfactory/goth/runs/2398454134?check_suite_focus=true#step:9:110.

@azawlocki azawlocki requested a review from kmazurek April 21, 2021 08:46
@azawlocki azawlocki self-assigned this Apr 21, 2021
Copy link
Contributor

@kmazurek kmazurek left a comment

Choose a reason for hiding this comment

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

👍

@azawlocki azawlocki merged commit 29e21ac into master Apr 26, 2021
@azawlocki azawlocki deleted the az/fix-assertion-reporting branch April 26, 2021 14:14
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.

2 participants