Copilot commented on code in PR #24410:
URL: https://github.com/apache/camel/pull/24410#discussion_r3521841312


##########
components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/SqlFunctionDataSourceTest.java:
##########
@@ -61,12 +62,28 @@ public class SqlFunctionDataSourceTest extends 
CamelTestSupport {
     private static JdbcTemplate jdbcTemplate;
     private TemplateParser templateParser;
 
+    /**
+     * MariaDB startup timeout in milliseconds. The default 30s in MariaDB4j 
is too short for CI environments under
+     * load, where InnoDB initialization can take longer. 120s provides a 
comfortable margin.
+     */
+    private static final int MARIADB_START_TIMEOUT_MS = 120_000;
+
     /** Initialize the shared MariaDB database for the tests. */
     private static void initSharedMariaDb() throws Exception {
         DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder();
         config.setPort(0);
-        sharedMariaDb = DB.newEmbeddedDB(config.build());
-        sharedMariaDb.start();
+        DB db = DB.newEmbeddedDB(config.build());
+
+        // Increase the startup timeout from the default 30s — CI machines 
under load
+        // may need more time for InnoDB initialization before "ready for 
connections"
+        Field timeoutField = DB.class.getDeclaredField("dbStartMaxWaitInMS");
+        timeoutField.setAccessible(true);
+        timeoutField.setInt(db, MARIADB_START_TIMEOUT_MS);
+
+        db.start();
+        // Only assign to static field after successful start, so that 
surefire retries
+        // will re-attempt initialization if start() fails
+        sharedMariaDb = db;

Review Comment:
   `sharedMariaDb` is used as the sentinel for “shared DB fully initialized” in 
`doPreSetup()`, but it’s assigned immediately after `db.start()` and before the 
DataSource is fully configured and the schema script is executed. If schema 
initialization fails (e.g., transient connection issues right after startup), 
`sharedMariaDb` will remain non-null and surefire retries will incorrectly skip 
`initSharedMariaDb()`, reintroducing the same cascading failure mode this PR is 
trying to fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to