Skip to content

Commit 15b4043

Browse files
authored
Merge pull request #546 from zhicwu/develop
Fix build break and add 19.14 in regression
2 parents f30549c + 24369d4 commit 15b4043

5 files changed

Lines changed: 71 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
matrix:
2626
java: [8, 9, 11]
2727
# most recent LTS releases and latest stable build
28-
clickhouse: ["20.3", "20.8", "latest"]
28+
clickhouse: ["19.14", "20.3", "20.8", "latest"]
2929
name: Build using JDK ${{ matrix.java }} against ClickHouse ${{ matrix.clickhouse }}
3030
steps:
3131
- name: Check out Git repository
@@ -34,5 +34,13 @@ jobs:
3434
uses: actions/setup-java@v1
3535
with:
3636
java-version: ${{ matrix.java }}
37+
# Step that does that actual cache save and restore
38+
- name: Cache maven dependencies
39+
uses: actions/cache@v2
40+
with:
41+
path: ~/.m2/repository
42+
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
43+
restore-keys: |
44+
${{ runner.os }}-build-
3745
- name: Build with Maven
3846
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ matrix.clickhouse }} verify

.github/workflows/verify.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Verify
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
clickhouse:
7+
description: "ClickHouse version"
8+
required: true
9+
default: "latest"
10+
java:
11+
description: "Java version"
12+
required: true
13+
default: "8"
14+
pr:
15+
description: "Pull request#"
16+
required: false
17+
18+
jobs:
19+
verify:
20+
runs-on: ubuntu-latest
21+
name: Verify branch/PR using JDK ${{ github.event.inputs.java }} against ClickHouse ${{ github.event.inputs.clickhouse }}
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v2
25+
if: github.event.inputs.pr == ''
26+
- name: Check out PR ${{ github.event.inputs.pr }}
27+
uses: actions/checkout@v2
28+
if: github.event.inputs.pr != ''
29+
with:
30+
ref: refs/remotes/pull/${{ github.event.inputs.pr }}/merge
31+
- name: Set up JDK ${{ github.event.inputs.java }}
32+
uses: actions/setup-java@v1
33+
with:
34+
java-version: ${{ github.event.inputs.java }}
35+
- name: Verify with Maven
36+
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ github.event.inputs.clickhouse }} verify

src/test/java/ru/yandex/clickhouse/ClickHouseContainerForTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.testng.annotations.BeforeSuite;
55

66
import ru.yandex.clickhouse.settings.ClickHouseProperties;
7+
import ru.yandex.clickhouse.util.ClickHouseVersionNumberUtil;
78

89
import java.time.Duration;
910

@@ -17,13 +18,19 @@ public class ClickHouseContainerForTest {
1718
private static final int NATIVE_PORT = 9000;
1819
private static final int MYSQL_PORT = 3306;
1920

21+
private static final String clickhouseVersion;
2022
private static final GenericContainer<?> clickhouseContainer;
2123

2224
static {
2325
String imageTag = System.getProperty("clickhouseVersion");
2426
if (imageTag == null || (imageTag = imageTag.trim()).isEmpty()) {
25-
imageTag = "";
27+
clickhouseVersion = imageTag = "";
2628
} else {
29+
if (ClickHouseVersionNumberUtil.getMajorVersion(imageTag) == 0) {
30+
clickhouseVersion = "";
31+
} else {
32+
clickhouseVersion = imageTag;
33+
}
2734
imageTag = ":" + imageTag;
2835
}
2936

@@ -33,6 +40,10 @@ public class ClickHouseContainerForTest {
3340
.withExposedPorts(HTTP_PORT, NATIVE_PORT, MYSQL_PORT);
3441
}
3542

43+
public static String getClickHouseVersion() {
44+
return clickhouseVersion;
45+
}
46+
3647
public static GenericContainer<?> getClickHouseContainer() {
3748
return clickhouseContainer;
3849
}

src/test/java/ru/yandex/clickhouse/integration/ErrorsTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import ru.yandex.clickhouse.ClickHouseContainerForTest;
88
import ru.yandex.clickhouse.except.ClickHouseException;
99
import ru.yandex.clickhouse.settings.ClickHouseProperties;
10+
import ru.yandex.clickhouse.util.ClickHouseVersionNumberUtil;
1011

1112
import javax.sql.DataSource;
1213

@@ -27,7 +28,12 @@ public void testWrongUser() {
2728
try {
2829
Connection connection = dataSource.getConnection();
2930
} catch (Exception e) {
30-
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 516);
31+
String version = ClickHouseContainerForTest.getClickHouseVersion();
32+
if (!version.isEmpty() && ClickHouseVersionNumberUtil.getMajorVersion(version) <= 19) {
33+
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 192);
34+
} else {
35+
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 516);
36+
}
3137
return;
3238
}
3339
Assert.assertTrue(false, "didn' find correct error");
@@ -58,7 +64,8 @@ public void testErrorDecompression() throws Exception {
5864
try {
5965
statement.executeBatch();
6066
} catch (Exception e) {
61-
Assert.assertTrue(getClickhouseException(e).getMessage().startsWith("ClickHouse exception, code: 60, host: " + address[0] +", port: " + address[1] +"; Code: 60, e.displayText() = DB::Exception: Table test.table_not_exists doesn't exist."));
67+
String exceptionMsg = getClickhouseException(e).getMessage();
68+
Assert.assertTrue(exceptionMsg.startsWith("ClickHouse exception, code: 60, host: " + address[0] +", port: " + address[1] +"; Code: 60, e.displayText() = DB::Exception: Table test.table_not_exists doesn't exist"), exceptionMsg);
6269
return;
6370
}
6471
Assert.assertTrue(false, "didn' find correct error");

src/test/java/ru/yandex/clickhouse/integration/NativeStreamTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public void testLowCardinality() throws Exception{
3636
"CREATE TABLE test.low_cardinality (date Date, lowCardinality LowCardinality(String), string String) ENGINE = MergeTree(date, (date), 8192)"
3737
);
3838

39+
// Code: 368, e.displayText() = DB::Exception: Bad cast from type DB::ColumnString to DB::ColumnLowCardinality
40+
if (connection.getMetaData().getDatabaseMajorVersion() <= 19) {
41+
return;
42+
}
43+
3944
final Date date1 = new Date(1497474018000L);
4045

4146
statement.sendNativeStream(

0 commit comments

Comments
 (0)