Skip to content

Latest commit

 

History

History
175 lines (132 loc) · 4.59 KB

File metadata and controls

175 lines (132 loc) · 4.59 KB

Workspace Migration Summary

Overview

Successfully migrated the minotari-cli project from a single package structure to a Cargo workspace with two packages:

  • minotari: Main CLI wallet application
  • integration-tests: Cucumber BDD integration tests

Changes Made

Workspace Structure

Created a new workspace root with the following structure:

minotari-cli/
├── Cargo.toml                    # Workspace root
├── minotari/                     # Main package
│   ├── Cargo.toml
│   ├── src/                      # Application source code
│   ├── config/                   # Configuration files
│   ├── migrations/               # Database migrations
│   ├── resources/                # Default resources
│   └── openapi/                  # OpenAPI tests
└── integration-tests/            # Integration tests package
    ├── Cargo.toml
    ├── features/                 # Gherkin feature files
    ├── steps/                    # Cucumber step definitions
    ├── src/                      # Base node process support
    └── tests/
        └── cucumber.rs           # Test runner

Workspace Root (Cargo.toml)

[workspace]
resolver = "2"
members = [
    "minotari",
    "integration-tests",
]

[workspace.package]
version = "0.1.0"
edition = "2024"
authors = ["The Tari Development Community"]
license = "BSD-3-Clause"

Main Package (minotari/Cargo.toml)

  • Updated to use workspace-inherited metadata:
    • version.workspace = true
    • edition.workspace = true
    • authors.workspace = true
    • license.workspace = true
  • Removed cucumber-related dev-dependencies (moved to integration-tests)
  • Retained all production dependencies

Integration Tests Package (integration-tests/Cargo.toml)

New package with:

  • Cucumber BDD framework dependencies
  • Base node integration dependencies (minotari_node, tari_comms, etc.)
  • minotari as a path dependency
  • Test harness configuration: harness = false

File Migrations

From To
src/ minotari/src/
config/ minotari/config/
migrations/ minotari/migrations/
resources/ minotari/resources/
tests/openapi/ minotari/openapi/
tests/cucumber/ integration-tests/
tests/integration_tests.rs integration-tests/tests/cucumber.rs

Documentation Updates

  • Updated root README.md:
    • Added "Project Structure" section
    • Updated test running instructions
    • Fixed test documentation links
  • All integration test documentation moved to integration-tests/

Running Tests

From Workspace Root

# Run integration tests
cargo test -p integration-tests

# Build main package
cargo build -p minotari

# Build entire workspace
cargo build

From Integration Tests Directory

cd integration-tests
cargo test

Benefits

Separation of Concerns

  • Main application and tests are clearly separated
  • Each package has its own dependency tree
  • Tests don't pollute main package dependencies

Better Organization

  • Standard Cargo workspace pattern
  • Easier to navigate and understand
  • Clear module boundaries

Maintainability

  • Independent version management possible
  • Easier to add new packages in the future
  • Better for CI/CD pipeline organization

Development Workflow

  • Can build/test packages independently
  • Faster incremental builds for main package
  • Better IDE support for workspaces

Migration Notes

Symlinks

  • Created symlink integration-tests/tests/steps -> ../steps for test runner access

Path Dependencies

  • Integration tests depend on minotari via: minotari = { path = "../minotari" }
  • All internal paths in test files remain relative and unchanged

Backward Compatibility

  • Original test command cargo test --test integration_tests no longer works
  • New command: cargo test -p integration-tests
  • Documentation updated to reflect new commands

Future Enhancements

Potential additions to the workspace:

  • cli-tools: Additional CLI utilities
  • benchmarks: Performance benchmarking suite
  • examples: Example applications using the wallet library

Verification

To verify the migration:

# Check workspace structure
cargo metadata --format-version 1 | jq '.workspace_members'

# Build all packages
cargo build --workspace

# Run all tests
cargo test --workspace

# Check for issues
cargo check --workspace

References