Skip to content

Commit bb6663e

Browse files
committed
new cluster test.
1 parent 465934c commit bb6663e

File tree

6 files changed

+274
-0
lines changed

6 files changed

+274
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Databend Cluster Tests New
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: 'temurin'
21+
java-version: '17'
22+
cache: 'maven'
23+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
24+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
25+
26+
- name: Start Cluster With Nginx and Minio
27+
working-directory: tests
28+
run: make up
29+
30+
- name: View Nginx logs
31+
run: docker logs nginx-lb
32+
33+
- name: Test with conn to nginx
34+
run: mvn test -DexcludedGroups=FLAKY
35+
env:
36+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
37+
DATABEND_TEST_CONN_PORT: 8000

tests/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
DATABEND_META_VERSION ?= nightly
2+
DATABEND_QUERY_VERSION ?= nightly
3+
4+
default: run
5+
6+
run: test-core test-driver test-bendsql down
7+
8+
prepare:
9+
mkdir -p data/databend
10+
11+
up: prepare
12+
docker compose up --quiet-pull -d --wait
13+
grep -q '127.0.0.1 minio' /etc/hosts || echo '127.0.0.1 minio' | sudo tee -a /etc/hosts > /dev/null
14+
curl -u root: -XPOST "http://localhost:8000/v1/query" -H 'Content-Type: application/json' -d '{"sql": "select version()", "pagination": { "wait_time_secs": 10}}'
15+
16+
down:
17+
docker compose down
18+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Usage:
2+
# databend-meta -c databend-meta-node-1.toml
3+
4+
log_dir = "./.databend/logs1"
5+
admin_api_address = "0.0.0.0:28101"
6+
grpc_api_address = "0.0.0.0:9191"
7+
# databend-query fetch this address to update its databend-meta endpoints list,
8+
# in case databend-meta cluster changes.
9+
grpc_api_advertise_host = "meta"
10+
11+
[raft_config]
12+
id = 1
13+
raft_dir = "./.databend/meta1"
14+
raft_api_port = 28103
15+
16+
# Assign raft_{listen|advertise}_host in test config.
17+
# This allows you to catch a bug in unit tests when something goes wrong in raft meta nodes communication.
18+
raft_listen_host = "0.0.0.0"
19+
raft_advertise_host = "meta"
20+
21+
# Start up mode: single node cluster
22+
single = true
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Usage:
2+
# databend-query -c databend_query_config_spec.toml
3+
4+
[query]
5+
max_active_sessions = 256
6+
shutdown_wait_timeout_ms = 5000
7+
8+
# For flight rpc.
9+
flight_api_address = "0.0.0.0:9091"
10+
11+
# Databend Query http address.
12+
# For admin RESET API.
13+
admin_api_address = "0.0.0.0:8080"
14+
15+
# Databend Query metrics RESET API.
16+
metric_api_address = "0.0.0.0:7070"
17+
18+
# Databend Query MySQL Handler.
19+
mysql_handler_host = "0.0.0.0"
20+
mysql_handler_port = 3307
21+
22+
# Databend Query ClickHouse Handler.
23+
clickhouse_http_handler_host = "0.0.0.0"
24+
clickhouse_http_handler_port = 8124
25+
26+
# Databend Query HTTP Handler.
27+
http_handler_host = "0.0.0.0"
28+
http_handler_port = 8000
29+
30+
# Databend Query FlightSQL Handler.
31+
flight_sql_handler_host = "0.0.0.0"
32+
flight_sql_handler_port = 8900
33+
34+
tenant_id = "test_tenant"
35+
cluster_id = "test_cluster"
36+
37+
table_engine_memory_enabled = true
38+
default_storage_format = 'parquet'
39+
default_compression = 'zstd'
40+
41+
enable_udf_server = true
42+
udf_server_allow_list = ['http://0.0.0.0:8815']
43+
udf_server_allow_insecure = true
44+
45+
cloud_control_grpc_server_address = "http://0.0.0.0:50051"
46+
47+
[[query.users]]
48+
name = "root"
49+
auth_type = "no_password"
50+
51+
[[query.users]]
52+
name = "databend"
53+
auth_type = "double_sha1_password"
54+
# echo -n "databend" | sha1sum | cut -d' ' -f1 | xxd -r -p | sha1sum
55+
auth_string = "3081f32caef285c232d066033c89a78d88a6d8a5"
56+
57+
# This for test
58+
[[query.udfs]]
59+
name = "ping"
60+
definition = "CREATE FUNCTION ping(STRING) RETURNS STRING LANGUAGE python HANDLER = 'ping' ADDRESS = 'http://0.0.0.0:8815'"
61+
62+
[query.settings]
63+
aggregate_spilling_memory_ratio = 60
64+
join_spilling_memory_ratio = 60
65+
66+
[log]
67+
level = "INFO"
68+
69+
[log.file]
70+
format = "text"
71+
dir = "./.databend/logs_1"
72+
73+
[meta]
74+
# It is a list of `grpc_api_advertise_host:<grpc-api-port>` of databend-meta config
75+
endpoints = ["meta:9191"]
76+
username = "root"
77+
password = "root"
78+
client_timeout_in_second = 60
79+
auto_sync_interval = 60
80+
81+
# Storage config.
82+
[storage]
83+
type = "s3"
84+
85+
[storage.s3]
86+
bucket = "databend"
87+
endpoint_url = "http://minio:9000"
88+
#endpoint_url = "http://localhost:9000"
89+
access_key_id = "minioadmin"
90+
secret_access_key = "minioadmin"
91+
enable_virtual_host_style = false
92+
93+
# Cache config.
94+
[cache]
95+
data_cache_storage = "none"
96+
97+
[cache.disk]
98+
# cache path
99+
path = "./.databend/_cache"
100+
# max bytes of cached data 20G
101+
max_bytes = 21474836480
102+
103+
[spill]
104+
spill_local_disk_path = "./.databend/temp/_query_spill"

