Skip to content

Commit

Permalink
chore(CI): Run tests with all features (#5035)
Browse files Browse the repository at this point in the history
* chore(CI): Run tests with all features

* try excluding tests that are run later

* try again

* refactor

* use binary names instead of test names

* Add script to the diff

* elaborate

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
DaughterOfMars and thibault-martinez authored Feb 6, 2025
1 parent 01cada2 commit 0ae9a7e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 37 additions & 4 deletions scripts/ci_tests/rust_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ function mk_test_filterset() {
FILTERSET=""
for crate in ${CHANGED_CRATES[@]}; do
# rdeps selects the crate plus all crates that depend on it
add_filter="-E rdeps(${crate})"
add_filter="rdeps(${crate})"

if [ -z "$FILTERSET" ]; then
FILTERSET="$add_filter"
else
FILTERSET="$FILTERSET $add_filter"
FILTERSET="$FILTERSET | $add_filter"
fi
done

Expand All @@ -89,6 +89,31 @@ function mk_test_filterset() {
echo "${FILTERSET}"
}

function mk_exclude_filterset() {
EXCLUDE_SET=""

# These require extra config which is applied in `tests_using_postgres` below.
# They are excluded from the main tests group, which runs with all features enabled,
# because they will fail due to cross-thread contamination.
EXCLUDED=(
"package(iota-graphql-rpc) & (binary(e2e_tests) | binary(examples_validation_tests) | test(test_query_cost))"
"package(iota-graphql-e2e-tests)"
"package(iota-cluster-test) & binary(local_cluster_test)"
"package(iota-indexer) & (binary(ingestion_tests) | binary(rpc-tests))"
)

for item in "${EXCLUDED[@]}"; do
add_filter="!(${item})"

if [ -z "$EXCLUDE_SET" ]; then
EXCLUDE_SET="$add_filter"
else
EXCLUDE_SET="$EXCLUDE_SET & $add_filter"
fi
done
echo "${EXCLUDE_SET}"
}

function retry_only_tests() {
FILTERSET=""
for test_name in "${RETRY_ONLY_TESTS[@]}"; do
Expand All @@ -110,9 +135,17 @@ function rust_crates() {
# mk_test_filterset returns an empty filterset in this case
FILTERSET="$(mk_test_filterset)"

command="cargo nextest run --config-file .config/nextest.toml --profile ci $FILTERSET"
EXCLUDE_SET="$(mk_exclude_filterset)"

if [ -z "$FILTERSET" ]; then
FILTERSET="-E '$EXCLUDE_SET'"
else
FILTERSET="-E '($FILTERSET) & ($EXCLUDE_SET)'"
fi

command="cargo nextest run --config-file .config/nextest.toml --profile ci --all-features $FILTERSET"
echo "Running: $command"
cargo nextest run --config-file .config/nextest.toml --profile ci $FILTERSET
eval ${command}
}

function external_crates() {
Expand Down

0 comments on commit 0ae9a7e

Please sign in to comment.