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 Feb 5, 2024
1 parent da41cba commit 4b95cbe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 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
2 changes: 1 addition & 1 deletion docs/soroban-cli-full-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ soroban contract invoke ... -- --help
Possible values: `true`, `false`

* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--sign`Sign and submit transaction regardless of whether it's a view function
* `--is-view`Do not sign and submit transaction

Possible values: `true`, `false`

Expand Down

0 comments on commit 4b95cbe

Please sign in to comment.