forked from wolfi-dev/os
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-daemon.sh
More file actions
executable file
·40 lines (34 loc) · 1.57 KB
/
Copy pathtest-daemon.sh
File metadata and controls
executable file
·40 lines (34 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -o errexit -o nounset -o errtrace -o pipefail -x
# Test CREATE DATABASE
clickhouse-client --query "CREATE DATABASE IF NOT EXISTS test;"
# Test CREATE TABLE
clickhouse-client --query "CREATE TABLE IF NOT EXISTS test.sample (id UInt32, name String) ENGINE = MergeTree() ORDER BY id;"
# Test INSERT
clickhouse-client --query "INSERT INTO test.sample VALUES (1, 'test');"
# Test SELECT
clickhouse-client --query "SELECT * FROM test.sample" | grep -q "test"
# Test basic HTTP query
curl -s "http://localhost:8123/?query=SELECT%201" | grep -q "1"
# Test database creation via HTTP
curl -s -X POST "http://localhost:8123/?query=CREATE%20DATABASE%20IF%20NOT%20EXISTS%20http_test"
# Check access to system tables
clickhouse-client --query "SELECT * FROM system.databases WHERE name = 'system'" | grep -q "system"
clickhouse-client --query "SELECT * FROM system.tables WHERE database = 'system' LIMIT 1"
# Test data types handling
clickhouse-client --query "
CREATE TABLE IF NOT EXISTS test.types (
int8_col Int8,
uint64_col UInt64,
float_col Float64,
string_col String,
date_col Date
) ENGINE = MergeTree() ORDER BY int8_col"
clickhouse-client --query "
INSERT INTO test.types VALUES
(1, 18446744073709551615, 3.14159, 'test string', '2024-01-01')"
clickhouse-client --query "SELECT * FROM test.types" | grep -q "test string"
# Simple benchmark test with default options
clickhouse-benchmark --query "SELECT 1" --iterations 10
# Test with concurrency
clickhouse-benchmark --concurrency 2 --query "SELECT number FROM system.numbers LIMIT 10" --iterations 3