Poorvankbhatia commented on code in PR #37:
URL:
https://github.com/apache/flink-connector-cassandra/pull/37#discussion_r2328693893
##########
flink-connector-cassandra/src/test/java/org/apache/flink/connector/cassandra/CassandraTestEnvironment.java:
##########
@@ -118,39 +139,46 @@ public void tearDown() throws Exception {
stopEnv();
}
- private static void addJavaOpts(GenericContainer<?> container, String...
opts) {
- String jvmOpts = container.getEnvMap().getOrDefault("JVM_OPTS", "");
- container.withEnv("JVM_OPTS", jvmOpts + " " + StringUtils.join(opts, "
"));
- }
-
private void startEnv() throws Exception {
// configure container start to wait until cassandra is ready to
receive queries
- cassandraContainer.waitingFor(new CassandraQueryWaitStrategy());
// start with retrials
- cassandraContainer.start();
- cassandraContainer.followOutput(
+ cassandraContainer1.waitingFor(
+ Wait.forLogMessage(".*Startup complete.*", 1)
+ .withStartupTimeout(Duration.ofMinutes(2)));
+ cassandraContainer1.start();
+ cassandraContainer1.followOutput(
new Slf4jLogConsumer(LOG),
OutputFrame.OutputType.END,
OutputFrame.OutputType.STDERR,
OutputFrame.OutputType.STDOUT);
- cluster = cassandraContainer.getCluster();
+ cassandraContainer2.waitingFor(
+ Wait.forLogMessage(".*Startup complete.*", 1)
+ .withStartupTimeout(Duration.ofMinutes(2)));
+ cassandraContainer2.start();
Review Comment:
[Startables.deepStart(cassandraContainer1, cassandraContainer2).join();
](https://java.testcontainers.org/features/advanced_options/#:~:text=created%20by%20Testcontainers.-,Parallel%20Container%20Startup,-Usually%2C%20containers%20are)
Can we use this instead ?
##########
flink-connector-cassandra/src/test/java/org/apache/flink/connector/cassandra/CassandraTestEnvironment.java:
##########
@@ -118,39 +139,46 @@ public void tearDown() throws Exception {
stopEnv();
}
- private static void addJavaOpts(GenericContainer<?> container, String...
opts) {
- String jvmOpts = container.getEnvMap().getOrDefault("JVM_OPTS", "");
- container.withEnv("JVM_OPTS", jvmOpts + " " + StringUtils.join(opts, "
"));
- }
-
private void startEnv() throws Exception {
// configure container start to wait until cassandra is ready to
receive queries
- cassandraContainer.waitingFor(new CassandraQueryWaitStrategy());
// start with retrials
- cassandraContainer.start();
- cassandraContainer.followOutput(
+ cassandraContainer1.waitingFor(
+ Wait.forLogMessage(".*Startup complete.*", 1)
Review Comment:
Can we use CassandraQueryWaitStrategy instead? The log line “Startup
complete” for cassandraContainer1/2 can drift across images. (So the container
is marked started only after that query succeeds)
--
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]