Skip to content

fix: skip RPC tests when TESTNET/DEVNET URL is set but empty#3423

Open
radhika-kapoor wants to merge 3 commits intotempoxyz:mainfrom
radhika-kapoor:fix/rpc-tests-failure-devnet-testnet
Open

fix: skip RPC tests when TESTNET/DEVNET URL is set but empty#3423
radhika-kapoor wants to merge 3 commits intotempoxyz:mainfrom
radhika-kapoor:fix/rpc-tests-failure-devnet-testnet

Conversation

@radhika-kapoor
Copy link
Copy Markdown

Problem

The test_matrices_testnet and test_matrices_devnet tests were failing in CI with:

Error: relative URL without a base
Location: crates/node/tests/it/tempo_transaction/rpc.rs:83:19

When a GitHub Actions secret (e.g. TEMPO_TESTNET_RPC_URL) is unavailable for a PR,
GitHub expands it to an empty string "" rather than leaving the variable unset.
std::env::var returns Ok("") for a set-but-empty variable , not Err(_) , so the
old guard fell through to Self::connect(""), which panicked immediately trying to
parse "" as a URL.

Fix

Added .and_then(|u| if u.is_empty() { Err(std::env::VarError::NotPresent) } else { Ok(u) })
before the match in both testnet() and devnet(). This converts Ok("") to
Err(NotPresent) before the match, so the Err(_) arm handles it the same way as a
truly unset variable — returning Ok(None) and skipping the test gracefully.

env var state result
not set skip
set to "" skip (fixed)
set to a real URL connect & run

Test plan

  • Verified failure locally with TEMPO_TESTNET_RPC_URL="" TEMPO_DEVNET_RPC_URL="" cargo nextest run --profile ci-rpc -E 'package(tempo-node) & binary(it) & test(/test_matrices_testnet|test_matrices_devnet/)'
    -> 4 retries, all fail with relative URL without a base
  • Verified fix locally with same command -> test passes with graceful skip

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant