Skip to content

Add support for workdir and env var in exec command - #7816

Merged
eddumelendez merged 3 commits into
mainfrom
execconfig
Nov 29, 2023
Merged

Add support for workdir and env var in exec command#7816
eddumelendez merged 3 commits into
mainfrom
execconfig

Conversation

@eddumelendez

Copy link
Copy Markdown
Member

Currently, only user and command can be used with execInContainer.
This commit introduces ExecConfig, which allows to set workdir and
env vars when running an exec process.

execInContainerWithUser is deprecated in favor of execInContainer(ExecConfig)

Currently, only `user` and `command` can be used with `execInContainer`.
This commit introduces `ExecConfig`, which allows to set workdir and
env vars when running an exec process.

`execInContainerWithUser` is deprecated in favor of `execInContainer(ExecConfig)`
@eddumelendez
eddumelendez requested a review from a team November 15, 2023 22:05
@eddumelendez eddumelendez added this to the next milestone Nov 15, 2023
@eddumelendez eddumelendez removed this from the 1.19.3 milestone Nov 21, 2023
@eddumelendez eddumelendez added this to the next milestone Nov 29, 2023
@eddumelendez
eddumelendez merged commit 212cf54 into main Nov 29, 2023
@eddumelendez
eddumelendez deleted the execconfig branch November 29, 2023 21:57
@perlun

perlun commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

Thanks for this @eddumelendez, appreciated. 🙏 I was about to fix a PR for this myself, since I just added support for these specific things (working dir and environment variables) in a custom method in my test class, but then I was puzzled when ExecInContainerTest seemed to contain support for this already... only to realize you added it last week. 😂

image

Looking forward to see this being released as part of vNext. 👍 🎉

@perlun

perlun commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

Could perhaps be worth adding to https://java.testcontainers.org/features/commands/ also, along with the new version?

fokion pushed a commit to fokion/testcontainers-java that referenced this pull request Jan 18, 2025
)

Currently, only `user` and `command` can be used with `execInContainer`.
This commit introduces `ExecConfig`, which allows to set workdir and
env vars when running an exec process.

`execInContainerWithUser` is deprecated in favor of `execInContainer(ExecConfig)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants