From 9e8633be6c0c696befc422e645ed346d5f2480f4 Mon Sep 17 00:00:00 2001 From: monosoul Date: Thu, 3 Dec 2026 18:00:44 +0100 Subject: [PATCH 1/5] ci: raise the Cloud Tests job timeout to 30 minutes The client-v2 job took 19:56 of its 20 minutes in run 47141300065. Refs #3514 --- .github/workflows/cloud-cleanup.yml | 2 +- .github/workflows/cloud.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cloud-cleanup.yml b/.github/workflows/cloud-cleanup.yml index 603c99dc0..c74447b66 100644 --- a/.github/workflows/cloud-cleanup.yml +++ b/.github/workflows/cloud-cleanup.yml @@ -34,7 +34,7 @@ jobs: CLICKHOUSE_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT_PROD }} CLICKHOUSE_USER: default CLICKHOUSE_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT_PROD }} - # Longer than a cloud.yml job can run (timeout-minutes: 20), so a running job keeps its databases. + # Longer than a cloud.yml job can run (timeout-minutes: 30), so a running job keeps its databases. TTL_MINUTES: 60 DRY_RUN: ${{ inputs.dry_run || false }} steps: diff --git a/.github/workflows/cloud.yml b/.github/workflows/cloud.yml index 1bb8e2c43..62f5ae7bd 100644 --- a/.github/workflows/cloud.yml +++ b/.github/workflows/cloud.yml @@ -20,7 +20,8 @@ jobs: matrix: project: ["client-v2", "jdbc-v2"] fail-fast: false - timeout-minutes: 20 + # client-v2 runs about 18-20 minutes against Cloud + timeout-minutes: 30 name: ${{ matrix.project }} + ClickHouse Cloud env: TEST_CLICKHOUSE_CONTAINER: none From 1740c2d6e77a31b47269e5d836c0d01a83587ea9 Mon Sep 17 00:00:00 2001 From: monosoul Date: Thu, 3 Dec 2026 18:00:52 +0100 Subject: [PATCH 2/5] test: read the inserted rows on Cloud with select_sequential_consistency On ClickHouse Cloud each request can go to another replica, and that replica can answer before it has the rows that the test just inserted: jdbc-v2 JdbcDataTypeTests and WriterStatementImplTest, client-v2 ParameterizedQueryTest and DataTypeTests fail with an empty result, different tests in each run. Set select_sequential_consistency=1 on Cloud, as the v1 tests and the clickhouse-js Cloud tests do: in JdbcIntegrationTest.getJdbcConnection and in the client builders of QueryTests, ParameterizedQueryTest and DataTypeTests. Nothing changes outside Cloud. Refs #3514 --- .../com/clickhouse/client/BaseIntegrationTest.java | 11 +++++++++++ .../com/clickhouse/client/ParameterizedQueryTest.java | 4 +++- .../clickhouse/client/datatypes/DataTypeTests.java | 4 +++- .../java/com/clickhouse/client/query/QueryTests.java | 4 +++- .../java/com/clickhouse/jdbc/JdbcIntegrationTest.java | 1 + 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/clickhouse-client/src/test/java/com/clickhouse/client/BaseIntegrationTest.java b/clickhouse-client/src/test/java/com/clickhouse/client/BaseIntegrationTest.java index ea98fee96..cb58de4bd 100644 --- a/clickhouse-client/src/test/java/com/clickhouse/client/BaseIntegrationTest.java +++ b/clickhouse-client/src/test/java/com/clickhouse/client/BaseIntegrationTest.java @@ -6,6 +6,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.Collections; import java.util.Locale; import java.util.Map; @@ -62,6 +63,16 @@ protected boolean isCloud() { return ClickHouseServerForTest.isCloud(); } + /** + * Server settings that make a query see the inserts of earlier requests. On ClickHouse Cloud, each + * request can go to another replica, and that replica can answer before it has the new data. + * Empty outside ClickHouse Cloud: there, the cluster test environment waits for every replica + * on insert ({@code insert_quorum}). + */ + protected Map readYourWritesSettings() { + return isCloud() ? Collections.singletonMap("select_sequential_consistency", "1") : Collections.emptyMap(); + } + protected String getConnectionProtocol() { if (isCloud()) { return "https"; diff --git a/client-v2/src/test/java/com/clickhouse/client/ParameterizedQueryTest.java b/client-v2/src/test/java/com/clickhouse/client/ParameterizedQueryTest.java index cac85da33..2386a0dbf 100644 --- a/client-v2/src/test/java/com/clickhouse/client/ParameterizedQueryTest.java +++ b/client-v2/src/test/java/com/clickhouse/client/ParameterizedQueryTest.java @@ -275,7 +275,7 @@ private int[] queryInstant(String tableName, String fieldName, String operator, private Client.Builder newClient() { ClickHouseNode node = getServer(ClickHouseProtocol.HTTP); boolean isSecure = isCloud(); - return new Client.Builder() + Client.Builder builder = new Client.Builder() .addEndpoint(Protocol.HTTP, node.getHost(), node.getPort(), isSecure) .setUsername("default") .setPassword(ClickHouseServerForTest.getPassword()) @@ -283,6 +283,8 @@ private Client.Builder newClient() { .setDefaultDatabase(ClickHouseServerForTest.getDatabase()) .serverSetting(ServerSettings.WAIT_ASYNC_INSERT, "1") .serverSetting(ServerSettings.ASYNC_INSERT, "0"); + readYourWritesSettings().forEach(builder::serverSetting); + return builder; } private void prepareDataSet(String table, List columns, List> valueGenerators, diff --git a/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java b/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java index 4f68d2cb5..f49d28477 100644 --- a/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java @@ -3684,7 +3684,7 @@ private boolean isVersionMatch(String versionExpression) { private Client.Builder newClient() { ClickHouseNode node = getServer(ClickHouseProtocol.HTTP); - return new Client.Builder() + Client.Builder builder = new Client.Builder() .addEndpoint(Protocol.HTTP, node.getHost(), node.getPort(), isCloud()) .setUsername("default") .setPassword(ClickHouseServerForTest.getPassword()) @@ -3693,5 +3693,7 @@ private Client.Builder newClient() { .useHttpCompression(useHttpCompression) .serverSetting(ServerSettings.WAIT_END_OF_QUERY, "1") .serverSetting(ServerSettings.WAIT_ASYNC_INSERT, "1"); + readYourWritesSettings().forEach(builder::serverSetting); + return builder; } } diff --git a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java index 3d48ceeb5..d59e47d8a 100644 --- a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java @@ -2273,7 +2273,7 @@ public void testGetColumnsByIndex() throws Exception { protected Client.Builder newClient() { ClickHouseNode node = getServer(ClickHouseProtocol.HTTP); boolean isSecure = isCloud(); - return new Client.Builder() + Client.Builder builder = new Client.Builder() .addEndpoint(Protocol.HTTP, node.getHost(), node.getPort(), isSecure) .setUsername("default") .setPassword(ClickHouseServerForTest.getPassword()) @@ -2284,6 +2284,8 @@ protected Client.Builder newClient() { .setDefaultDatabase(ClickHouseServerForTest.getDatabase()) .serverSetting(ServerSettings.WAIT_ASYNC_INSERT, "1") .serverSetting(ServerSettings.ASYNC_INSERT, "0"); + readYourWritesSettings().forEach(builder::serverSetting); + return builder; } @Test(groups = {"integration"}) diff --git a/jdbc-v2/src/test/java/com/clickhouse/jdbc/JdbcIntegrationTest.java b/jdbc-v2/src/test/java/com/clickhouse/jdbc/JdbcIntegrationTest.java index 7b66a95fb..d5577a8c0 100644 --- a/jdbc-v2/src/test/java/com/clickhouse/jdbc/JdbcIntegrationTest.java +++ b/jdbc-v2/src/test/java/com/clickhouse/jdbc/JdbcIntegrationTest.java @@ -56,6 +56,7 @@ public Connection getJdbcConnection(Properties properties) throws SQLException { } info.putIfAbsent(ClientConfigProperties.DATABASE.getKey(), getDatabase()); + readYourWritesSettings().forEach((name, value) -> info.putIfAbsent(DriverProperties.serverSetting(name), value)); return new ConnectionImpl(getEndpointString(), info); } From fd53e15647d4d1f4875ced0102c5b088b17223fc Mon Sep 17 00:00:00 2001 From: monosoul Date: Thu, 3 Dec 2026 18:01:01 +0100 Subject: [PATCH 3/5] test(client-v2): testFloatDataTypes reads precise_float_parsing from the server The test expected precise float parsing from server 26.7, the version that turns precise_float_parsing on by default. The Cloud test service has it off, so Float32 max reads back as 3.4028233E38. Ask the server for the setting instead. Refs #3514 --- .../test/java/com/clickhouse/client/query/QueryTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java index d59e47d8a..688d9733f 100644 --- a/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java @@ -1149,7 +1149,10 @@ public void testIntegerDataTypes() { @Test(groups = {"integration"}) public void testFloatDataTypes() { - final boolean usesPreciseFloatParsing = isVersionMatch("[26.7,)"); + // precise_float_parsing is on by default from 26.7, but a server can turn it off (the ClickHouse Cloud + // service of cloud.yml has it off) + final boolean usesPreciseFloatParsing = client.queryAll( + "SELECT toUInt8(getSetting('precise_float_parsing')) AS precise").get(0).getInteger("precise") == 1; final float expectedMaxFloat32 = usesPreciseFloatParsing ? Float.MAX_VALUE : 3.4028233E38F; final double expectedMinFloat64 = usesPreciseFloatParsing ? Double.MIN_VALUE : 0.0D; From faefbf678c7424bfb91b334be8d3f9e93a903143 Mon Sep 17 00:00:00 2001 From: monosoul Date: Thu, 3 Dec 2026 18:01:01 +0100 Subject: [PATCH 4/5] test(client-v2): skip testStickyReplica on Cloud The Cloud test service doesn't have replica-aware routing enabled, so X-ClickHouse-Replica-Tag doesn't pin requests to one replica there. The test still runs against the cluster environment, where nginx routes by the tag. Refs #3514 --- .../test/java/com/clickhouse/client/HttpTransportTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java b/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java index 9f939adda..de5101976 100644 --- a/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java @@ -2922,6 +2922,10 @@ private static void assertQueryWasInterrupted(Client client, String queryId) thr @Test(groups = {"integration"}) public void testStickyReplica() { + if (isCloud()) { + // https://clickhouse.com/docs/products/cloud/features/infrastructure/replica-aware-routing + throw new SkipException("Replica-aware routing is not enabled on the Cloud test service"); + } final String replicaKey = UUID.randomUUID().toString(); QuerySettings stickyReplica = new QuerySettings().httpHeader(ClickHouseHttpProto.HEADER_REPLICA_TAG, replicaKey); From ac5f5652f71dd623ce0d0d94ec8c30681a4247d4 Mon Sep 17 00:00:00 2001 From: monosoul Date: Fri, 4 Dec 2026 14:25:38 +0100 Subject: [PATCH 5/5] test(client-v2): DataTypeTests shared client gets the Cloud read setting setUp built the shared client with its own builder, without readYourWritesSettings(), so most DataTypeTests read without select_sequential_consistency on Cloud. Build it with newClient(), which now takes the user from the test environment as setUp did. Refs #3514 --- .../clickhouse/client/datatypes/DataTypeTests.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java b/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java index f49d28477..38f7d63a3 100644 --- a/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java +++ b/client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java @@ -84,17 +84,7 @@ public DataTypeTests() { @BeforeMethod(groups = {"integration"}) public void setUp() throws IOException { - ClickHouseNode node = getServer(ClickHouseProtocol.HTTP); - client = new Client.Builder() - .addEndpoint(Protocol.HTTP, node.getHost(), node.getPort(), isCloud()) - .setUsername(ClickHouseServerForTest.getUsername()) - .setPassword(ClickHouseServerForTest.getPassword()) - .setDefaultDatabase(ClickHouseServerForTest.getDatabase()) - .compressClientRequest(useClientCompression) - .useHttpCompression(useHttpCompression) - .serverSetting(ServerSettings.WAIT_END_OF_QUERY, "1") - .serverSetting(ServerSettings.WAIT_ASYNC_INSERT, "1") - .build(); + client = newClient().build(); } @AfterMethod(groups = {"integration"}) @@ -3686,7 +3676,7 @@ private Client.Builder newClient() { ClickHouseNode node = getServer(ClickHouseProtocol.HTTP); Client.Builder builder = new Client.Builder() .addEndpoint(Protocol.HTTP, node.getHost(), node.getPort(), isCloud()) - .setUsername("default") + .setUsername(ClickHouseServerForTest.getUsername()) .setPassword(ClickHouseServerForTest.getPassword()) .setDefaultDatabase(ClickHouseServerForTest.getDatabase()) .compressClientRequest(useClientCompression)