Skip to content

Commit

Permalink
test: add single-node binary tests (#15016)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Feb 28, 2024
1 parent 82dba30 commit c32b23a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 1 deletion.
18 changes: 17 additions & 1 deletion ci/scripts/run-e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,24 @@ 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"
cargo make clean-data
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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down
50 changes: 50 additions & 0 deletions ci/scripts/single-node-utils.sh
Original file line number Diff line number Diff line change
@@ -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;" </dev/null
then exit 0;
else sleep 1;
fi
done
'
STATUS=$?
set -e
if [[ $STATUS -ne 0 ]]; then
echo "Single node failed to start with status: $STATUS"
exit 1
else
echo "Single node is ready"
fi
}

restart_single_node() {
stop_single_node
sleep 5
start_single_node "$PREFIX_LOG"/single-node-restarted.log &
wait_single_node
}
20 changes: 20 additions & 0 deletions ci/workflows/main-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,26 @@ steps:
timeout_in_minutes: 25
retry: *auto-retry

- label: "e2e single-node binary test"
key: "e2e-single-node-binary-tests"
command: "ci/scripts/e2e-test.sh -p ci-release -m single-node"
if: |
!(build.pull_request.labels includes "ci/main-cron/skip-ci") && build.env("CI_STEPS") == null
|| build.pull_request.labels includes "ci/run-e2e-single-node-tests"
|| build.env("CI_STEPS") =~ /(^|,)e2e-single-node-tests?(,|$$)/
depends_on:
- "build"
- "build-other"
- "docslt"
plugins:
- docker-compose#v4.9.0:
run: rw-build-env
config: ci/docker-compose.yml
mount-buildkite-agent: true
- ./ci/plugins/upload-failure-logs
timeout_in_minutes: 25
retry: *auto-retry

- label: "end-to-end test for opendal (parallel)"
key: "e2e-test-opendal-parallel"
command: "ci/scripts/e2e-test-parallel-for-opendal.sh -p ci-release"
Expand Down
16 changes: 16 additions & 0 deletions ci/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,22 @@ steps:
timeout_in_minutes: 30
retry: *auto-retry

- label: "e2e single-node binary test"
command: "ci/scripts/e2e-test.sh -p ci-dev -m single-node"
if: build.pull_request.labels includes "ci/run-e2e-single-node-tests" || build.env("CI_STEPS") =~ /(^|,)e2e-single-node-tests?(,|$$)/
depends_on:
- "build"
- "build-other"
- "docslt"
plugins:
- docker-compose#v4.9.0:
run: rw-build-env
config: ci/docker-compose.yml
mount-buildkite-agent: true
- ./ci/plugins/upload-failure-logs
timeout_in_minutes: 30
retry: *auto-retry

# FIXME(kwannoel): Let the github PR labeller label it, if sqlsmith source files has changes.
- label: "fuzz test"
command: "ci/scripts/pr-fuzz-test.sh -p ci-dev"
Expand Down

0 comments on commit c32b23a

Please sign in to comment.