Skip to content

Conversation

@mmorshedi
Copy link

In PR #7680, a new feature was introduced to support multiple init scripts in JdbcDatabaseContainer. However, during this update, a critical null check was inadvertently removed from the JdbcDatabaseContainer.runInitScriptIfRequired method. This check was responsible for ignoring null values for the initScript parameter.

As a result, when no init script is defined, a null value is passed to ScriptUtils.runInitScript, leading to an exception being thrown and preventing the database container from starting.

This commit reinstates the missing null check, ensuring that undefined init scripts are properly handled. Additionally, a test has been added to verify that the issue is resolved and the database container can start without an init script.

In PR testcontainers#7680, a new feature was introduced to support multiple init scripts in JdbcDatabaseContainer. However, during this update, a critical null check was inadvertently removed from the `JdbcDatabaseContainer.runInitScriptIfRequired` method. This check was responsible for ignoring null values for the `initScript` parameter.

As a result, when no init script is defined, a null value is passed to `ScriptUtils.runInitScript`, leading to an exception being thrown and preventing the database container from starting.

This commit reinstates the missing null check, ensuring that undefined init scripts are properly handled. Additionally, a test has been added to verify that the issue is resolved and the database container can start without an init script.
@mmorshedi
Copy link
Author

@eddumelendez Could you please review this fix for a breaking change?

@eddumelendez eddumelendez added this to the next milestone Aug 19, 2024
@eddumelendez eddumelendez merged commit 251bca5 into testcontainers:main Aug 20, 2024
@eddumelendez
Copy link
Member

Thanks for your contribution, @mmorshedi!

fokion pushed a commit to fokion/testcontainers-java that referenced this pull request Jan 18, 2025
In 6a07650, a new feature was introduced to support multiple init scripts in JdbcDatabaseContainer. However, during this update, a critical null check was inadvertently removed from the `JdbcDatabaseContainer.runInitScriptIfRequired` method. This check was responsible for ignoring null values for the `initScript` parameter.

As a result, when no init script is defined, a null value is passed to `ScriptUtils.runInitScript`, leading to an exception being thrown and preventing the database container from starting.

This commit reinstates the missing null check, ensuring that undefined init scripts are properly handled. Additionally, a test has been added to verify that the issue is resolved and the database container can start without an init script.

---------

Co-authored-by: Eddú Meléndez <[email protected]>
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