Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
I've encountered a bug while working on my Micronaut application. This application needs to connect to an MSSQL Server (jdbc) and execute a stored procedures. The problem occurs specifically during testing when I'm using MicronautTest, Junit5, and Testcontainers.
To set up my testing environment, I've created an initialization script that restores a database with all the required data and the stored procedure. I've made sure that this script is executed before any test method runs. However, every time I attempt to test a method that calls the stored procedure, the test fails, consistently giving me the same error: "Could not find stored procedure"
I've gone through several troubleshooting steps to try and resolve this issue:
Verified that the database restoration script is executed before the first method call.
Attempted to connect to the database inside the Docker container to confirm that everything is restored correctly and that the stored procedure exists.
As a further experiment, I ran my application directly on the test container, and to my surprise, I encountered no issues. The stored procedure was found, and my methods executed without any errors.
Relevant log output
Caused by: org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call foo.bar(?)}]; SQL state [S0062]; error code [2812]; Could not find stored procedure 'foo.bar'.
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1581)
Module
MSSQLServer
Testcontainers version
latest
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host Arch
x86
Docker version
What happened?
I've encountered a bug while working on my Micronaut application. This application needs to connect to an MSSQL Server (jdbc) and execute a stored procedures. The problem occurs specifically during testing when I'm using MicronautTest, Junit5, and Testcontainers.
To set up my testing environment, I've created an initialization script that restores a database with all the required data and the stored procedure. I've made sure that this script is executed before any test method runs. However, every time I attempt to test a method that calls the stored procedure, the test fails, consistently giving me the same error: "Could not find stored procedure"
I've gone through several troubleshooting steps to try and resolve this issue:
Verified that the database restoration script is executed before the first method call. Attempted to connect to the database inside the Docker container to confirm that everything is restored correctly and that the stored procedure exists. As a further experiment, I ran my application directly on the test container, and to my surprise, I encountered no issues. The stored procedure was found, and my methods executed without any errors.
Relevant log output
Additional Information
No response