Skip to content

Commit

Permalink
Add container logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzegorz Kołakowski committed Nov 22, 2023
1 parent f7dc31a commit c79b2cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.apache.flink.connector.jdbc.testutils.DatabaseExtension;
import org.apache.flink.connector.jdbc.testutils.DatabaseMetadata;
import org.apache.flink.util.FlinkRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.elasticsearch.ElasticsearchContainer;

Expand All @@ -35,13 +38,13 @@
*/
public class ElasticsearchDatabase extends DatabaseExtension implements ElasticsearchImages {

private static final ElasticsearchContainer CONTAINER =
new ElasticsearchContainer(ELASTICSEARCH_8)
.waitingFor(
Wait.forHttp("/_license")
.withBasicCredentials(USERNAME, PASSWORD)
.withReadTimeout(Duration.ofSeconds(5))
.withStartupTimeout(Duration.ofMinutes(15)));
private static final Logger LOGGER = LoggerFactory.getLogger(ElasticsearchDatabase.class);
private static final ElasticsearchContainer CONTAINER = new ElasticsearchContainer(ELASTICSEARCH_8)
.waitingFor(
Wait.forHttp("/_license")
.withBasicCredentials(USERNAME, PASSWORD)
.withStartupTimeout(Duration.ofMinutes(5)))
.withLogConsumer(new Slf4jLogConsumer(LOGGER));

private static ElasticsearchMetadata metadata;
private static ElasticsearchRestClient client;
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
</encoder>
</appender>

<root level="ERROR">
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>

<logger name="org.apache.flink" level="ERROR"/>
<logger name="org.testcontainers" level="DEBUG"/>
<!-- The following logger can be used for containers logs since 1.18.0 -->
<logger name="tc" level="INFO"/>
Expand Down

0 comments on commit c79b2cc

Please sign in to comment.