mirror of https://github.com/tikv/client-rust.git
tests: Improve integration tests (#481)
Signed-off-by: Ping Yu <yuping@pingcap.com>
This commit is contained in:
parent
070af41d97
commit
32b0cff3aa
|
@ -35,6 +35,7 @@ jobs:
|
|||
name: unit test
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
NEXTEST_PROFILE: ci
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -52,8 +53,14 @@ jobs:
|
|||
|
||||
integration-test:
|
||||
name: integration test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
case: ["integration-test-txn", "integration-test-raw"]
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
NEXTEST_PROFILE: ci
|
||||
TIKV_VERSION: v8.5.1
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -69,8 +76,8 @@ jobs:
|
|||
- name: start tiup playground
|
||||
run: |
|
||||
# use latest stable version
|
||||
~/.tiup/bin/tiup install tikv pd
|
||||
~/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor --kv.config config/tikv.toml --pd.config config/pd.toml &
|
||||
~/.tiup/bin/tiup install tikv:${{ env.TIKV_VERSION }} pd:${{ env.TIKV_VERSION }}
|
||||
~/.tiup/bin/tiup playground ${{ env.TIKV_VERSION }} --mode tikv-slim --kv 3 --tag cluster --without-monitor --kv.config config/tikv.toml --pd.config config/pd.toml &
|
||||
while :; do
|
||||
echo "waiting cluster to be ready"
|
||||
[[ "$(curl -I http://127.0.0.1:2379/pd/api/v1/regions 2>/dev/null | head -n 1 | cut -d$' ' -f2)" -ne "405" ]] || break
|
||||
|
@ -78,5 +85,13 @@ jobs:
|
|||
done
|
||||
- name: Install latest nextest release
|
||||
uses: taiki-e/install-action@nextest
|
||||
- name: integration test
|
||||
run: MULTI_REGION=1 make integration-test
|
||||
- name: Integration test
|
||||
run: MULTI_REGION=1 make ${{ matrix.case }}
|
||||
- name: Upload logs
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cluster-logs
|
||||
path: |
|
||||
~/.tiup/data/cluster/tikv*/*.log
|
||||
~/.tiup/data/cluster/pd*/*.log
|
||||
|
|
21
Makefile
21
Makefile
|
@ -1,13 +1,17 @@
|
|||
export RUSTFLAGS=-Dwarnings
|
||||
|
||||
.PHONY: default check unit-test integration-tests test doc docker-pd docker-kv docker all
|
||||
.PHONY: default check unit-test generate integration-tests integration-tests-txn integration-tests-raw test doc docker-pd docker-kv docker all
|
||||
|
||||
export PD_ADDRS ?= 127.0.0.1:2379
|
||||
export MULTI_REGION ?= 1
|
||||
|
||||
ALL_FEATURES := integration-tests
|
||||
|
||||
INTEGRATION_TEST_ARGS := --features "integration-tests"
|
||||
NEXTEST_ARGS := --config-file $(shell pwd)/config/nextest.toml
|
||||
|
||||
INTEGRATION_TEST_ARGS := --features "integration-tests" --test-threads 1
|
||||
|
||||
RUN_INTEGRATION_TEST := cargo nextest run ${NEXTEST_ARGS} --all ${INTEGRATION_TEST_ARGS}
|
||||
|
||||
default: check
|
||||
|
||||
|
@ -20,12 +24,15 @@ check: generate
|
|||
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all
|
||||
|
||||
unit-test: generate
|
||||
cargo nextest run --all --no-default-features
|
||||
cargo nextest run ${NEXTEST_ARGS} --all --no-default-features
|
||||
|
||||
integration-test: generate
|
||||
cargo test txn_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
||||
cargo test raw_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
||||
cargo test misc_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
||||
integration-test: integration-test-txn integration-test-raw
|
||||
|
||||
integration-test-txn: generate
|
||||
$(RUN_INTEGRATION_TEST) txn_
|
||||
|
||||
integration-test-raw: generate
|
||||
$(RUN_INTEGRATION_TEST) raw_
|
||||
|
||||
test: unit-test integration-test
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[profile.ci]
|
||||
retries = 0
|
||||
fail-fast = false
|
||||
slow-timeout = { period = "60s", terminate-after = 10 } # Timeout 10m. TODO: speed up the slow tests.
|
||||
failure-output = "final"
|
||||
|
||||
[profile.ci.junit]
|
||||
path = "junit.xml"
|
|
@ -19,3 +19,4 @@ max-open-files = 10000
|
|||
[storage]
|
||||
api-version = 2
|
||||
enable-ttl = true
|
||||
reserve-space = "0MiB"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
//! Test names should begin with one of the following:
|
||||
//! 1. txn_
|
||||
//! 2. raw_
|
||||
//! 3. misc_
|
||||
//!
|
||||
//! We make use of the convention to control the order of tests in CI, to allow
|
||||
//! transactional and raw tests to coexist, since transactional requests have
|
||||
|
|
Loading…
Reference in New Issue