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
|
name: unit test
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
|
NEXTEST_PROFILE: ci
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -52,8 +53,14 @@ jobs:
|
||||||
|
|
||||||
integration-test:
|
integration-test:
|
||||||
name: integration test
|
name: integration test
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
case: ["integration-test-txn", "integration-test-raw"]
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
|
NEXTEST_PROFILE: ci
|
||||||
|
TIKV_VERSION: v8.5.1
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -69,8 +76,8 @@ jobs:
|
||||||
- name: start tiup playground
|
- name: start tiup playground
|
||||||
run: |
|
run: |
|
||||||
# use latest stable version
|
# use latest stable version
|
||||||
~/.tiup/bin/tiup install tikv pd
|
~/.tiup/bin/tiup install tikv:${{ env.TIKV_VERSION }} pd:${{ env.TIKV_VERSION }}
|
||||||
~/.tiup/bin/tiup playground --mode tikv-slim --kv 3 --without-monitor --kv.config config/tikv.toml --pd.config config/pd.toml &
|
~/.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
|
while :; do
|
||||||
echo "waiting cluster to be ready"
|
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
|
[[ "$(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
|
done
|
||||||
- name: Install latest nextest release
|
- name: Install latest nextest release
|
||||||
uses: taiki-e/install-action@nextest
|
uses: taiki-e/install-action@nextest
|
||||||
- name: integration test
|
- name: Integration test
|
||||||
run: MULTI_REGION=1 make 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
|
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 PD_ADDRS ?= 127.0.0.1:2379
|
||||||
export MULTI_REGION ?= 1
|
export MULTI_REGION ?= 1
|
||||||
|
|
||||||
ALL_FEATURES := integration-tests
|
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
|
default: check
|
||||||
|
|
||||||
|
@ -20,12 +24,15 @@ check: generate
|
||||||
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all
|
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all
|
||||||
|
|
||||||
unit-test: generate
|
unit-test: generate
|
||||||
cargo nextest run --all --no-default-features
|
cargo nextest run ${NEXTEST_ARGS} --all --no-default-features
|
||||||
|
|
||||||
integration-test: generate
|
integration-test: integration-test-txn integration-test-raw
|
||||||
cargo test txn_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
|
||||||
cargo test raw_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
integration-test-txn: generate
|
||||||
cargo test misc_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture
|
$(RUN_INTEGRATION_TEST) txn_
|
||||||
|
|
||||||
|
integration-test-raw: generate
|
||||||
|
$(RUN_INTEGRATION_TEST) raw_
|
||||||
|
|
||||||
test: unit-test integration-test
|
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]
|
[storage]
|
||||||
api-version = 2
|
api-version = 2
|
||||||
enable-ttl = true
|
enable-ttl = true
|
||||||
|
reserve-space = "0MiB"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
//! Test names should begin with one of the following:
|
//! Test names should begin with one of the following:
|
||||||
//! 1. txn_
|
//! 1. txn_
|
||||||
//! 2. raw_
|
//! 2. raw_
|
||||||
//! 3. misc_
|
|
||||||
//!
|
//!
|
||||||
//! We make use of the convention to control the order of tests in CI, to allow
|
//! 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
|
//! transactional and raw tests to coexist, since transactional requests have
|
||||||
|
|
Loading…
Reference in New Issue