Skip to content

[test] config_profiles.rs must be pure-deserialization or env-gated — live RPC calls break CI on clean checkouts #258

@obchain

Description

@obchain

PR: #51 (feat/23-testnet-config)
File: crates/charon-core/tests/config_profiles.rs (new)
Refs #51

Problem

The PR description says the new test "exercises both profiles." The scope of "exercise" is unspecified. If the test calls ChainProvider::connect(), VenusAdapter::connect(), or any async RPC method, it will fail in CI (no live Chapel RPC endpoint on GitHub Actions).

The established pattern (from PR #39 finding 4): all tests with live IO must be gated with #[ignore] or an env-var guard:

#[tokio::test]
#[ignore = "requires live Chapel RPC — set CHARON_INTEGRATION_TEST=1 and CHARON_BNB_TESTNET_WS_URL"]
async fn testnet_profile_live() { ... }

Pure deserialization tests (no IO) do not require gating and are explicitly encouraged:

#[test]
fn testnet_profile_parses() {
    std::env::set_var("CHARON_BNB_TESTNET_WS_URL", "wss://example.com");
    std::env::set_var("CHARON_BNB_TESTNET_HTTP_URL", "https://example.com");
    let cfg = Config::load("config/testnet.toml").unwrap();
    assert_eq!(cfg.chain["bnb_testnet"].chain_id, 97);
    assert!(cfg.flashloan.is_empty());
    assert!(cfg.liquidator.is_empty());
}

Impact

If tests are not gated: cargo test --workspace fails on every CI run and clean developer checkout. CI becomes non-functional for this branch and any PR stacked on it.

Fix

Audit config_profiles.rs: separate pure-deserialization assertions (no #[ignore]) from any live-RPC assertions (require #[ignore] + env guard). Add a module-level comment documenting which tests require live infrastructure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)priority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick uptype:testTests, fuzz, fork, integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions