Skip to content

Commit f29743e

Browse files
add a simple test case
1 parent b414464 commit f29743e

File tree

8 files changed

+115
-27
lines changed

8 files changed

+115
-27
lines changed

.github/workflows/compatibility_test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ jobs:
4040
4141
pip install -r helpers/requirements.txt
4242
43-
bash test_compatibility/prepare_data.sh
44-
bash test_compatibility/basic_tests.sh
43+
timeout --foreground 10m bash test_compatibility/prepare_data.sh
44+
timeout --foreground 10m bash test_compatibility/basic_tests.sh
4545
4646
cd $GITHUB_WORKSPACE
4747
tar -zcvf $PROTON_VERSION.tar.gz data
4848
aws s3 cp --no-progress $PROTON_VERSION.tar.gz s3://tp-internal/proton/compatibility/oss/$ARCH/
49+
50+
cd $GITHUB_WORKSPACE/tests/stream
51+
timeout --foreground 10m bash test_compatibility/extra_tests.sh
4952
steps:
5053
- name: display command
5154
run: |
@@ -85,8 +88,8 @@ jobs:
8588
8689
pip install -r helpers/requirements.txt
8790
88-
bash test_compatibility/basic_tests.sh
89-
bash test_compatibility/extra_tests.sh
91+
timeout --foreground 10m bash test_compatibility/basic_tests.sh
92+
timeout --foreground 10m bash test_compatibility/extra_tests.sh
9093
steps:
9194
- name: display command
9295
run: |
@@ -182,4 +185,4 @@ jobs:
182185
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
183186
TIMEPLUS_ADDRESS: ${{ secrets.TIMEPLUS_ADDRESS }}
184187
TIMEPLUS_API_KEY: ${{ secrets.TIMEPLUS_API_KEY }}
185-
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
188+
TIMEPLUS_WORKSPACE: ${{ secrets.TIMEPLUS_WORKSPACE }}
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
docker-compose -f test_compatibility/docker-compose.yaml up -d
1+
CUR_DIR="$GITHUB_WORKSPACE/tests/stream/test_compatibility"
2+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" up -d
23
sleep 5
3-
docker exec proton-server proton client -nm -q "select x from example where _tp_time > earliest_ts() limit 3;"
4-
docker exec proton-server proton client -nm -q "select x from example_external limit 3 settings seek_to='earliest';"
5-
docker-compose -f test_compatibility/docker-compose.yaml down
4+
sqls=$(cat $CUR_DIR/basic_tests.sql | tr "\n" " " | sed 's/ \+/ /g')
5+
IFS=";
6+
"
7+
for sql in $sqls
8+
do
9+
if [ ${#sql} -gt 1 ]
10+
then
11+
echo "> [$sql]"
12+
timeout --foreground 30s docker exec proton-server proton client -nm -q "$sql"
13+
sleep 2
14+
fi
15+
done
16+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" down -v
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
select 'test 1';
2+
select (* except _tp_time) from table(test_1_mv);
3+
select (* except _tp_time) from test_1_mv where _tp_time > earliest_ts() limit 6;
4+
5+
select 'test 2';
6+
select (* except _tp_time) from table(test_2_mv);
7+
select (* except _tp_time) from test_2_mv where _tp_time > earliest_ts() limit 1;

tests/stream/test_compatibility/docker-compose.yaml renamed to tests/stream/test_compatibility/configs/docker-compose.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ services:
88
- $GITHUB_WORKSPACE/data/proton-redp/datas:/var/lib/proton
99
- $GITHUB_WORKSPACE/data/proton-redp/log:/var/log/proton-server
1010
ports:
11-
- "13218:3218" # HTTP Streaming
12-
- "18123:8123" # HTTP Snapshot
13-
- "18463:8463" # TCP Streaming
14-
- "15432:5432" # Postgres Snapshot
15-
- "17587:7587" # TCP Snapshot
11+
- "3218:3218" # HTTP Streaming
12+
- "8123:8123" # HTTP Snapshot
13+
- "8463:8463" # TCP Streaming
14+
- "5432:5432" # Postgres Snapshot
15+
- "7587:7587" # TCP Snapshot
1616
deploy:
1717
replicas: 1
1818
restart_policy:
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
docker-compose -f test_compatibility/docker-compose.yaml up -d
1+
CUR_DIR="$GITHUB_WORKSPACE/tests/stream/test_compatibility"
2+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" up -d
23
sleep 5
3-
docker exec proton-server proton client -nm -q "insert into example (x) values (4)(5)(6);"
4-
docker exec proton-server proton client -nm -q "select x from example where _tp_time > earliest_ts() limit 6;"
5-
docker exec proton-server proton client -nm -q "insert into example_external (x) values (8)(10)(12);"
6-
docker exec proton-server proton client -nm -q "select x from example_external limit 6 settings seek_to='earliest';"
7-
docker-compose -f test_compatibility/docker-compose.yaml down
4+
sqls=$(cat $CUR_DIR/extra_tests.sql | tr "\n" " " | sed 's/ \+/ /g')
5+
IFS=";
6+
"
7+
for sql in $sqls
8+
do
9+
if [ ${#sql} -gt 1 ]
10+
then
11+
echo "> [$sql]"
12+
timeout --foreground 30s docker exec proton-server proton client -nm -q "$sql"
13+
sleep 2
14+
fi
15+
done
16+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" down -v
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
select 'test 1';
2+
insert into test_1_s (* except _tp_time)
3+
values
4+
(7, 1.1, 'g7', 47), (8, 2.1, 'h8', 48), (9, 3.1, 'i9', 49);
5+
select (* except _tp_time) from table(test_1_mv);
6+
select (* except _tp_time) from test_1_mv where _tp_time > earliest_ts() limit 9;
7+
8+
select 'test 2';
9+
select (* except _tp_time) from table(test_2_mv);
10+
select (* except _tp_time) from test_2_mv where _tp_time > earliest_ts() limit 1;
11+
insert into test_2_s(* except _tp_time) values (0, 10), (1, 11), (2, 12);
12+
select (* except _tp_time) from table(test_2_mv);
13+
select (* except _tp_time) from test_2_mv where _tp_time > earliest_ts() limit 1;
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
docker-compose -f test_compatibility/docker-compose.yaml up -d
1+
CUR_DIR="$GITHUB_WORKSPACE/tests/stream/test_compatibility"
2+
echo $CUR_DIR
3+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" up -d
24
sleep 5
3-
docker exec proton-server proton client -nm -q "create stream example(x int);"
4-
docker exec proton-server proton client -nm -q "insert into example (x) values (1)(2)(3);"
5-
docker exec redpanda rpk topic create example_topic
6-
docker exec proton-server proton client -nm -q "create external stream example_external (x int) settings type='kafka', brokers='stream-store:9092',topic='example_topic',data_format = 'JSONEachRow';"
7-
docker exec proton-server proton client -nm -q "insert into example_external (x) values (2)(4)(6);"
8-
docker-compose -f test_compatibility/docker-compose.yaml down
5+
sqls=$(cat $CUR_DIR/prepare_data.sql | tr "\n" " " | sed 's/ \+/ /g')
6+
IFS=";"
7+
for sql in $sqls
8+
do
9+
if [ ${#sql} -gt 1 ]
10+
then
11+
echo "> [$sql]"
12+
timeout --foreground 30s docker exec proton-server proton client -n -q "$sql;"
13+
sleep 2
14+
fi
15+
done
16+
docker-compose -f "$CUR_DIR/configs/docker-compose.yaml" down -v
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
select 'test 1: a mv on stream, and then alter the stream add column';
2+
create stream test_1_s (
3+
col1 int,
4+
col2 float,
5+
col3 string
6+
);
7+
create materialized view test_1_mv as (
8+
select
9+
col1, col2, col3
10+
from
11+
test_1_s
12+
);
13+
insert into test_1_s (* except _tp_time)
14+
values
15+
(1, 1.1, 'a1'), (2, 2.1, 'b2'), (3, 3.1, 'c3');
16+
17+
alter stream test_1_s add column col4 uint64;
18+
19+
insert into test_1_s (* except _tp_time)
20+
values
21+
(4, 4.1, 'd4', 44), (5, 5.1, 'e5', 45), (6, 6.1, 'f6', 46);
22+
23+
select 'test 2 a mv on stream global aggregation';
24+
create stream test_2_s (
25+
col1 int,
26+
col2 float64
27+
);
28+
create materialized view test_2_mv as(
29+
select
30+
min(col2) as min_col2,
31+
max(col2) as max_col2,
32+
count(col2) as cnt_col2
33+
from test_2_s
34+
);
35+
insert into test_2_s (* except _tp_time)
36+
values
37+
(1, 1.1), (2, 2.1), (3, 3.1), (4, 4.1), (5, 5.1), (6, 6.1), (3, 3.1), (4, 4.1);

0 commit comments

Comments
 (0)