Skip to content

Commit

Permalink
chore: add timeout to tester
Browse files Browse the repository at this point in the history
  • Loading branch information
austbot committed Nov 5, 2024
1 parent 860084d commit 1299b2b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/comment-templates/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ comment:
snippets:
- id: check_{{ outhash }}
files:
- 'cout.txt'
- '*.txt'
body: |
```
{{ outcontent }}
Expand Down
2 changes: 1 addition & 1 deletion .github/comment-templates/fmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ comment:
snippets:
- id: fmt_{{ outhash }}
files:
- 'fout.txt'
- '*.txt'
body: |
```
{{ outcontent }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,5 @@ jobs:
sleep 30
./bin/run-node.sh &
sleep 15
cargo run -p bonsol-tester
cargo run -p bonsol-cli deploy -m images/simple/manifest.json -t url --url https://bonsol-public-images.s3.amazonaws.com/simple-68f4b0c5f9ce034aa60ceb264a18d6c410a3af68fafd931bcfd9ebe7c1e42960 -y
cargo run -p bonsol-tester -- 300
17 changes: 11 additions & 6 deletions tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use solana_sdk::signer::Signer;
use solana_sdk::system_program;
use solana_sdk::transaction::VersionedTransaction;

use std::env;
use std::str::FromStr;

#[tokio::main]
Expand All @@ -24,11 +25,13 @@ async fn main() -> Result<()> {
let rpc_client = RpcClient::new(rpc_url.clone());
let bonsol_client = BonsolClient::new(rpc_url);
let signer = Keypair::new();
let args: Vec<String> = env::args().collect();
rpc_client
.request_airdrop(&signer.pubkey(), 100_000_000_000)
.await?;
example_bonsol_program_test(&bonsol_client, &rpc_client, &signer).await?;
example_sdk_test(&bonsol_client, &rpc_client, &signer).await?;
let timeout = args.get(1).map(|s| s.parse::<u64>().unwrap()).unwrap_or(60);
example_bonsol_program_test(&bonsol_client, &rpc_client, &signer, timeout).await?;
example_sdk_test(&bonsol_client, &rpc_client, &signer, timeout).await?;
Ok(())
}

Expand All @@ -38,6 +41,7 @@ async fn example_sdk_test(
bonsol_client: &BonsolClient,
client: &RpcClient,
signer: &dyn Signer,
timeout: u64,
) -> Result<()> {
println!("Running sdk test");
let ea1 = Pubkey::from_str("3b6DR2gbTJwrrX27VLEZ2FJcHrDvTSLKEcTLVhdxCoaf")?;
Expand Down Expand Up @@ -98,10 +102,10 @@ async fn example_sdk_test(
.confirm_transaction_with_spinner(&signature, &bh, CommitmentConfig::confirmed())
.await?;
bonsol_client
.wait_for_claim(signer.pubkey(), &execution_id, Some(20))
.wait_for_claim(signer.pubkey(), &execution_id, Some(timeout))
.await?;
let status = bonsol_client
.wait_for_proof(signer.pubkey(), &execution_id, Some(60))
.wait_for_proof(signer.pubkey(), &execution_id, Some(timeout))
.await?;
if status != ExitCode::Success {
return Err(anyhow::anyhow!("Execution failed"));
Expand All @@ -114,6 +118,7 @@ async fn example_bonsol_program_test(
bonsol_client: &BonsolClient,
client: &RpcClient,
signer: &dyn Signer,
timeout: u64,
) -> Result<()> {
println!("Running Bonsol program test");
let example_program = Pubkey::from_str("exay1T7QqsJPNcwzMiWubR6vZnqrgM16jZRraHgqBGG")?;
Expand Down Expand Up @@ -169,10 +174,10 @@ async fn example_bonsol_program_test(
.confirm_transaction_with_spinner(&signature, &bh, CommitmentConfig::confirmed())
.await?;
bonsol_client
.wait_for_claim(requester, &execution_id, Some(20))
.wait_for_claim(requester, &execution_id, Some(timeout))
.await?;
let status = bonsol_client
.wait_for_proof(requester, &execution_id, Some(60))
.wait_for_proof(requester, &execution_id, Some(timeout))
.await?;
if status != ExitCode::Success {
return Err(anyhow::anyhow!("Execution failed"));
Expand Down

0 comments on commit 1299b2b

Please sign in to comment.