Skip to content

Commit ab44d8a

Browse files
kikakkzjvff
andauthored
Add exists chain to TestValidator to test new created chain (#3484)
## Motivation If we create new chain with `open_chain` in `contract.rs`, it won't be maintained by `TestValidator` in integration tests. Thus we won't be able to test some functionalities of the new chain in integration tests. For example, if we would like to call operation from another user chain to the created chain's application, the user chain should register the application firstly, then call it. At that time we'll get error `Chain not found` with the `TestValidator`. ## Proposal If we could add exists chain to `TestValidator`, then I think we'll be able to test those created chains in integration tests. ## Test Plan CI ## Release Plan - Nothing to do / These changes follow the usual release cycle. --------- Signed-off-by: Zhao KK <[email protected]> Signed-off-by: Janito Vaqueiro Ferreira Filho <[email protected]> Co-authored-by: Janito Vaqueiro Ferreira Filho <[email protected]>
1 parent ca3b405 commit ab44d8a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

linera-sdk/src/test/validator.rs

+5
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ impl TestValidator {
195195
self.new_chain_with_keypair(key_pair).await
196196
}
197197

198+
/// Adds an existing [`ActiveChain`].
199+
pub fn add_chain(&self, chain: ActiveChain) {
200+
self.chains.insert(chain.id(), chain);
201+
}
202+
198203
/// Adds a block to the admin chain to create a new chain.
199204
///
200205
/// Returns the [`ChainDescription`] of the new chain.

0 commit comments

Comments
 (0)