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

feat: support for wait.ForExec with response matcher #1035

Merged

Conversation

mdelapenya
Copy link
Member

What does this PR do?

It adds WithResponseMatcher to the wait.ForExec strategy, so that it behaves as in the wait.ForHTTP strategy.

Why is it important?

Provide support for the use case where we want to run a command in a container, and verify the output of that command.

Related issues

@mdelapenya mdelapenya requested a review from a team as a code owner April 4, 2023 14:59
@mdelapenya mdelapenya added the feature New functionality or new behaviors on the existing one label Apr 4, 2023
@mdelapenya mdelapenya self-assigned this Apr 4, 2023
@netlify
Copy link

netlify bot commented Apr 4, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 1b2c639
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/642c3b61f22f5c000853b5a7
😎 Deploy Preview https://deploy-preview-1035--testcontainers-go.netlify.app/features/wait/exec
📱 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 site settings.

@@ -72,13 +82,16 @@ func (ws *ExecStrategy) WaitUntilReady(ctx context.Context, target StrategyTarge
case <-ctx.Done():
return ctx.Err()
case <-time.After(ws.PollInterval):
exitCode, _, err := target.Exec(ctx, ws.cmd)
exitCode, resp, err := target.Exec(ctx, ws.cmd, tcexec.Multiplexed())
Copy link
Member Author

@mdelapenya mdelapenya Apr 4, 2023

Choose a reason for hiding this comment

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

We used multiplexed to remove the trailing bytes from the Docker protocol (garbage). See #624

@sonarcloud
Copy link

sonarcloud bot commented Apr 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mdelapenya mdelapenya merged commit a82f01b into testcontainers:main Apr 5, 2023
@mdelapenya mdelapenya deleted the wait-for-exec-response-matcher branch April 5, 2023 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality or new behaviors on the existing one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant