Skip to content

Commit 22ceec1

Browse files
committed
Fix failed test cases and add 19.14 in regression
1 parent 4f2c85e commit 22ceec1

4 files changed

Lines changed: 30 additions & 10 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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ on:
44
workflow_dispatch:
55
inputs:
66
clickhouse:
7-
description: "ClickHouse Version"
7+
description: "ClickHouse version"
88
required: true
99
default: "latest"
1010
java:
11-
description: "Java Version"
11+
description: "Java version"
1212
required: true
1313
default: "8"
1414
pr:
15-
description: "Pull Request#"
15+
description: "Pull request#"
1616
required: false
1717

1818
jobs:
1919
verify:
2020
runs-on: ubuntu-latest
21-
name: Verify pull request \#${{ github.event.inputs.pr }} using JDK ${{ github.event.inputs.java }} against ClickHouse ${{ github.event.inputs.clickhouse }}
21+
name: Verify branch/PR using JDK ${{ github.event.inputs.java }} against ClickHouse ${{ github.event.inputs.clickhouse }}
2222
steps:
2323
- name: Check out repository
2424
uses: actions/checkout@v2
2525
if: github.event.inputs.pr == ''
26-
- name: Check out pull request \#${{ github.event.inputs.pr }}
26+
- name: Check out PR ${{ github.event.inputs.pr }}
2727
uses: actions/checkout@v2
2828
if: github.event.inputs.pr != ''
2929
with:
@@ -32,5 +32,5 @@ jobs:
3232
uses: actions/setup-java@v1
3333
with:
3434
java-version: ${{ github.event.inputs.java }}
35-
- name: Build with Maven
36-
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ matrix.clickhouse }} verify
35+
- name: Verify with Maven
36+
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ github.event.inputs.clickhouse }} verify

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)