-
Notifications
You must be signed in to change notification settings - Fork 152
feat: allow to wait for log line on either stdout or stderr #795
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for testcontainers-rust ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
testcontainers/src/core/logs.rs
Outdated
pub(super) fn is_stdout(self) -> bool { | ||
matches!(self, Self::StdOut) | ||
matches!(self, Self::StdOut | Self::BothStd) | ||
} | ||
|
||
pub(super) fn is_stderr(self) -> bool { | ||
matches!(self, Self::StdErr) | ||
matches!(self, Self::StdErr | Self::BothStd) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods may confuse a little bit (is_stdout
-> true for both
)
I think it makes sense to rename them to something like includes_stdout/stderr
- AFAIR we use it only for filtering on request level
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 34762da
/// Create a new [`LogWaitStrategy`] that waits for the given message to appear in either | ||
/// standard output logs or standard error logs. | ||
/// Shortcut for `LogWaitStrategy::new(LogSource::BothStd, message)`. | ||
pub fn both_std(message: impl AsRef<[u8]>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both
seems to be applicable only to the source of log, but here it might be confusing (like "and" semantic - wait for a message in both)
stdout_or_stderr
seems straightforward here (or any_std
at least)
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 34762da
This PR introduces part of changes proposed in #793.
I am not sure about naming of new methods and LogStrategy, I don't like current but was unable to come up with something better.