stacks-network / stacks-network/stacks-core

Mutation Tests testnet/stacks-node/src/neon_node.rs > process_new_tenures, can_run_microblock_tenure

Open
#4,872 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mutation-testing stale
Dominant language
Rust
Stars
3.1k
Forks
762
Avg merge
4d 6h
Merged PRs (30d)
76

Description

Related #4587

The mutation testing highlighted there are missing unit tests for process_new_tenures.

The steps for making sure the process_new_tenures function has its possible outcomes caught are:

  • remove the skip header #[cfg_attr(test, mutants::skip)]
  • check if mutation tests are caught for these cases:
    • run
    RUST_BACKTRACE=1 BITCOIND_TEST=1 cargo mutants -vV -F "replace RelayerThread::process_new_tenures" -E ": replace .{1,2} with .{1,2} in " --baseline=skip --test-tool=nextest -- --run-ignored all --no-fail-fast --test-threads 1
    
    • case returning true
    • returned returning false
  • create tests if they aren't caught

Same steps for the can_run_microblock_tenure function

RUST_BACKTRACE=1 BITCOIND_TEST=1 cargo mutants -vV -F "replace RelayerThread::can_run_microblock_tenure" -E ": replace .{1,2} with .{1,2} in " --baseline=skip --test-tool=nextest -- --run-ignored all --no-fail-fast --test-threads 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in testnet/stacks-node/src/neon_node.rs and inspect RelayerThread::process_new_tenures and can_run_microblock_tenure. Run the two cargo mutants commands from the issue to check whether true and false outcomes are caught. Remove the test skip attribute and add tests where surviving mutations remain; done means the relevant mutations are caught.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.