Skip to content

Commit 6a14467

Browse files
authored
test: add single-node binary tests (#15347)
1 parent d3a3363 commit 6a14467

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

ci/scripts/run-e2e-test.sh

Lines changed: 14 additions & 0 deletions
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

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
@@ -699,6 +699,22 @@ steps:
699699
timeout_in_minutes: 30
700700
retry: *auto-retry
701701

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

0 commit comments

Comments
 (0)