Skip to content

Reconnect a Compilation-Excluded Proposal Lifecycle Test Suite to the Build Graph #1827

Description

@Emmyt24

Description

contracts/governance/src/test.rs (test_initialize, test_cannot_initialize_twice, test_create_proposal, test_unique_proposal_ids) is not declared via any mod statement anywhere in contracts/governance/src/lib.rs — only governance_test, governance_property_test, and governance_bounds_test are wired in as #[cfg(test)] mod ... — so this file is silently excluded from compilation and never runs under cargo test. Meanwhile contracts/governance/test_snapshots/test/*.json fixtures for exactly these four test names still exist in the repo, implying the module used to run. The file also still calls a stale single-argument client.initialize(&token_address), which no longer matches the current two-argument GovernanceContract::initialize(admin: Address, total_supply: i128) in lib.rs.

Requirements and Context

  • Must not change GovernanceContract::initialize's current signature — update the orphaned test file to match it, not the other way around.
  • New/updated tests must be deterministic and reproducible (no reliance on wall-clock time beyond env.ledger() manipulation already used elsewhere in the crate).

Suggested Execution

Branch: test/revive-governance-test-rs

Implement Changes

  • Update every client.initialize(&token_address) call in contracts/governance/src/test.rs to the current client.initialize(&admin, &total_supply) signature, following the setup() helper pattern already used in contracts/governance/src/governance_bounds_test.rs.
  • Update create_proposal calls in test.rs to match its current six-argument signature (creator, description, payload, voting_period, quorum, threshold_percent) instead of the stale five-argument form.
  • Add #[cfg(test)] mod test; to contracts/governance/src/lib.rs alongside the other three test module declarations.
  • Confirm (or regenerate) the corresponding entries under contracts/governance/test_snapshots/test/ so they reflect the current, compiling test bodies rather than stale historical output.

Test and Commit

Run cargo test --lib (and cargo test for proptest/fuzz targets where relevant) in the appropriate contracts/<governance|token-factory> directory, confirming the new coverage passes and cargo build --target wasm32v1-none --release --lib still succeeds.

Example Commit Message

test(contract): revive orphaned governance test.rs module

Closes #<issue>

Guidelines

  • Branch from main, open a PR back to main
  • All new code must have corresponding tests
  • Run cargo fmt --check, cargo clippy, and cargo test --lib before pushing
  • Follow existing naming conventions and file structure
  • PR description must reference this issue number (e.g., Closes #<issue>)
  • Keep commits atomic and use conventional commit format

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcontractSoroban smart contract worktestingTesting-focused contribution

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions