From 2f4fa65dcf2287720982ecf6c5eef6d0d7a0c86e Mon Sep 17 00:00:00 2001 From: Joshua Batty Date: Wed, 11 Sep 2024 14:21:08 +1000 Subject: [PATCH] Use cargo-nextest with retries for flaky LSP test (#6521) ## 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. --- .github/workflows/ci.yml | 11 ++++++----- sway-lsp/tests/lib.rs | 1 - sway-lsp/tests/nextest.toml | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 sway-lsp/tests/nextest.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ded2607005..9380c391ee1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/sway-lsp/tests/lib.rs b/sway-lsp/tests/lib.rs index 6f6f1e2fffc..29bba1bd103 100644 --- a/sway-lsp/tests/lib.rs +++ b/sway-lsp/tests/lib.rs @@ -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, diff --git a/sway-lsp/tests/nextest.toml b/sway-lsp/tests/nextest.toml new file mode 100644 index 00000000000..6719d7f0200 --- /dev/null +++ b/sway-lsp/tests/nextest.toml @@ -0,0 +1,6 @@ +[profile.ci] +retries = 0 + +[[profile.ci.overrides]] +filter = 'test(go_to_definition_for_paths)' +retries = 2