skalenetwork / skalenetwork/node-cli

Improve and Refactor Test Suite for `node-cli`

Open
#852 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
21
Forks
7
Avg merge
2d 17h
Merged PRs (30d)
5

Description

Is your feature request related to a problem? Please describe.

While working on the mirage-boot feature set, it was observed that the current test suite in the node-cli repository is not well-organized and lacks sufficient coverage, particularly for lower-level modules.
Key areas like the operations layer and the docker_utils.py module are either untested or under-tested.
This makes the codebase harder to maintain, refactor, and extend reliably, increasing the risk of regressions.

Specifically:

  • The node_cli/operations/ modules lack dedicated tests.
  • The tests for node_cli/utils/docker_utils.py are not comprehensive.
  • The build script scripts/generate_info.sh lacks automated verification.

Describe the solution you'd like

Refactor the existing test suite structure to improve organization and maintainability.
Implement comprehensive tests for the currently uncovered or under-tested areas, focusing on:

  1. Operations Layer: Add dedicated tests for modules within node_cli/operations/ (e.g., base.py, common.py, skale_node.py, volume.py, docker_lvmpy.py) to ensure core setup, update, and management logic is verified.
  2. docker_utils.py: Expand tests in tests/docker_utils_test.py to cover functionalities like Docker Compose interactions (compose_up, compose_rm, compose_pull), volume checks (is_volume_exists), container status checks (is_container_running, is_api_running), etc.
  3. generate_info.sh Verification: Ensure the build-time script correctly generates type information for different builds (Normal, Sync, Mirage).

The refactoring should aim to make the test suite more robust and easier to modify or extend in the future, potentially mirroring the node_cli source structure more closely within the tests directory (e.g., adding tests/operations).

Describe alternatives you've considered

Considered adding tests incrementally without a major refactor.
However, given the current gaps and the goal of long-term maintainability, a more structured approach including refactoring is deemed more beneficial.

Additional context

  • The codebase currently has three main logical layers: CLI (node_cli/cli/), Core (node_cli/core/), and Operations (node_cli/operations/). Strengthening the test foundation for the Core and especially the Operations layers is crucial.

Contributor guide

No contributing guide indexed for this repository

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

Review the existing tests alongside node_cli/operations/base.py, common.py, skale_node.py, volume.py, docker_lvmpy.py, tests/docker_utils_test.py, and scripts/generate_info.sh. Run the current test suite first, then map the missing coverage and existing test structure. Done means the operations modules, Docker utility behaviors, and Normal, Sync, and Mirage info generation have automated tests in a maintainable layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python, shell
Domain
build-system, cli, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.