From daa3534399695b158d738bbd297fa70dcd915d71 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 11 Aug 2024 12:00:36 +0800 Subject: [PATCH] add run-ci-test --- .github/workflows/ci.yml | 5 ++++- .gitignore | 3 ++- scripts/run-ci-tests.sh | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 scripts/run-ci-tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80fa63c6..be73e2c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,4 +31,7 @@ jobs: run: | mkdir build && cd build cmake .. - make -j4 \ No newline at end of file + make -j4 + - name: Run Tests + run: | + sudo sh scripts/run-ci-tests.sh diff --git a/.gitignore b/.gitignore index 3a216c8f..982c5122 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ logs/ data data/ gflags -gflags/ \ No newline at end of file +gflags/ +nohup.out \ No newline at end of file diff --git a/scripts/run-ci-tests.sh b/scripts/run-ci-tests.sh new file mode 100644 index 00000000..b57c0afe --- /dev/null +++ b/scripts/run-ci-tests.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -xe + +if [ ! -d "data" ]; then mkdir data; fi; +if [ ! -d "logs" ]; then mkdir logs; fi; + +nohup ./build/example/eraftkv -svr_id 0 -kv_db_path ./data/kv_db0 -log_db_path ./data/log_db0 -snap_db_path ./data/snap_db0 -peer_addrs 127.0.0.1:8088,127.0.0.1:8089,127.0.0.1:8090 -log_file_path ./logs/eraftkv-1.log -monitor_addrs 0.0.0.0:12306 & +nohup ./build/example/eraftkv -svr_id 1 -kv_db_path ./data/kv_db1 -log_db_path ./data/log_db1 -snap_db_path ./data/snap_db1 -peer_addrs 127.0.0.1:8088,127.0.0.1:8089,127.0.0.1:8090 -log_file_path ./logs/eraftkv-2.log -monitor_addrs 0.0.0.0:12307 & +nohup ./build/example/eraftkv -svr_id 2 -kv_db_path ./data/kv_db2 -log_db_path ./data/log_db2 -snap_db_path ./data/snap_db2 -peer_addrs 127.0.0.1:8088,127.0.0.1:8089,127.0.0.1:8090 -log_file_path ./logs/eraftkv-3.log -monitor_addrs 0.0.0.0:12308 & + +nohup ./build/example/eraftmeta -svr_id 0 -kv_db_path ./data/meta_db0 -log_db_path ./data/meta_log_db0 -peer_addrs 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 -monitor_addrs 0.0.0.0:12309 & +nohup ./build/example/eraftmeta -svr_id 1 -kv_db_path ./data/meta_db1 -log_db_path ./data/meta_log_db1 -peer_addrs 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 -monitor_addrs 0.0.0.0:12310 & +nohup ./build/example/eraftmeta -svr_id 2 -kv_db_path ./data/meta_db2 -log_db_path ./data/meta_log_db2 -peer_addrs 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 -monitor_addrs 0.0.0.0:12311 & + +sleep 3 + +./build/example/eraftkv-ctl 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 add_group 1 127.0.0.1:8088,127.0.0.1:8089,127.0.0.1:8090 +./build/example/eraftkv-ctl 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 query_groups +./build/example/eraftkv-ctl 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 set_slot 1 0-9 +./build/example/eraftkv-ctl 127.0.0.1:7088,127.0.0.1:7089,127.0.0.1:7090 run_bench 100