Skip to content

Commit

Permalink
fix: switch to --is-view so e2e tests will pass and no breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jan 31, 2024
1 parent cb6563c commit 4ef52d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 11 additions & 3 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use predicates::boolean::PredicateBooleanExt;
use soroban_cli::commands::{
contract::{self, fetch},
keys,
Expand All @@ -19,6 +20,15 @@ async fn invoke() {
extend_contract(sandbox, id, HELLO_WORLD).await;
// Note that all functions tested here have no state
invoke_hello_world(sandbox, id);
sandbox
.new_assert_cmd("events")
.arg("--start-ledger=20")
.arg("--id")
.arg(id)
.assert()
.stdout(predicates::str::contains(id).not())
.success();
invoke_hello_world_with_lib(sandbox, id).await;
sandbox
.new_assert_cmd("events")
.arg("--start-ledger=20")
Expand All @@ -27,8 +37,6 @@ async fn invoke() {
.assert()
.stdout(predicates::str::contains(id))
.success();

invoke_hello_world_with_lib(sandbox, id).await;
invoke_hello_world_with_lib_two(sandbox, id).await;
invoke_auth(sandbox, id);
invoke_auth_with_identity(sandbox, id).await;
Expand All @@ -48,7 +56,7 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) {
sandbox
.new_assert_cmd("contract")
.arg("invoke")
.arg("--sign")
.arg("--is-view")
.arg("--id")
.arg(id)
.arg("--")
Expand Down
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/commands/contract/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ pub struct Cmd {
/// Number of instructions to simulate
#[arg(long)]
pub instructions: Option<u32>,
/// Sign and submit transaction regardless of whether it's a view function
/// Do not sign and submit transaction
#[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")]
pub sign: bool,
pub is_view: bool,
/// Function name as subcommand, then arguments for that function as `--arg-name value`
#[arg(last = true, id = "CONTRACT_FN_AND_ARGS")]
pub slop: Vec<OsString>,
Expand Down Expand Up @@ -304,7 +304,7 @@ impl Cmd {
if let Some(instructions) = self.instructions {
txn = txn.set_max_instructions(instructions);
}
let (return_value, events) = if txn.is_view() && !self.sign {
let (return_value, events) = if self.is_view {
(
txn.sim_res().results()?[0].xdr.clone(),
txn.sim_res().events()?,
Expand Down

0 comments on commit 4ef52d0

Please sign in to comment.