Skip to content

Commit 63e9da7

Browse files
committed
Adjust cloud config
1 parent 8357c3d commit 63e9da7

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

flink-connector-clickhouse-base/src/test/java/org/apache/flink/connector/test/embedded/clickhouse/ClickHouseServerForTests.java

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ public class ClickHouseServerForTests {
3030

3131
public static void initConfiguration() {
3232
if (isCloud) {
33+
LOG.info("Init ClickHouse Cloud Configuration");
3334
host = System.getenv("CLICKHOUSE_CLOUD_HOST");
3435
port = Integer.parseInt(ClickHouseTestHelpers.HTTPS_PORT);
35-
database = System.getenv("CLICKHOUSE_DATABASE");
36+
database = String.format("flink_connector_test_%s", System.currentTimeMillis());
3637
username = System.getenv("CLICKHOUSE_USERNAME");
37-
password = System.getenv("CLICKHOUSE_CLOUD_HOST");
38+
password = System.getenv("CLICKHOUSE_CLOUD_PASSWORD");
3839
} else {
40+
LOG.info("Init ClickHouse Docker Configuration");
3941
host = db.getHost();
4042
port = db.getFirstMappedPort();
4143
database = ClickHouseTestHelpers.DATABASE_DEFAULT;
@@ -45,27 +47,22 @@ public static void initConfiguration() {
4547
isSSL = ClickHouseTestHelpers.isCloud();
4648
}
4749
public static void setUp() throws InterruptedException {
48-
if (database == null) {
49-
database = String.format("flink_connector_test_%s", System.currentTimeMillis());
50-
}
5150
if (!isCloud) {
5251
db = new ClickHouseContainer(ClickHouseTestHelpers.CLICKHOUSE_DOCKER_IMAGE).withPassword("test_password").withEnv("CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT", "1");
5352
db.start();
5453
}
5554
initConfiguration();
56-
if (isCloud) {
57-
// wakeup cloud
58-
// have a for loop
59-
boolean isLive = false;
60-
int counter = 0;
61-
while (counter < 5) {
62-
isLive = ClickHouseTestHelpers.ping(isCloud, host, port, isSSL, username, password);
63-
if (isLive) return;
64-
Thread.sleep(2000);
65-
counter++;
66-
}
67-
throw new RuntimeException("Failed to connect to ClickHouse");
55+
// wakeup cloud
56+
// have a for loop
57+
boolean isLive = false;
58+
int counter = 0;
59+
while (counter < 5) {
60+
isLive = ClickHouseTestHelpers.ping(isCloud, host, port, isSSL, username, password);
61+
if (isLive) return;
62+
Thread.sleep(2000);
63+
counter++;
6864
}
65+
throw new RuntimeException("Failed to connect to ClickHouse");
6966
}
7067

7168
public static void tearDown() {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Define the root logger with appender X
2+
log4j.rootLogger=INFO, console
3+
#log4j.logger.org.testcontainers=WARN
4+
log4j.logger.com.clickhouse.kafka=DEBUG
5+
6+
log4j.appender.console= org.apache.log4j.ConsoleAppender
7+
log4j.appender.console.layout=org.apache.log4j.PatternLayout
8+
log4j.appender.console.layout.conversionPattern=[%d] %p %C %m%n

0 commit comments

Comments
 (0)