Skip to content

#26 Support init scripts for test containers - #35

Open
zzzLobster wants to merge 1 commit into
testcontainers:mainfrom
zzzLobster:feature/26
Open

#26 Support init scripts for test containers#35
zzzLobster wants to merge 1 commit into
testcontainers:mainfrom
zzzLobster:feature/26

Conversation

@zzzLobster

@zzzLobster zzzLobster commented Oct 9, 2023

Copy link
Copy Markdown
Contributor

#26 Feature: Support for TC_INITSCRIPT parameter

@zzzLobster
zzzLobster requested a review from a team October 9, 2023 10:09
throw new MojoExecutionException("Error running jOOQ code generation tool", ex);
} finally {
closeClassloader(oldCL, mavenClassloader);
try (var closableContextClassLoader = new ClosableContextClassLoader(getMavenClassloader())) {

@zzzLobster zzzLobster Oct 9, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reworked it to set context ClassLoader before running the container, to be able loading initScript from classpath.
Unfortunately tests as they are cannot cover this case properly (they successfully work without this change). I can try implementing multi-module test to cover it (to make it failing without the change)

@zzzLobster

zzzLobster commented Dec 1, 2023

Copy link
Copy Markdown
Contributor Author

@sivaprasadreddy , @mzagar, @eddumelendez , could you please merge approved PRs and publish new release?
I do need these changes.
Thank you so much!

@rajadilipkolli

Copy link
Copy Markdown
Contributor

@kiview can you please approve?

@eddumelendez eddumelendez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution. I would suggest next time discussing the feature before raising a PR. No immediate action for now, I see some other options

  1. Support copy file
  2. Support volume mount
  3. Execute scripts using ScriptUtils (this PR)

Currently, the suggested approach is using copy files instead due to most of the images provides a fresh initialization folder.

* Optional
*/
@Parameter
private String initScript;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if scripts support is added then supporting a list would be more flexible.

@zzzLobster

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution. I would suggest next time discussing the feature before raising a PR. No immediate action for now, I see some other options

1. Support copy file

2. Support volume mount

3. Execute scripts using ScriptUtils (this PR)

Currently, the suggested approach is using copy files instead due to most of the images provides a fresh initialization folder.

@eddumelendez , could you please check my questions in the issue? #26

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.

5 participants