Skip to content

Commit

Permalink
Enhance LSP Testing Strategy for Better Reliability (#5764)
Browse files Browse the repository at this point in the history
## Description
This PR refines our testing approach for `sway-lsp` to ensure tests run
sequentially, addressing potential async test interference. Key
enhancements include:

- Implemented a `run_async` macro to facilitate running async tests
within a synchronous environment, minimizing the boilerplate code and
improving test readability.
- Updated the GitHub Actions workflow to include a dedicated job for
`sway-lsp`, utilizing `-p sway-lsp -- --test-threads=1` to enforce
sequential execution of tests. This removes LSP tests from the
`cargo-test-workspace` job.
  • Loading branch information
JoshuaBatty authored Mar 25, 2024
1 parent 0bf4db6 commit c02d50c
Show file tree
Hide file tree
Showing 2 changed files with 1,610 additions and 1,492 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,17 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --locked --release -p forc-debug
cargo-test-sway-lsp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Run sway-lsp tests sequentially
run: cargo test --locked --release -p sway-lsp -- --test-threads=1
cargo-test-workspace:
runs-on: ubuntu-latest
steps:
Expand All @@ -493,7 +504,7 @@ jobs:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --locked --release --workspace --exclude forc-debug
run: cargo test --locked --release --workspace --exclude forc-debug --exclude sway-lsp
cargo-unused-deps-check:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -523,6 +534,7 @@ jobs:
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
cargo-unused-deps-check,
]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -608,6 +620,7 @@ jobs:
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
cargo-unused-deps-check,
pre-publish-check,
]
Expand Down Expand Up @@ -656,6 +669,7 @@ jobs:
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
cargo-unused-deps-check,
]
if: github.ref == 'refs/heads/master'
Expand Down
Loading

0 comments on commit c02d50c

Please sign in to comment.