Skip to content

Demote 8 #[test] integration tests in src/*.rs out of the cargo test --lib surface #47

@gyorgybalazsi

Description

@gyorgybalazsi

Follow-up from #46 / v0.4.2.

Context

src/*.rs contains 8 functions annotated #[test] that are actually integration tests against Bitsafe API and a real Canton devnet:

  • batch::tests::test_batch_from_csv
  • distribute::tests::test_distribute
  • mint_redeem::attestor::tests::test_get_account_contract_rules
  • mint_redeem::attestor::tests::test_get_token_standard_contracts
  • mint_redeem::mint::tests::test_create_deposit_account_with_credentials
  • mint_redeem::redeem::tests::test_create_withdraw_account_with_credentials
  • split::tests::test_split
  • transfer::tests::test_submit

In any environment without the right env vars + reachable Bitsafe URL + funded devnet party, these panic or fail with HTTP 404 / 400 errors. They pollute cargo test --lib output and create false-failure noise that obscures real test failures.

Importantly, they were the only "tests" the parsers had before #46 — and they couldn't catch the v0.4.1 parser bug because they never reached the parser in any unconfigured environment.

Proposal

Two reasonable paths:

  1. Move to tests/ directory (cargo's convention for integration tests) and gate behind a feature flag like devnet-integration:

    [features]
    devnet-integration = []
    #![cfg(feature = "devnet-integration")]

    Run them only with cargo test --features devnet-integration. cargo test --lib and CI see only the deterministic unit tests (incl. the 23 new parser_tests blocks from fix: v0.4.1 parser regression — migrate cbtc-lib parsers to typed response models #46).

  2. Rename them with a clear prefix like devnet_integration_test_* and gate execution on an env var via #[ignore] + an opt-in pattern. Less clean but doesn't change the directory structure.

(1) is more idiomatic Rust and clearer to readers.

Affected files

  • src/batch.rs, src/distribute.rs, src/mint_redeem/attestor.rs, src/mint_redeem/mint.rs, src/mint_redeem/redeem.rs, src/split.rs, src/transfer.rs.

Out of scope

  • Adding new integration test coverage. This is purely a relocation/gating effort.
  • Removing the tests. They have value when devnet is reachable; we just don't want them mixed in with unit tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceMaintenance, deps, and upgrade work

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions