Skip to content

Commit

Permalink
Add ClickHouse smoke tests for Altinity
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Jan 19, 2022
1 parent b630d5b commit 5c07a26
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/main/sphinx/connector/clickhouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Requirements

To connect to a ClickHouse server, you need:

* ClickHouse version 20.8 or higher.
* ClickHouse (version 20.8 or higher) or Altinity (version 20.3 or higher).
* Network access from the Trino coordinator and workers to the ClickHouse
server. Port 8123 is the default port.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.clickhouse;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.QueryRunner;

import static io.trino.plugin.clickhouse.ClickHouseQueryRunner.createClickHouseQueryRunner;
import static io.trino.plugin.clickhouse.TestingClickHouseServer.ALTINITY_DEFAULT_IMAGE;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestAltinityConnectorSmokeTest
extends BaseClickHouseConnectorSmokeTest
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return createClickHouseQueryRunner(
closeAfterClass(new TestingClickHouseServer(ALTINITY_DEFAULT_IMAGE)),
ImmutableMap.of(),
ImmutableMap.<String, String>builder()
.put("clickhouse.map-string-as-varchar", "true") // To handle string types in TPCH tables as varchar instead of varbinary
.buildOrThrow(),
REQUIRED_TPCH_TABLES);
}

@Override
public void testRenameSchema()
{
// Override because RENAME DATABASE statement isn't supported in version < v20.7.2.30-stable
assertThatThrownBy(super::testRenameSchema)
.hasMessageMatching("ClickHouse exception, code: 62,.* Syntax error.*\\n");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.clickhouse;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.QueryRunner;

import static io.trino.plugin.clickhouse.ClickHouseQueryRunner.createClickHouseQueryRunner;
import static io.trino.plugin.clickhouse.TestingClickHouseServer.ALTINITY_LATEST_IMAGE;

public class TestAltinityLatestConnectorSmokeTest
extends BaseClickHouseConnectorSmokeTest
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return createClickHouseQueryRunner(
closeAfterClass(new TestingClickHouseServer(ALTINITY_LATEST_IMAGE)),
ImmutableMap.of(),
ImmutableMap.<String, String>builder()
.put("clickhouse.map-string-as-varchar", "true") // To handle string types in TPCH tables as varchar instead of varbinary
.buildOrThrow(),
REQUIRED_TPCH_TABLES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class TestingClickHouseServer
private static final DockerImageName CLICKHOUSE_IMAGE = DockerImageName.parse("yandex/clickhouse-server");
public static final DockerImageName CLICKHOUSE_LATEST_IMAGE = CLICKHOUSE_IMAGE.withTag("21.11.10.1");
public static final DockerImageName CLICKHOUSE_DEFAULT_IMAGE = CLICKHOUSE_IMAGE.withTag("20.8");

// Altinity Stable Builds Life-Cycle Table https://docs.altinity.com/altinitystablebuilds/#altinity-stable-builds-life-cycle-table
private static final DockerImageName ALTINITY_IMAGE = DockerImageName.parse("altinity/clickhouse-server").asCompatibleSubstituteFor("yandex/clickhouse-server");
public static final DockerImageName ALTINITY_LATEST_IMAGE = ALTINITY_IMAGE.withTag("21.8.13.1.altinitystable");
public static final DockerImageName ALTINITY_DEFAULT_IMAGE = ALTINITY_IMAGE.withTag("20.3.12-aes"); // EOL is 24 June 2022

private final ClickHouseContainer dockerContainer;

public TestingClickHouseServer()
Expand Down

0 comments on commit 5c07a26

Please sign in to comment.