Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tests to use cargo-nextest if present #1243

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ jobs:
- name: Check targets are installed correctly
run: rustup target list --installed

- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

- name: Check all features compilation
run: cargo check --verbose --features try-runtime,runtime-benchmarks --locked

- name: Run all tests
run: cargo test --features try-runtime,runtime-benchmarks --locked
run: make test-all

native-linux:
needs: checks-and-tests
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
test-runtimes:
tests:
runs-on: [self-hosted, Linux, X64]
steps:
- name: Checkout the source code
Expand All @@ -26,5 +26,8 @@ jobs:
- name: Check targets are installed correctly
run: rustup target list --installed

- name: Runtime integration tests
run: make test-runtimes
- name: Install cargo-nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

- name: Run all tests
run: make test-all
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ runtime-upgrade-test:
cargo build -p $(runtime)-runtime --release --locked
cd tests/e2e && yarn --frozen-lockfile && yarn test:runtime-upgrade-$(runtime)

# use `cargo nextest run` if cargo-nextest is installed, fallback cargo test
cargo_test = $(shell which cargo-nextest >/dev/null && echo "cargo nextest run" || echo "cargo test")

.PHONY: test
test:
SKIP_WASM_BUILD= ${cargo_test} --workspace

.PHONY: test-runtimes
test-runtimes:
SKIP_WASM_BUILD= cargo test -p integration-tests --features=shibuya
SKIP_WASM_BUILD= cargo test -p integration-tests --features=shiden
SKIP_WASM_BUILD= cargo test -p integration-tests --features=astar
SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=shibuya
SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=shiden
SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=astar

.PHONY: test-all
test-all: test test-runtimes
SKIP_WASM_BUILD= ${cargo_test} --workspace --features try-runtime,runtime-benchmarks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make my comment more specific about features...

Why not just run it once with features enabled?
I assume this is because you want to ensure that tests work with no features enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

1 change: 1 addition & 0 deletions bin/collator/src/local/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ pub(crate) mod tests {
use sp_runtime::BuildStorage;

#[test]
#[ignore]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this btw? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will require building wasm which means more time to compile and it's just for local so not that critical if this breaks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will let it compile local runtime, will revert this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need btw, we can just remove that test. But your call.

fn test_create_development_chain_spec() {
development_config().build_storage().unwrap();
}
Expand Down
Loading