Skip to content

Commit

Permalink
Fix faucet timeout in long faucet chain test (#2721)
Browse files Browse the repository at this point in the history
* Add `forget_chain` method to wallet CLI wrapper

Allow removing chains from the wallet in tests.

* Forget irrelevant newly created chains in test

The chains only serve to increase the Faucet chain's length in a way
that simulates the Faucet from being executed for a long time, so they
can be forgotten after they have been created.
  • Loading branch information
jvff authored Oct 27, 2024
1 parent a0003ce commit b9b94c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions linera-service/src/cli_wrappers/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,16 @@ impl ClientWrapper {
Ok(())
}

/// Runs `linera wallet forget-chain CHAIN_ID`.
pub async fn forget_chain(&self, chain_id: ChainId) -> Result<()> {
let mut command = self.command().await?;
command
.args(["wallet", "forget-chain"])
.arg(chain_id.to_string());
command.spawn_and_wait_for_stdout().await?;
Ok(())
}

pub async fn retry_pending_block(
&self,
chain_id: Option<ChainId>,
Expand Down
3 changes: 2 additions & 1 deletion linera-service/tests/linera_net_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2867,9 +2867,10 @@ async fn test_end_to_end_faucet_with_long_chains(config: impl LineraNetConfig) -

// Use the faucet directly to initialize many chains
for _ in 0..chain_count {
faucet_client
let (_, new_chain_id) = faucet_client
.open_chain(faucet_chain, None, Amount::ONE)
.await?;
faucet_client.forget_chain(new_chain_id).await?;
}

let amount = Amount::ONE;
Expand Down

0 comments on commit b9b94c5

Please sign in to comment.