Skip to content

Commit

Permalink
chore: add way to invoke cargo from go code in effort to reuse rust t…
Browse files Browse the repository at this point in the history
…ests (#967)

* feat: use sim preamble to restore needed entries

Currently the test uses a sleep because it has been a struggle to get an entry's expiration

* Stop using a magic wait time and clean-up the code

* feat: run cargo tests from go

First example of using `cargo test` from the go code.

* feat: add all tests from hello_world tests

* fix: remove failing and overlapping tests

* chore: add wrap test to show contract is created successfully

* chore: remove comment

* feat: organize CLI tests so that they can be invoked programatically

* feat: use sim preamble to restore needed entries

Currently the test uses a sleep because it has been a struggle to get an entry's expiration

* Stop using a magic wait time and clean-up the code

* fix: remove extraneous test

Since other tests will deploy hello_world this adds nothing

---------

Co-authored-by: Alfonso Acosta <[email protected]>
  • Loading branch information
willemneal and 2opremio authored Sep 23, 2023
1 parent b5b0b78 commit 1d20f08
Show file tree
Hide file tree
Showing 7 changed files with 420 additions and 108 deletions.
6 changes: 5 additions & 1 deletion cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ impl TestEnv {
/// A convenience method for using the invoke command.
pub fn invoke<I: AsRef<str>>(&self, command_str: &[I]) -> Result<String, invoke::Error> {
let cmd = contract::invoke::Cmd::parse_arg_vec(
&command_str.iter().map(AsRef::as_ref).collect::<Vec<_>>(),
&command_str
.iter()
.map(AsRef::as_ref)
.filter(|s| !s.is_empty())
.collect::<Vec<_>>(),
)
.unwrap();
self.invoke_cmd(cmd)
Expand Down
Loading

0 comments on commit 1d20f08

Please sign in to comment.