Skip to content

Commit

Permalink
fix: update tests with new read output and add durability arg
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Sep 21, 2023
1 parent e1909cf commit c395bf5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 33 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions cmd/crates/soroban-test/tests/it/contract_sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ fn contract_data_read_failure() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.failure()
.stderr(
Expand Down Expand Up @@ -315,9 +316,10 @@ fn contract_data_read() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.success()
.stdout("COUNTER,1\n");
.stdout("COUNTER,1,4096\n");

sandbox
.new_assert_cmd("contract")
Expand All @@ -333,9 +335,10 @@ fn contract_data_read() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.success()
.stdout("COUNTER,2\n");
.stdout("COUNTER,2,4096\n");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestCLIRestore(t *testing.T) {
restoreOutput := runSuccessfulCLICmd(
t,
fmt.Sprintf(
"contract restore --id %s --key COUNTER",
"contract restore --id %s --key COUNTER --durability persistent",
strkeyContractID,
),
)
Expand Down
49 changes: 30 additions & 19 deletions docs/soroban-cli-full-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ Extend the expiry ledger of a contract-data ledger entry.

If no keys are specified the contract itself is bumped.

**Usage:** `soroban contract bump [OPTIONS] --durability <DURABILITY> --ledgers-to-expire <LEDGERS_TO_EXPIRE>`
**Usage:** `soroban contract bump [OPTIONS] --ledgers-to-expire <LEDGERS_TO_EXPIRE> --durability <DURABILITY>`

###### **Options:**

* `--ledgers-to-expire <LEDGERS_TO_EXPIRE>` — Number of ledgers to extend the entries
* `--expiration-ledger-only` — Only print the new expiration ledger
* `--id <CONTRACT_ID>` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be bumped
* `--key <KEY>` — Storage key (symbols only)
* `--key-xdr <KEY_XDR>` — Storage key (base64-encoded XDR)
Expand All @@ -247,8 +249,6 @@ If no keys are specified the contract itself is bumped.
- `temporary`:
Temporary

* `--ledgers-to-expire <LEDGERS_TO_EXPIRE>` — Number of ledgers to extend the entries
* `--expiration-ledger-only` — Only print the new expiration ledger
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down Expand Up @@ -409,21 +409,10 @@ Optimize a WASM file

Print the current value of a contract-data ledger entry

**Usage:** `soroban contract read [OPTIONS] --id <CONTRACT_ID>`
**Usage:** `soroban contract read [OPTIONS] --durability <DURABILITY>`

###### **Options:**

* `--id <CONTRACT_ID>` — Contract ID to invoke
* `--key <KEY>` — Storage key (symbols only)
* `--key-xdr <KEY_XDR>` — Storage key (base64-encoded XDR ScVal)
* `--durability <DURABILITY>` — Storage entry durability

Possible values:
- `persistent`:
Persistent
- `temporary`:
Temporary

* `--output <OUTPUT>` — Type of output to generate

Default value: `string`
Expand All @@ -436,6 +425,19 @@ Print the current value of a contract-data ledger entry
- `xdr`:
XDR

* `--id <CONTRACT_ID>` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be bumped
* `--key <KEY>` — Storage key (symbols only)
* `--key-xdr <KEY_XDR>` — Storage key (base64-encoded XDR)
* `--wasm <WASM>` — Path to Wasm file of contract code to bump
* `--wasm-hash <WASM_HASH>` — Path to Wasm file of contract code to bump
* `--durability <DURABILITY>` — Storage entry durability

Possible values:
- `persistent`:
Persistent
- `temporary`:
Temporary

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand All @@ -453,15 +455,24 @@ Restore an evicted value for a contract-data legder entry.

If no keys are specificed the contract itself is restored.

**Usage:** `soroban contract restore [OPTIONS]`
**Usage:** `soroban contract restore [OPTIONS] --durability <DURABILITY>`

###### **Options:**

* `--id <CONTRACT_ID>` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be restored
* `--id <CONTRACT_ID>` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be bumped
* `--key <KEY>` — Storage key (symbols only)
* `--key-xdr <KEY_XDR>` — Storage key (base64-encoded XDR)
* `--wasm <WASM>` — Path to Wasm file of contract code to restore
* `--wasm-hash <WASM_HASH>` — Hash of contract code to restore
* `--wasm <WASM>` — Path to Wasm file of contract code to bump
* `--wasm-hash <WASM_HASH>` — Path to Wasm file of contract code to bump
* `--durability <DURABILITY>` — Storage entry durability

Possible values:
- `persistent`:
Persistent
- `temporary`:
Temporary

* `--ledgers-to-expire <LEDGERS_TO_EXPIRE>` — Number of ledgers to extend the entry
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down

0 comments on commit c395bf5

Please sign in to comment.