Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Flowneee
Copy link
Contributor

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.

Copy link

netlify bot commented May 26, 2025

Deploy Preview for testcontainers-rust ready!

Name Link
🔨 Latest commit ead84fe
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-rust/deploys/683adac0a2783a00084135b4
😎 Deploy Preview https://deploy-preview-795--testcontainers-rust.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines 36 to 42
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)
}
Copy link
Collaborator

@DDtKey DDtKey May 29, 2025

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?

Copy link
Contributor Author

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 {
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in 34762da

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