Skip to content

Commit

Permalink
Use cargo-nextest with retries for flaky LSP test (#6521)
Browse files Browse the repository at this point in the history
## Description
This PR introduces [`cargo-nextest`](https://nexte.st/) to improve our
test runs. We've configured 2 retries for the go_to_definition_for_paths
test, which has been intermittently failing. The LSP CI workflow has
been updated to use `cargo-nextest`.

Should mitigate #6029 until we get to the root cause why these tests are
flaky.

## Checklist

- [x] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.
  • Loading branch information
JoshuaBatty authored Sep 11, 2024
1 parent 7d574a9 commit 2f4fa65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
- name: Setup Rust and cargo-nextest
uses: moonrepo/setup-rust@v0
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
channel: stable
cache-target: release
bins: cargo-nextest
- name: Run sway-lsp tests sequentially
env:
RUST_BACKTRACE: full
run: cargo test --locked --release -p sway-lsp -- --nocapture --test-threads=1
run: cargo nextest run --locked --release -p sway-lsp --no-capture --profile ci --config-file sway-lsp/tests/nextest.toml
cargo-test-workspace:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion sway-lsp/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,6 @@ fn go_to_definition_for_paths() {
lsp::definition_check_with_req_offset(&server, &mut go_to, 7, 11).await;
lsp::definition_check_with_req_offset(&server, &mut go_to, 7, 23).await;

// // TODO: This test stopped working when https://github.com/FuelLabs/sway/pull/6116 was merged.
let mut go_to = GotoDefinition {
req_uri: &uri,
req_line: 22,
Expand Down
6 changes: 6 additions & 0 deletions sway-lsp/tests/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.ci]
retries = 0

[[profile.ci.overrides]]
filter = 'test(go_to_definition_for_paths)'
retries = 2

0 comments on commit 2f4fa65

Please sign in to comment.