contracts: Add integration tests against Stellar testnet + CI job (#696) - #926
contracts: Add integration tests against Stellar testnet + CI job (#696)#926thisstk wants to merge 1 commit into
Conversation
|
Someone is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@thisstk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds a feature-gated integration test for the contracts crate that exercises the full on-chain flow against Stellar Testnet: deploy → create_stream → pause → resume → claim.
Adds a nightly CI job to deploy the contract to Testnet and run the integration tests automatically.
Files changed
contracts/Cargo.toml: added an integration feature and chrono dev-dependency. (contracts/Cargo.toml)
contracts/tests/integration_test.rs:
new integration test guarded with #[cfg(feature = "integration")]. The test deploys using scripts/deploy.sh, invokes create_stream, pause_stream, resume_stream, and claim via soroban CLI, and prints events/tx output. (contracts/tests/integration_test.rs)
.github/workflows/contract-smoke.yml: added contract-integration job that creates a funded test account and runs cargo test --manifest-path contracts/Cargo.toml --features integration. (.github/workflows/contract-smoke.yml)
$env:TESTNET_SECRET = "S................................"
cargo test --manifest-path contracts/Cargo.toml --features integration -- --nocapture
The test shells out to the repository script scripts/deploy.sh and the soroban CLI to deploy and interact with the contract. It expects TESTNET_SECRET to contain a funded testnet account secret key. If TESTNET_SECRET is not set the test will skip itself (prints a skip message).
CI job provisions a temporary deployer via soroban keys generate ..., funds it with Friendbot, deploys the contract, and runs the tests. The workflow runs nightly and on manual dispatch.
Acceptance criteria mapping
Tests runnable with cargo test -- implemented (feature added and tests located under contracts/tests/).
CI runs nightly against Testnet: implemented in .github/workflows/contract-smoke.yml as contract-integration job (scheduled nightly).
Test logs include tx hashes and events: test prints deploy output, invocation output, and soroban contract events output so tx hashes are surfaced to logs.
Security / operational notes
The integration test requires a funded Testnet account secret; CI generates and uses a transient funded account for test runs. Do not commit long-term secrets to the repo.
The integration test uses CLI tools (soroban) and sh. CI job installs soroban-cli. Running locally on Windows may require WSL or appropriate shell support.
Follow-ups / optional improvements
Add stronger assertions checking contract storage state after each action (right now the test checks successful command outputs and events — we can extend to validate state via CLI or SDK calls).
Add --no-deploy mode and reuse a pre-deployed contract ID for faster CI iteration.
Add a gh-based PR automation step once the repository standardizes on a fork+upstream workflow for contributors.
( Closed #696 )