gnodet commented on code in PR #24410:
URL: https://github.com/apache/camel/pull/24410#discussion_r3522731163
##########
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:
Good catch. Moved `sharedMariaDb` and `sharedDataSource` assignment to after
all initialization steps complete (start, DataSource creation, schema
population). Now if any step fails, retries will re-attempt the full
`initSharedMariaDb()` flow.
--
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]