Skip to content

Commit c32b23a

Browse files
authored
test: add single-node binary tests (#15016)
1 parent 82dba30 commit c32b23a

File tree

4 files changed

+103
-1
lines changed

4 files changed

+103
-1
lines changed

ci/scripts/run-e2e-test.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,24 @@ if [[ $mode == "standalone" ]]; then
2626
source ci/scripts/standalone-utils.sh
2727
fi
2828

29+
if [[ $mode == "single-node" ]]; then
30+
source ci/scripts/single-node-utils.sh
31+
fi
32+
2933
cluster_start() {
3034
if [[ $mode == "standalone" ]]; then
3135
mkdir -p "$PREFIX_LOG"
3236
cargo make clean-data
3337
cargo make pre-start-dev
3438
start_standalone "$PREFIX_LOG"/standalone.log &
3539
cargo make dev standalone-minio-etcd
40+
elif [[ $mode == "single-node" ]]; then
41+
mkdir -p "$PREFIX_LOG"
42+
cargo make clean-data
43+
cargo make pre-start-dev
44+
start_single_node "$PREFIX_LOG"/single-node.log &
45+
# Give it a while to make sure the single-node is ready.
46+
sleep 3
3647
else
3748
cargo make ci-start "$mode"
3849
fi
@@ -44,6 +55,9 @@ cluster_stop() {
4455
stop_standalone
4556
# Don't check standalone logs, they will exceed the limit.
4657
cargo make kill
58+
elif [[ $mode == "single-node" ]]
59+
then
60+
stop_single_node
4761
else
4862
cargo make ci-kill
4963
fi
@@ -74,7 +88,9 @@ echo "--- e2e, $mode, batch"
7488
RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \
7589
cluster_start
7690
sqllogictest -p 4566 -d dev './e2e_test/ddl/**/*.slt' --junit "batch-ddl-${profile}"
77-
sqllogictest -p 4566 -d dev './e2e_test/background_ddl/basic.slt' --junit "batch-ddl-${profile}"
91+
if [[ "$mode" != 'single-node' ]]; then
92+
sqllogictest -p 4566 -d dev './e2e_test/background_ddl/basic.slt' --junit "batch-ddl-${profile}"
93+
fi
7894
sqllogictest -p 4566 -d dev './e2e_test/visibility_mode/*.slt' --junit "batch-${profile}"
7995
sqllogictest -p 4566 -d dev './e2e_test/database/prepare.slt'
8096
sqllogictest -p 4566 -d test './e2e_test/database/test.slt'

ci/scripts/single-node-utils.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
export RW_PREFIX=$PWD/.risingwave
6+
export PREFIX_BIN=./target/debug
7+
export PREFIX_LOG=$RW_PREFIX/log
8+
9+
# You can fill up this section by consulting
10+
# .risingwave/log/risedev.log, after calling ./risedev d full.
11+
# It is expected that minio, etcd will be started after this is called.
12+
start_single_node() {
13+
mkdir -p "$HOME/.risingwave/state_store"
14+
mkdir -p "$HOME/.risingwave/meta_store"
15+
RUST_BACKTRACE=1 "$PREFIX_BIN"/risingwave >"$1" 2>&1
16+
}
17+
18+
stop_single_node() {
19+
pkill risingwave
20+
rm -rf "$HOME/.risingwave/state_store"
21+
rm -rf "$HOME/.risingwave/meta_store"
22+
}
23+
24+
wait_single_node() {
25+
set +e
26+
timeout 20s bash -c '
27+
while true; do
28+
echo "Polling every 1s for single_node to be ready for 20s"
29+
if psql -h localhost -p 4566 -d dev -U root -c "SELECT 1;" </dev/null
30+
then exit 0;
31+
else sleep 1;
32+
fi
33+
done
34+
'
35+
STATUS=$?
36+
set -e
37+
if [[ $STATUS -ne 0 ]]; then
38+
echo "Single node failed to start with status: $STATUS"
39+
exit 1
40+
else
41+
echo "Single node is ready"
42+
fi
43+
}
44+
45+
restart_single_node() {
46+
stop_single_node
47+
sleep 5
48+
start_single_node "$PREFIX_LOG"/single-node-restarted.log &
49+
wait_single_node
50+
}

ci/workflows/main-cron.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,26 @@ steps:
777777
timeout_in_minutes: 25
778778
retry: *auto-retry
779779

780+
- label: "e2e single-node binary test"
781+
key: "e2e-single-node-binary-tests"
782+
command: "ci/scripts/e2e-test.sh -p ci-release -m single-node"
783+
if: |
784+
!(build.pull_request.labels includes "ci/main-cron/skip-ci") && build.env("CI_STEPS") == null
785+
|| build.pull_request.labels includes "ci/run-e2e-single-node-tests"
786+
|| build.env("CI_STEPS") =~ /(^|,)e2e-single-node-tests?(,|$$)/
787+
depends_on:
788+
- "build"
789+
- "build-other"
790+
- "docslt"
791+
plugins:
792+
- docker-compose#v4.9.0:
793+
run: rw-build-env
794+
config: ci/docker-compose.yml
795+
mount-buildkite-agent: true
796+
- ./ci/plugins/upload-failure-logs
797+
timeout_in_minutes: 25
798+
retry: *auto-retry
799+
780800
- label: "end-to-end test for opendal (parallel)"
781801
key: "e2e-test-opendal-parallel"
782802
command: "ci/scripts/e2e-test-parallel-for-opendal.sh -p ci-release"

ci/workflows/pull-request.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,22 @@ steps:
698698
timeout_in_minutes: 30
699699
retry: *auto-retry
700700

701+
- label: "e2e single-node binary test"
702+
command: "ci/scripts/e2e-test.sh -p ci-dev -m single-node"
703+
if: build.pull_request.labels includes "ci/run-e2e-single-node-tests" || build.env("CI_STEPS") =~ /(^|,)e2e-single-node-tests?(,|$$)/
704+
depends_on:
705+
- "build"
706+
- "build-other"
707+
- "docslt"
708+
plugins:
709+
- docker-compose#v4.9.0:
710+
run: rw-build-env
711+
config: ci/docker-compose.yml
712+
mount-buildkite-agent: true
713+
- ./ci/plugins/upload-failure-logs
714+
timeout_in_minutes: 30
715+
retry: *auto-retry
716+
701717
# FIXME(kwannoel): Let the github PR labeller label it, if sqlsmith source files has changes.
702718
- label: "fuzz test"
703719
command: "ci/scripts/pr-fuzz-test.sh -p ci-dev"

0 commit comments

Comments
 (0)