Skip to content

Conversation

@AlexD10S
Copy link
Collaborator

@AlexD10S AlexD10S commented Aug 6, 2025

Some of our current unit tests perform expensive operations (e.g., downloading dependencies, building projects) and connect to live networks like Pop Network. This pushed CI unit test runs to over an hour and caused instability when RPC endpoints were unavailable.

Changes

  • Move long-running tests from the unit test layer into integration tests in: pop_chain, pop_contracts and pop_common.
  • Replace cargo test in CI with cargo nextest. (~60% faster, also used in cargo-contract).
  • Remove tests connecting to external RPC endpoints; replace with tests running and closing a local network (ink-node).
  • Optimize chain integration tests by downloading the parachain binary from releases instead of building from source. Build is being test already in the https://github.com/r0gue-io/base-parachain repository.
  • Delete unnecessary unit tests already covered by integration or other unit tests.

Results

  • Unit tests in CI: ↓ from 1h (before) to 35 min (after).
  • Chain integration tests: ↓ from 45+ min to 10 min
  • Local tests: cargo nextest run --lib --bins ↓ to ~400s.
Captura de pantalla 2025-08-08 a las 10 18 34

Closes #535

@AlexD10S AlexD10S force-pushed the tests/clean-tests branch from 3b71f2b to fbfaf27 Compare August 7, 2025 21:00
@AlexD10S AlexD10S marked this pull request as ready for review August 8, 2025 07:49
@AlexD10S AlexD10S changed the title test: clean tests clean up and speed up test suite with nextest Aug 8, 2025
@AlexD10S AlexD10S changed the title clean up and speed up test suite with nextest clean up and speed up test suite with nextest Aug 8, 2025
Co-authored-by: José Molina <[email protected]>
Comment on lines 286 to 331

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 months ago

To resolve this true positive, you should add an explicit permissions block at the top/root of your workflow file (.github/workflows/ci.yml). This block should specify the minimal required permissions for the tasks performed in this workflow. Since none of the jobs in the portion shown require write access to repository contents (they mostly run tests, upload coverage, etc.), it is safe and recommended to use contents: read as the baseline. If any job (such as codecov uploads or release creation) requires further permissions, you can add those types with the least privilege needed (such as pull-requests: write if one creates pull requests). In this case, a root-level block will apply to all jobs unless overridden by a job-specific permissions key.

Specifically:

  • Insert a permissions: block between the workflow name: and the on: key.
  • The block should read:
    permissions:
      contents: read
  • This change limits the default token to read-only for repository contents, supporting the principle of least privilege.
Suggested changeset 1
.github/workflows/ci.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,4 +1,6 @@
 name: ci
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
name: ci
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
@AlexD10S AlexD10S requested review from al3mart and moliholy September 2, 2025 10:02
@AlexD10S AlexD10S requested a review from moliholy September 2, 2025 13:35
Copy link
Member

@al3mart al3mart left a comment

Choose a reason for hiding this comment

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

Awesome improvements! 🔥

@AlexD10S AlexD10S merged commit 2f3f751 into main Sep 2, 2025
22 checks passed
@AlexD10S AlexD10S deleted the tests/clean-tests branch September 2, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: move long-running unit tests to integration suite

4 participants