Skip to content

Test Coverage: Focus on High-Value Areas for v1.0 #462

@joshrotenberg

Description

@joshrotenberg

Current Coverage Status

Overall: 24.35% (3,815/15,670 lines)

Based on tarpaulin analysis, our coverage breakdown is:

✅ Excellent Coverage (Already Achieved)

  • redis-cloud library: ~95%+ (all handlers tested via wiremock)
  • redis-enterprise library: ~100% (all handlers tested via wiremock)
  • redisctl-config: 76% core config coverage
  • 225 CLI integration tests already exist

⚠️ Low Coverage Areas

Why the low overall number?
CLI command implementations (thin wrappers around library APIs) have 0% unit test coverage. These are mostly glue code: parse args → call library → format output. The underlying libraries are already well-tested.

Strategic Testing Goals for v1.0

Target: 50-60% overall coverage by focusing on high-complexity, high-risk areas.

Priority 1: Critical Utilities (High Complexity)

  • Async operation utilities (commands/cloud/async_utils.rs: 0/114 lines)

    • Polling logic, timeout handling
    • Error recovery and retries
    • User-facing progress messages
    • Impact: Core UX feature used by most commands
  • Output formatting (output.rs: 15/56 - 27%)

    • JSON/YAML/Table rendering
    • JMESPath query filtering
    • Error message formatting
    • Impact: Used by every command
  • Support package system (8/475 lines - 2%)

    • support_package.rs: Binary tar.gz handling
    • optimizer.rs: 33/86 (38%) - compression logic
    • upload.rs: 0/50 - Files.com integration
    • Impact: Critical troubleshooting tool

Priority 2: Workflow Orchestration (Multi-Step Operations)

  • Cloud subscription setup (workflows/cloud/subscription_setup.rs: 0/226)

    • Multi-step provisioning
    • Rollback logic
    • Error handling across steps
  • Enterprise cluster initialization (workflows/enterprise/init_cluster.rs: 0/173)

    • Cluster bootstrap
    • Node joining
    • Configuration validation

Priority 3: Integration Test Expansion

Instead of unit testing every CLI command wrapper, add targeted integration tests:

  • Async operations end-to-end (create with --wait)
  • Output format validation (JSON, YAML, table)
  • Error handling and user messages
  • Workflow success and rollback scenarios
  • Support package generation and optimization

Priority 4: Edge Cases & Error Paths

  • Credential storage (redisctl-config/credential.rs: 15/50 - 30%)
  • Main CLI routing and error handling (main.rs: 104/568 - 18%)
  • Connection setup edge cases (connection.rs: 123/152 - 81% → 90%+)
  • Profile command error handling (commands/profile.rs: 228/384 - 59% → 70%+)

Non-Goals

We will NOT aim for 80%+ coverage of:

  • Basic CLI command wrappers (thin presentation layer)
  • Simple CRUD operation implementations
  • Argument parsing (covered by clap and integration tests)

These provide low testing ROI since the underlying libraries are already well-tested.

Success Criteria

  • 50-60% overall coverage (up from 24.35%)
  • 70%+ coverage for async utilities
  • 60%+ coverage for workflows
  • 70%+ coverage for support package system
  • 50%+ coverage for output formatting
  • Coverage reporting integrated into CI
  • Document testing strategy in CONTRIBUTING.md

Implementation Plan

Week 1-2: Priority 1 items (async utils, output formatting, support package)
Week 3: Priority 2 items (workflows)
Week 4: Priority 3 & 4 (integration tests, edge cases)

Related Issues

Closes #2 (replaced with this more focused approach)

References

  • Coverage report: lcov.info (generated by cargo tarpaulin)
  • Analysis shows libraries at 95-100%, CLI glue code at 0-30%

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicParent issue tracking multiple related issuestestingRelated to tests and test coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions