Skip to content

Add a test suite (sourceable script + stubbed side-effects) #5

@VijitSingh97

Description

@VijitSingh97

Goal

RigForge has no tests (only shellcheck). Bring it to pithead's bar (which sources its script and black-box tests the CLI with docker/sudo stubbed).

Proposed

  • Make rigforge.sh sourceable without side effects — guard main "$@" behind a BASH_SOURCE/_SOURCED check (as pithead does) so functions can be tested in isolation.
  • Black-box test the pure logic with sudo/apt-get/git/make/systemctl/modprobe stubbed on PATH: parse_config, the .local short-hostname handling (:119), DONATION validation, the jq config generation (assert the produced XMRig config), and CPU-profile selection (EPYC / X3D / macOS branches).
  • Live under tests/.

Acceptance

  • rigforge.sh is sourceable; a test runner exercises the logic above with no real side effects.
  • Config-generation output asserted for representative CPUs/OSes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingTests, CI, and test infrastructure

    Type

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions