Skip to content

Commit dff63a5

Browse files
committed
test(schema-compiler): Rework TEST_CLICKHOUSE_HOST handling
1 parent 39eeccf commit dff63a5

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

packages/cubejs-schema-compiler/test/integration/clickhouse/ClickHouseDbRunner.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,24 @@ export class ClickHouseDbRunner extends BaseDbRunner {
103103
};
104104

105105
testQueries = async (queries, prepareDataSet) => {
106-
if (!this.container && !process.env.TEST_CLICKHOUSE_HOST) {
107-
this.container = await new GenericContainer(`clickhouse/clickhouse-server:${this.clickHouseVersion}`)
108-
.withExposedPorts(this.port())
109-
.start();
106+
let host;
107+
let port;
108+
if (process.env.TEST_CLICKHOUSE_HOST) {
109+
host = process.env.TEST_CLICKHOUSE_HOST;
110+
port = 8123;
111+
} else {
112+
if (!this.container) {
113+
this.container = await new GenericContainer(`clickhouse/clickhouse-server:${this.clickHouseVersion}`)
114+
.withExposedPorts(this.port())
115+
.start();
116+
}
117+
host = 'localhost';
118+
port = this.container.getMappedPort(8123);
110119
}
111120

112121
const clickHouse = new ClickHouse({
113-
host: 'localhost',
114-
port: process.env.TEST_CLICKHOUSE_HOST ? 8123 : this.container.getMappedPort(8123),
122+
host,
123+
port,
115124
});
116125

117126
clickHouse.sessionId = uuidv4(); // needed for tests to use temporary tables

0 commit comments

Comments
 (0)