tests/config/nginx.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
upstream backend {
7+
server query-node-1:8001;
8+
server query-node-2:8002;
9+
server query-node-3:8003;
10+
}
11+
12+
server {
13+
listen 8000;
14+
15+
location / {
16+
proxy_pass http://backend;
17+
}
18+
}
19+
}

tests/docker-compose.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
x-query-base: &query-base
2+
image: docker.io/datafuselabs/databend-query:${DATABEND_QUERY_VERSION:-nightly}
3+
volumes:
4+
- ./config/databend-query-node-1.toml:/conf.toml:ro
5+
command: -c /conf.toml
6+
environment:
7+
- QUERY_DATABEND_ENTERPRISE_LICENSE
8+
depends_on:
9+
minio:
10+
condition: service_started
11+
meta:
12+
condition: service_healthy
13+
healthcheck:
14+
test: "curl -f localhost:8080/v1/health || exit 1"
15+
interval: 2s
16+
retries: 10
17+
start_period: 2s
18+
timeout: 1s
19+
20+
services:
21+
minio:
22+
image: docker.io/minio/minio
23+
command: server /data
24+
ports:
25+
- "9000:9000"
26+
volumes:
27+
- ./data:/data
28+
meta:
29+
image: docker.io/datafuselabs/databend-meta:${DATABEND_META_VERSION:-nightly}
30+
volumes:
31+
- ./config/databend-meta-node-1.toml:/conf.toml:ro
32+
command: -c /conf.toml
33+
ports:
34+
- "28101:28101"
35+
healthcheck:
36+
test: "databend-metactl status || exit 1"
37+
interval: 2s
38+
retries: 10
39+
start_period: 2s
40+
timeout: 1s
41+
query-node-1:
42+
<<: *query-base
43+
environment:
44+
- QUERY_HTTP_HANDLER_PORT=8001
45+
- QUERY_DISCOVERY_ADDRESS=localhost:8001
46+
ports:
47+
- "8001:8001"
48+
query-node-2:
49+
<<: *query-base
50+
environment:
51+
- QUERY_HTTP_HANDLER_PORT=8002
52+
- QUERY_DISCOVERY_ADDRESS=localhost:8002
53+
ports:
54+
- "8002:8002"
55+
query-node-3:
56+
<<: *query-base
57+
environment:
58+
- QUERY_HTTP_HANDLER_PORT=8003
59+
- QUERY_DISCOVERY_ADDRESS=localhost:8003
60+
ports:
61+
- "8003:8003"
62+
ngnix-lb:
63+
image: docker.io/nginx
64+
volumes:
65+
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
66+
ports:
67+
- "8000:8000"
68+
depends_on:
69+
query-node-1:
70+
condition: service_healthy
71+
query-node-2:
72+
condition: service_healthy
73+
query-node-3:
74+
condition: service_healthy

0 commit comments

Comments
 (0)