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

Fixes for monitored logger #485

Merged
merged 5 commits into from
Apr 14, 2021
Merged

Fixes for monitored logger #485

merged 5 commits into from
Apr 14, 2021

Conversation

azawlocki
Copy link
Contributor

Resolves #484
Resolves #468

@azawlocki azawlocki self-assigned this Apr 14, 2021
@azawlocki azawlocki force-pushed the az/fix-monitored-logger branch from 92fd497 to 38d4baf Compare April 14, 2021 06:42
@azawlocki azawlocki requested a review from kmazurek April 14, 2021 10:07
logger.removeFilter(filter)
logger_to_monitor.removeFilter(filter)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The bug in #484 was caused by using logger instead of logger_ here.

Comment on lines -181 to +183
await super().stop()
if self._buffer_task:
self._buffer_task.stop(StopThreadException)
await super().stop()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is to fix #468, in which _buffer_task tries to add some more events to a monitor that is already stopped.

@@ -324,6 +325,9 @@ async def run_command_on_host(
)
yield cmd_task, cmd_monitor

await cmd_task
Copy link
Contributor Author

@azawlocki azawlocki Apr 14, 2021

Choose a reason for hiding this comment

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

It's important to wait until cmd_task finishes here, in the monitored_logger's scope. Otherwise we're risking that the monitor gets disconnected from the task's output (which happens when exiting the monitored_logger context manager) before seeing all lines of the output (this happened in the unit test for run_command_on_host added in this PR, before adding this change).

Comment on lines +339 to +340
for assertion in cmd_monitor.failed:
raise TemporalAssertionError(assertion.name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's not forget to report assertion failures that occurred at the "end of events".

@azawlocki azawlocki merged commit f3e2798 into master Apr 14, 2021
@azawlocki azawlocki deleted the az/fix-monitored-logger branch April 14, 2021 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants