Skip to content

Commit

Permalink
Merge pull request #546 from zhicwu/develop
Browse files Browse the repository at this point in the history
Fix build break and add 19.14 in regression
  • Loading branch information
zhicwu authored Jan 20, 2021
2 parents f30549c + 24369d4 commit 15b4043
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
java: [8, 9, 11]
# most recent LTS releases and latest stable build
clickhouse: ["20.3", "20.8", "latest"]
clickhouse: ["19.14", "20.3", "20.8", "latest"]
name: Build using JDK ${{ matrix.java }} against ClickHouse ${{ matrix.clickhouse }}
steps:
- name: Check out Git repository
Expand All @@ -34,5 +34,13 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# Step that does that actual cache save and restore
- name: Cache maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-
- name: Build with Maven
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ matrix.clickhouse }} verify
36 changes: 36 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Verify

on:
workflow_dispatch:
inputs:
clickhouse:
description: "ClickHouse version"
required: true
default: "latest"
java:
description: "Java version"
required: true
default: "8"
pr:
description: "Pull request#"
required: false

jobs:
verify:
runs-on: ubuntu-latest
name: Verify branch/PR using JDK ${{ github.event.inputs.java }} against ClickHouse ${{ github.event.inputs.clickhouse }}
steps:
- name: Check out repository
uses: actions/checkout@v2
if: github.event.inputs.pr == ''
- name: Check out PR ${{ github.event.inputs.pr }}
uses: actions/checkout@v2
if: github.event.inputs.pr != ''
with:
ref: refs/remotes/pull/${{ github.event.inputs.pr }}/merge
- name: Set up JDK ${{ github.event.inputs.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ github.event.inputs.java }}
- name: Verify with Maven
run: mvn --batch-mode --update-snapshots -DclickhouseVersion=${{ github.event.inputs.clickhouse }} verify
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.testng.annotations.BeforeSuite;

import ru.yandex.clickhouse.settings.ClickHouseProperties;
import ru.yandex.clickhouse.util.ClickHouseVersionNumberUtil;

import java.time.Duration;

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

private static final String clickhouseVersion;
private static final GenericContainer<?> clickhouseContainer;

static {
String imageTag = System.getProperty("clickhouseVersion");
if (imageTag == null || (imageTag = imageTag.trim()).isEmpty()) {
imageTag = "";
clickhouseVersion = imageTag = "";
} else {
if (ClickHouseVersionNumberUtil.getMajorVersion(imageTag) == 0) {
clickhouseVersion = "";
} else {
clickhouseVersion = imageTag;
}
imageTag = ":" + imageTag;
}

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

public static String getClickHouseVersion() {
return clickhouseVersion;
}

public static GenericContainer<?> getClickHouseContainer() {
return clickhouseContainer;
}
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/ru/yandex/clickhouse/integration/ErrorsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ru.yandex.clickhouse.ClickHouseContainerForTest;
import ru.yandex.clickhouse.except.ClickHouseException;
import ru.yandex.clickhouse.settings.ClickHouseProperties;
import ru.yandex.clickhouse.util.ClickHouseVersionNumberUtil;

import javax.sql.DataSource;

Expand All @@ -27,7 +28,12 @@ public void testWrongUser() {
try {
Connection connection = dataSource.getConnection();
} catch (Exception e) {
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 516);
String version = ClickHouseContainerForTest.getClickHouseVersion();
if (!version.isEmpty() && ClickHouseVersionNumberUtil.getMajorVersion(version) <= 19) {
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 192);
} else {
Assert.assertEquals((getClickhouseException(e)).getErrorCode(), 516);
}
return;
}
Assert.assertTrue(false, "didn' find correct error");
Expand Down Expand Up @@ -58,7 +64,8 @@ public void testErrorDecompression() throws Exception {
try {
statement.executeBatch();
} catch (Exception e) {
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."));
String exceptionMsg = getClickhouseException(e).getMessage();
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);
return;
}
Assert.assertTrue(false, "didn' find correct error");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public void testLowCardinality() throws Exception{
"CREATE TABLE test.low_cardinality (date Date, lowCardinality LowCardinality(String), string String) ENGINE = MergeTree(date, (date), 8192)"
);

// Code: 368, e.displayText() = DB::Exception: Bad cast from type DB::ColumnString to DB::ColumnLowCardinality
if (connection.getMetaData().getDatabaseMajorVersion() <= 19) {
return;
}

final Date date1 = new Date(1497474018000L);

statement.sendNativeStream(
Expand Down

0 comments on commit 15b4043

Please sign in to comment.