Skip to content

Commit c02d50c

Browse files
authored
Enhance LSP Testing Strategy for Better Reliability (#5764)
## 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.
1 parent 0bf4db6 commit c02d50c

File tree

2 files changed

+1610
-1492
lines changed

2 files changed

+1610
-1492
lines changed

.github/workflows/ci.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,17 @@ jobs:
483483
- uses: Swatinem/rust-cache@v2
484484
- name: Run tests
485485
run: cargo test --locked --release -p forc-debug
486+
cargo-test-sway-lsp:
487+
runs-on: ubuntu-latest
488+
steps:
489+
- uses: actions/checkout@v3
490+
- name: Install toolchain
491+
uses: dtolnay/rust-toolchain@master
492+
with:
493+
toolchain: ${{ env.RUST_VERSION }}
494+
- uses: Swatinem/rust-cache@v2
495+
- name: Run sway-lsp tests sequentially
496+
run: cargo test --locked --release -p sway-lsp -- --test-threads=1
486497
cargo-test-workspace:
487498
runs-on: ubuntu-latest
488499
steps:
@@ -493,7 +504,7 @@ jobs:
493504
toolchain: ${{ env.RUST_VERSION }}
494505
- uses: Swatinem/rust-cache@v2
495506
- name: Run tests
496-
run: cargo test --locked --release --workspace --exclude forc-debug
507+
run: cargo test --locked --release --workspace --exclude forc-debug --exclude sway-lsp
497508
cargo-unused-deps-check:
498509
runs-on: ubuntu-latest
499510
steps:
@@ -523,6 +534,7 @@ jobs:
523534
cargo-run-e2e-test-evm,
524535
cargo-test-lib-std,
525536
cargo-test-workspace,
537+
cargo-test-sway-lsp,
526538
cargo-unused-deps-check,
527539
]
528540
runs-on: ubuntu-latest
@@ -608,6 +620,7 @@ jobs:
608620
cargo-run-e2e-test-evm,
609621
cargo-test-lib-std,
610622
cargo-test-workspace,
623+
cargo-test-sway-lsp,
611624
cargo-unused-deps-check,
612625
pre-publish-check,
613626
]
@@ -656,6 +669,7 @@ jobs:
656669
cargo-run-e2e-test-evm,
657670
cargo-test-lib-std,
658671
cargo-test-workspace,
672+
cargo-test-sway-lsp,
659673
cargo-unused-deps-check,
660674
]
661675
if: github.ref == 'refs/heads/master'

0 commit comments

Comments
 (0)