diff --git a/ci/scripts/run-e2e-test.sh b/ci/scripts/run-e2e-test.sh index eeed357487198..c3a8ec78f9fc5 100755 --- a/ci/scripts/run-e2e-test.sh +++ b/ci/scripts/run-e2e-test.sh @@ -26,6 +26,10 @@ if [[ $mode == "standalone" ]]; then source ci/scripts/standalone-utils.sh fi +if [[ $mode == "single-node" ]]; then + source ci/scripts/single-node-utils.sh +fi + cluster_start() { if [[ $mode == "standalone" ]]; then mkdir -p "$PREFIX_LOG" @@ -33,6 +37,13 @@ cluster_start() { cargo make pre-start-dev start_standalone "$PREFIX_LOG"/standalone.log & cargo make dev standalone-minio-etcd + elif [[ $mode == "single-node" ]]; then + mkdir -p "$PREFIX_LOG" + cargo make clean-data + cargo make pre-start-dev + start_single_node "$PREFIX_LOG"/single-node.log & + # Give it a while to make sure the single-node is ready. + sleep 3 else cargo make ci-start "$mode" fi @@ -44,6 +55,9 @@ cluster_stop() { stop_standalone # Don't check standalone logs, they will exceed the limit. cargo make kill + elif [[ $mode == "single-node" ]] + then + stop_single_node else cargo make ci-kill fi @@ -74,7 +88,9 @@ echo "--- e2e, $mode, batch" RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \ cluster_start sqllogictest -p 4566 -d dev './e2e_test/ddl/**/*.slt' --junit "batch-ddl-${profile}" -sqllogictest -p 4566 -d dev './e2e_test/background_ddl/basic.slt' --junit "batch-ddl-${profile}" +if [[ "$mode" != 'single-node' ]]; then + sqllogictest -p 4566 -d dev './e2e_test/background_ddl/basic.slt' --junit "batch-ddl-${profile}" +fi sqllogictest -p 4566 -d dev './e2e_test/visibility_mode/*.slt' --junit "batch-${profile}" sqllogictest -p 4566 -d dev './e2e_test/database/prepare.slt' sqllogictest -p 4566 -d test './e2e_test/database/test.slt' diff --git a/ci/scripts/single-node-utils.sh b/ci/scripts/single-node-utils.sh new file mode 100755 index 0000000000000..8e75232173703 --- /dev/null +++ b/ci/scripts/single-node-utils.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export RW_PREFIX=$PWD/.risingwave +export PREFIX_BIN=./target/debug +export PREFIX_LOG=$RW_PREFIX/log + +# You can fill up this section by consulting +# .risingwave/log/risedev.log, after calling ./risedev d full. +# It is expected that minio, etcd will be started after this is called. +start_single_node() { + mkdir -p "$HOME/.risingwave/state_store" + mkdir -p "$HOME/.risingwave/meta_store" + RUST_BACKTRACE=1 "$PREFIX_BIN"/risingwave >"$1" 2>&1 +} + +stop_single_node() { + pkill risingwave + rm -rf "$HOME/.risingwave/state_store" + rm -rf "$HOME/.risingwave/meta_store" +} + +wait_single_node() { + set +e + timeout 20s bash -c ' + while true; do + echo "Polling every 1s for single_node to be ready for 20s" + if psql -h localhost -p 4566 -d dev -U root -c "SELECT 1;"