Skip to content

Tests: several test files are never compiled/run (silent coverage gap) #10

Description

@Zorlin

Problem

Several test files exist under tests/ but are not declared in their parent mod.rs, so Cargo never compiles or runs them. They pass silently as zero-coverage dead weight. The symptom that surfaced this: create_test_run_state in tests/common/mod.rs was flagged `dead_code` — not because it's unused, but because all of its callers are orphaned.

Confirmed orphans

Parent mod.rs files are missing entries for these existing test files:

mod.rs Declares Missing (orphaned files)
tests/connection/mod.rs command cache.rs, connection.rs, factory.rs, local.rs, ssh.rs
tests/modules/packages/mod.rs apt, homebrew, yum_dnf pacman.rs, zypper.rs
tests/playbooks/mod.rs (others) context.rs, traversal.rs, visitor.rs

How to verify

# this currently exits 0 even though the files above are never run:
cargo test

After wiring a file in (e.g. adding mod pacman; to tests/modules/packages/mod.rs), the compiler will tell you immediately whether it still builds — some of these orphaned files may have bit-rotted against current APIs.

Suggested fix

  1. Add the missing mod declarations to the three mod.rs files above.
  2. Run cargo test and fix any compile failures in the newly-included files (they've been dark, so expect some drift).
  3. Do a broader audit for other orphans — the detection is name-based and can false-negative when a file's basename collides with a directory that is mod'd elsewhere (e.g. connection.rs vs the connection/ dir).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions