Skip to content

Commit bd8f183

Browse files
authored
Fix CI, examples, bump CH to 25.8 (#456)
1 parent 0d30dc2 commit bd8f183

File tree

20 files changed

+116
-115
lines changed

20 files changed

+116
-115
lines changed

.docker/clickhouse/single_node_tls/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM clickhouse/clickhouse-server:25.7-alpine
1+
FROM clickhouse/clickhouse-server:25.8-alpine
22
COPY .docker/clickhouse/single_node_tls/certificates /etc/clickhouse-server/certs
33
RUN chown clickhouse:clickhouse -R /etc/clickhouse-server/certs \
44
&& chmod 600 /etc/clickhouse-server/certs/* \

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
run: |
194194
npm run test:web:integration:local_cluster
195195
196-
node-integration-tests-cloud-smt:
196+
node-integration-tests-cloud:
197197
needs: node-unit-tests
198198
runs-on: ubuntu-latest
199199
strategy:
@@ -219,9 +219,9 @@ jobs:
219219
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
220220
CLICKHOUSE_CLOUD_JWT_ACCESS_TOKEN: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43 }}
221221
run: |
222-
npm run test:node:integration:cloud_smt
222+
npm run test:node:integration:cloud
223223
224-
web-integration-tests-cloud-smt:
224+
web-integration-tests-cloud:
225225
needs: node-unit-tests
226226
runs-on: ubuntu-latest
227227
steps:
@@ -241,15 +241,15 @@ jobs:
241241
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
242242
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
243243
run: |
244-
npm run test:web:integration:cloud_smt
244+
npm run test:web:integration:cloud
245245
246246
- name: Run JWT auth integration tests
247247
env:
248248
CLICKHOUSE_CLOUD_HOST: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}
249249
CLICKHOUSE_CLOUD_PASSWORD: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}
250250
CLICKHOUSE_CLOUD_JWT_ACCESS_TOKEN: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_JWT_DESERT_VM_43 }}
251251
run: |
252-
npm run test:web:integration:cloud_smt:jwt
252+
npm run test:web:integration:cloud:jwt
253253
254254
# With unit + integration + TLS tests + coverage + Codecov.io upload, after the rest of the tests.
255255
# Needs all integration tests on all environments to pass.
@@ -259,10 +259,10 @@ jobs:
259259
[
260260
'node-integration-tests-local-single-node',
261261
'node-integration-tests-local-cluster',
262-
'node-integration-tests-cloud-smt',
262+
'node-integration-tests-cloud',
263263
'web-all-tests-local-single-node',
264264
'web-integration-tests-local-cluster',
265-
'web-integration-tests-cloud-smt',
265+
'web-integration-tests-cloud',
266266
]
267267
runs-on: ubuntu-latest
268268

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.scripts/generate_cloud_jwt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { makeJWT } from '../packages/client-node/__tests__/utils/jwt'
22

33
/** Used to generate a JWT token for web testing (can't use `jsonwebtoken` library directly there)
4-
* See `package.json` -> `scripts` -> `test:web:integration:cloud_smt:jwt` */
4+
* See `package.json` -> `scripts` -> `test:web:integration:cloud:jwt` */
55
;(() => {
66
console.log(makeJWT())
77
})()

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ See [tls.test.ts](packages/client-node/__tests__/tls/tls.test.ts) for more detai
3535
sudo -- sh -c "echo 127.0.0.1 server.clickhouseconnect.test >> /etc/hosts"
3636
```
3737

38+
### IDE setup
39+
40+
#### WebStorm
41+
42+
- Open settings
43+
- Navigate to "Languages & Frameworks" -> "Typescript"
44+
- Copy and paste `--project tsconfig.dev.json` into the options field to enable proper path resolution in tests
45+
3846
## Style Guide
3947

4048
We use an automatic code formatting with `prettier` and `eslint`, both should be installed after running `npm i`.

docker-compose.cluster.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '2.3'
22

33
services:
44
clickhouse1:
5-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.7-alpine}'
5+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.8-alpine}'
66
ulimits:
77
nofile:
88
soft: 262144
@@ -21,7 +21,7 @@ services:
2121
- './.docker/clickhouse/users.xml:/etc/clickhouse-server/users.xml'
2222

2323
clickhouse2:
24-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.7-alpine}'
24+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.8-alpine}'
2525
ulimits:
2626
nofile:
2727
soft: 262144

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#version: '3.8'
22
services:
33
clickhouse:
4-
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.7-alpine}'
4+
image: 'clickhouse/clickhouse-server:${CLICKHOUSE_VERSION-25.8-alpine}'
55
container_name: 'clickhouse-js-clickhouse-server'
66
environment:
77
CLICKHOUSE_SKIP_USER_SETUP: 1

examples/clickhouse_settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ void (async () => {
2222
* {@link ClickHouseClient.command},
2323
* or {@link ClickHouseClient.exec} operation.*/
2424
clickhouse_settings: {
25-
output_format_json_quote_64bit_integers: 0,
25+
// default is 0 since 25.8
26+
output_format_json_quote_64bit_integers: 1,
2627
},
2728
})
2829
console.info(await rows.json())

examples/dynamic_variant_json.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ import { createClient } from '@clickhouse/client' // or '@clickhouse/client-web'
33
void (async () => {
44
const tableName = `chjs_dynamic_variant_json`
55
const client = createClient({
6+
// Since 25.3, all these types are no longer experimental and are enabled by default
7+
// However, if you are using an older version of ClickHouse, you might need these settings
8+
// to be able to create tables with such columns.
69
clickhouse_settings: {
7-
// Since ClickHouse 24.1
10+
// Variant was introduced in ClickHouse 24.1
11+
// https://clickhouse.com/docs/sql-reference/data-types/variant
812
allow_experimental_variant_type: 1,
9-
// Since ClickHouse 24.5
13+
// Dynamic was introduced in ClickHouse 24.5
14+
// https://clickhouse.com/docs/sql-reference/data-types/dynamic
1015
allow_experimental_dynamic_type: 1,
11-
// Since ClickHouse 24.8
16+
// (New) JSON was introduced in ClickHouse 24.8
17+
// https://clickhouse.com/docs/sql-reference/data-types/newjson
1218
allow_experimental_json_type: 1,
1319
},
1420
})
@@ -38,9 +44,9 @@ void (async () => {
3844
{
3945
id: 2,
4046
var: 'str',
41-
// defaults to Int64; will be represented as a string in JSON* family formats
42-
// this behavior can be changed with `output_format_json_quote_64bit_integers` setting (default is 1).
43-
// see https://clickhouse.com/docs/en/operations/settings/formats#output_format_json_quote_64bit_integers
47+
// A number will default to Int64; it could be also represented as a string in JSON* family formats
48+
// using `output_format_json_quote_64bit_integers` setting (default is 0 since CH 25.8).
49+
// See https://clickhouse.com/docs/en/operations/settings/formats#output_format_json_quote_64bit_integers
4450
dynamic: 144,
4551
json: {
4652
bar: 10,

examples/session_level_commands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { createClient } from '@clickhouse/client' // or '@clickhouse/client-web'
22
import * as crypto from 'crypto' // required for Node.js only
33

4+
// Note that session will work as expected ONLY if you are accessing the Node directly.
5+
// If there is a load-balancer in front of ClickHouse nodes, the requests might end up on different nodes,
6+
// and the session will not be preserved. As a workaround for ClickHouse Cloud, you could try replica-aware routing.
7+
// See https://clickhouse.com/docs/manage/replica-aware-routing.
48
void (async () => {
59
const client = createClient({
610
// with session_id defined, SET and other session commands

0 commit comments

Comments
 (0)