10000 fix(test): 🐛 update zenroom deprecated statements and move unknown statements to the edge of contracts by matteo-cristino · Pull Request #265 · dyne/restroom-mw · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(test): 🐛 update zenroom deprecated statements and move unknown statements to the edge of contracts #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@babel/preset-env": "^7.12.16",
"@dyne/sawroom-client": "^1.9.0",
"express": "^4.17.2",
"zenroom": "^2.4.2"
"zenroom": "^4.0.0"
},
"packageManager": "yarn@1.22.10"
}
19 changes: 18 additions & 1 deletion packages/core/tests/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,23 @@ test("Check that the middleware is handling if index is not filled for each", as
.post("/api/consensusroom-test-foreach-temp1.chain")
.send(_data);

t.true(res.body.zenroom_errors.logs.includes("Cannot find 'temp' anywhere"));
const lines = JSON.parse(res.body.zenroom_errors.logs);
let trace = null;
for(let log of lines) {
if(log.startsWith("J64 TRACE")) {
const encoded = log.substring("J64 TRACE: ".length);
trace = Buffer.from(encoded, 'base64').toString('utf-8');
break;
}
}
t.truthy(trace);
let found = false
for(let l of JSON.parse(trace)) {
if(l.startsWith("[!]") && l.includes("Cannot find 'temp' anywhere")) {
found = true
break;
}
}
t.true(found);
t.is(res.status, 500);
});
10 changes: 5 additions & 5 deletions test/db/db-broken-no-uri.zen F438
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Rule unknown ignore
Scenario 'ecdh': Create the keypair
Given my name is 'John'
Given I have a database table named 'myTable'
Given I have a database table named 'myCache'
Given I have a 'string dictionary' named 'myZenroomStringDictionary'
# the value of the record could be 0 to max could be
Given I read the record '3' of the table 'myTable' of the database 'myDb1' and save the result into 'myZenroomStringDictionary'
When I create the keypair
When I create the signature of 'myZenroomStringDictionary'
Given my name is 'John'
Given I have a 'string dictionary' named 'myZenroomStringDictionary'
When I create the ecdh key
When I create the ecdh signature of 'myZenroomStringDictionary'
When I create the array of '8' random objects of '256' bits
Then print all data
Then I save the output into the database 'myDb1' into the table 'myTable'
Then I save the 'keypair' into the database 'myDb2' into the table 'myCache'
Then I save the 'keyring' into the database 'myDb2' into the table 'myCache'
6 changes: 3 additions & 3 deletions test/db/db-test-complex.zen
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Rule caller restroom-mw
Rule unknown ignore
Scenario 'ecdh': Create the keypair
Given I am 'John'
Given I have a database uri named 'myDb1'
Given I have a database uri named 'myDb2'
Given I have a database table named 'myTable'
Given I have a database table named 'myCache'
Given I have a 'string dictionary' named 'myZenroomStringDictionary'
# the value of the record could be 0 to max could be
Given I read the record '3' of the table 'myTable' of the database 'myDb1' and save the result into 'myZenroomStringDictionary'
Given I am 'John'
Given I have a 'string dictionary' named 'myZenroomStringDictionary'
When I create the ecdh key
When I create the signature of 'myZenroomStringDictionary'
When I create the array of '8' random objects of '256' bits
Expand Down
16 changes: 8 additions & 8 deletions test/db/raw_query.zen
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Rule caller restroom-mw
Rule unknown ignore
Given I have a database uri named 'database'
Given I execute the SQL statement named 'query_1' on the database named 'database' and save the result into 'result_1'
Given I execute the SQL statement named 'query_2' on the database named 'database' and save the result into 'result_2'
Given I execute the SQL statement named 'query_3' on the database named 'database' and save the result into 'result_3'
Given I execute the SQL statement named 'query_4' on the database named 'database' and save the result into 'result_4'
Given I execute the SQL statement named 'query_5' pass the parameters named 'query5_params' on the database named 'database' and save the result into 'result_5'
Given I execute the SQL statement named 'query_6' pass the parameters named 'query6_params' on the database named 'database' and save the result into 'result_6'
Given I have a 'string dictionary' named 'result_1'
Given I have a 'string dictionary' named 'result_2'
Given I have a 'string dictionary' named 10000 'result_3'
Given I have a 'string dictionary' named 'result_4'
Given I have a 'string array' named 'result_4'
Given I have a 'string dictionary' named 'result_5'
Given I have a 'string dictionary' named 'result_6'
When I execute the SQL statement named 'query_1' on the database named 'database' and save the result into 'result_1'
When I execute the SQL statement named 'query_2' on the database named 'database' and save the result into 'result_2'
When I execute the SQL statement named 'query_3' on the database named 'database' and save the result into 'result_3'
When I execute the SQL statement named 'query_4' on the database named 'database' and save the result into 'result_4'
When I execute the SQL statement named 'query_5' pass the parameters named 'query5_params' on the database named 'database' and save the result into 'result_5'
When I execute the SQL statement named 'query_6' pass the parameters named 'query6_params' on the database named 'database' and save the result into 'result_6'
Then print all data
10 changes: 5 additions & 5 deletions test/fixtures/create-keypair.zen
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ and I rename the 'base64 dictionary' to 'hashedAnswers'

When I create the hash of 'question1'
and I rename the 'hash' to 'question1.hash'
When I insert 'question1.hash' in 'hashedAnswers'
When I move 'question1.hash' in 'hashedAnswers'

When I create the hash of 'question2'
and I rename the 'hash' to 'question2.hash'
When I insert 'question2.hash' in 'hashedAnswers'
When I move 'question2.hash' in 'hashedAnswers'

When I create the hash of 'question3'
and I rename the 'hash' to 'question3.hash'
When I insert 'question3.hash' in 'hashedAnswers'
When I move 'question3.hash' in 'hashedAnswers'

When I create the hash of 'question4'
and I rename the 'hash' to 'question4.hash'
When I insert 'question4.hash' in 'hashedAnswers'
When I move 'question4.hash' in 'hashedAnswers'

When I create the hash of 'question5'
and I rename the 'hash' to 'question5.hash'
When I insert 'question5.hash' in 'hashedAnswers'
When I move 'question5.hash' in 'hashedAnswers'



Expand Down
20 changes: 10 additions & 10 deletions test/fixtures/ethereum_erc20.zen
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
Rule unknown ignore
Given I have a 'string' named 'my decimals'
Given I have a 'string' named 'my name'
Given I have a 'string' named 'my symbol'
Given I have a 'string' named 'my total supply'
Given I have a 'string' named 'decimals'
Given I have a 'string' named 'name'
Given I have a 'string' named 'symbol'
Given I have a 'string' named 'total supply'
Given I have a 'string' named 'my balance'
Given I have a 'string' named 'balance'
Given I have a ethereum endpoint named 'fabchain'
Given I query ethereum for the 'decimals' for erc20 'contract_address' named 'my_decimals'
Given I query ethereum for the 'name' for erc20 'contract_address' named 'my_name'
Expand All @@ -20,4 +10,14 @@ Given I query ethereum for the 'name' for erc20 'contract_address'
Given I query ethereum for the 'symbol' for erc20 'contract_address'
Given I query ethereum for the 'total supply' for erc20 '720f72765775bb85eaaa08bb74442f106d3ffa03'
Given I query ethereum for the 'balance' of 'someone' for erc20 'contract_address'
Given I have a 'string' named 'my decimals'
Given I have a 'string' named 'my name'
Given I have a 'string' named 'my symbol'
Given I have a 'string' named 'my total supply'
Given I have a 'string' named 'decimals'
Given I have a 'string' named 'name'
Given I have a 'string' named 'symbol'
Given I have a 'string' named 'total supply'
Given I have a 'string' named 'my balance'
Given I have a 'string' named 'balance'
Then print data
6 changes: 3 additions & 3 deletions test/fixtures/ethereum_read_token_id.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Rule unknown ignore
Scenario ethereum

Given I have a ethereum endpoint named 'fabchain'
Given I read the erc721 id saved in the transaction 'txid'
Given I read the asset in the erc721 'erc721_id' for contract 'contract_address'
Given I read the owner of the erc721 'erc721_id' for contract 'contract_address'
Given I have a 'ethereum address' named 'contract address'
Given I have a 'number' named 'erc721 id'
Given I read the erc721 id saved in the transaction 'txid'
Given I have a 'ethereum address' named 'owner'
Given I read the owner of the erc721 'erc721_id' for contract 'contract_address'
Given I have a 'string' named 'asset'
Given I read the asset in the erc721 'erc721_id' for contract 'contract_address'

Then print data
4 changes: 2 additions & 2 deletions test/fixtures/ethereum_retrieve.zen
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Rule unknown ignore
Rule unknown ignore
Scenario ethereum
Given I have a ethereum endpoint named 'fabchain'
Given I have a 'hex' named 'poem bytes'
Given I read the ethereum bytes with hash 'myTag' and save the output into 'poem_bytes'
Given I have a 'hex' named 'poem bytes'
When I create the string from the ethereum bytes named 'poem bytes'
When I rename the 'string' to 'poem'

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/ethereum_retrieve_no_exist.zen
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Rule unknown ignore
Rule unknown ignore
Scenario ethereum
Given I have a ethereum endpoint named 'fabchain'
Given I have a 'hex' named 'poem bytes'
Given I read the ethereum bytes with hash 'myTag' and save the output into 'poem_bytes'
Given I have a 'hex' named 'poem bytes'
When I create the string from the ethereum bytes named 'poem bytes'
When I rename the 'string' to 'poem'

Expand Down
7 changes: 4 additions & 3 deletions test/fixtures/ethereum_store.zen
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Rule unknown ignore
Scenario ethereum
Given I have the 'keyring'

Given I have a ethereum endpoint named 'fabchain'
Given I read the ethereum nonce for 'my_address'
Given I have the 'keyring'
Given I have a 'ethereum address' named 'storage contract'
Given I have a 'ethereum nonce'
Given I read the ethereum nonce for 'my_address'
Given I have a 'string' named 'data'
and a 'gas price'
and a 'gas limit'
Expand All @@ -14,5 +15,5 @@ and I use the ethereum transaction to store 'data'

When I create the signed ethereum transaction for chain 'fabt'
Then print the 'signed ethereum transaction'
Then print data
Then I ask ethereum to broadcast the 'signed_ethereum_transaction' and save the transaction id in 'txid'
Then print data
4 changes: 2 additions & 2 deletions test/fixtures/execute_and_save.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Rule unknown ignore
Scenario sawroom: Execute and save on remote endpoint and read
Given that I have a sawroom endpoint named 'endpoint'
And I ask sawroom to execute the smart contract 'contract' with the data 'data' and save the output with the context id 'cid'
And I connect the sawroom endpoint 'endpoint' and read the batch with id 'batchId' and save the output into 'sawroom'
Given I have a 'string dictionary' named 'data'
Given that I have a 'string' named 'contract'
Given that I have a 'string' named 'cid'
Expand All @@ -10,6 +12,4 @@ Given I have a 'string' named 'endpoint'
And I have a 'string' named 'batchId'
And I have a 'string dictionary' named 'sawroom'
When I create the array of '5' random objects of '256' bits
And I ask sawroom to execute the smart contract 'contract' with the data 'data' and save the output with the context id 'cid'
And I connect the sawroom endpoint 'endpoint' and read the batch with id 'batchId' and save the output into 'sawroom'
Then print all data
2 changes: 1 addition & 1 deletion test/fixtures/fabric_init.zen
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# NOTE: this whole script is managed by Restroom-mw, Zenroom does nothing here

Rule caller restroom-mw
Rule unknown ignore
# Set the address of the endpoint as the tls certificate
Given I have a fabric endpoint named 'endpoint' with tls certificate in 'tls'
# More parameter to estabilish the connection (they are given in the config files of fabric)
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/fabric_missing_step.zen
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This api will fail because we have not passed all the inforamtions that restroom
# requires to connect to fabric
Rule caller restroom-mw
Rule unknown ignore
Given I have a fabric endpoint named 'endpoint' with tls certificate in 'tls'
Given I connect to the channel 'channel'
Given I use the chaincode 'chaincode'
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/fabric_read_write.zen
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# NOTE: running the script may take some 10 seconds or more

Rule caller restroom-mw
Rule unknown ignore
# In the first statement we set parameters for the Fabric network, that we know from the config of Fabric
Given I have a fabric endpoint named 'endpoint' with tls certificate in 'tls'

Expand Down
5 changes: 3 additions & 2 deletions test/fixtures/fabric_retrieve.zen
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ Given I connect to msp 'Org1MSP' with certificate in 'certificate' and private k
Given I connect to the channel 'channel'
Given I use the chaincode 'chaincode'

Given I have a 'base64 array' named 'array'
Given I read from 'fabric' the data in tag 'myTag' and save the output into 'array'
Given I read from 'fabric' the data in tag 'myTag2' and save the output into 'array2'

Given I have a 'base64 array' named 'array'
Given I have a 'base64 array' named 'array2'
Given I read from 'fabric' the data in tag 'myTag2' and save the output into 'array2'

When I create the hash of 'array'
When I rename the 'hash' to 'hash1'
When I create the hash of 'array2'
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/files_read_file.zen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rule caller restroom-mw
Rule unknown ignore
# from variable
Given I read the content of 'path'
# from string
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/gpp-sawroom-sample-debug-inplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ blocks:

Scenario 'ecdh': Encrypt a message with the password

Given that I have a sawroom endpoint named 'sawroomEndpoint'
Given that I have a 'string' named 'password'
Given that I have a 'string' named 'myRandom'
Given that I have a sawroom endpoint named 'sawroomEndpoint'

When I encrypt the secret message 'myRandom' with 'password'
Then print the 'secret_message'
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/gpp-sawroom-sample-foreach-inplace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ blocks:

Scenario 'ecdh': Encrypt a message with the password

Given that I have a sawroom endpoint named 'sawroomEndpoint'
Given that I have a 'string' named 'password' inside 'user'
Given that I have a 'string' named 'myRandom' inside 'user'
Given that I have a sawroom endpoint named 'sawroomEndpoint'

When I encrypt the secret message 'myRandom' with 'password'
Then print the 'secret_message'
Expand All @@ -45,8 +45,8 @@ blocks:
Scenario 'ecdh': Decrypt the message with the password

Given that I have a sawroom endpoint named 'endpoint'
And I have a 'secret_message' named 'secret_message' inside 'user'
Given I read from Sawroom the data in tag 'transactionId' inside 'user' and save the output into 'secret_message'
And I have a 'secret_message' named 'secret_message' inside 'user'
Given that I have a 'string' named 'password' inside 'user'

When I decrypt the text of 'secret_message' with 'password'
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/hash-test.zen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Given I have a 'string dictionary' named 'temp'
When I create the hash of 'temp'
When I insert 'hash' in 'temp'
When I move 'hash' in 'temp'
Then print the 'temp'
2 changes: 1 addition & 1 deletion test/fixtures/http-test.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ rule check version 1.0.0
rule unknown ignore
Scenario test: Test api http
Given that I have an endpoint named 'api'
When I create the array of '5' random objects of '256' bits
And I connect to 'api' and save the output
When I create the array of '5' random objects of '256' bits
Then print all data
2 changes: 1 addition & 1 deletion test/fixtures/influxdb_read.zen
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rule caller restroom-mw
Rule unknown ignore

Given I connect to influxdb with the connection object named 'influx'

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/influxdb_read_array.zen
A92E
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rule caller restroom-mw
Rule unknown ignore

Given I connect to influxdb with the connection object named 'influx'

Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/planetmint_store_asset.zen
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ When I create the hash of 'asset'

When I create the planetmint signatures of 'planetmint transaction'

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'

# Zenroom
Then print the data
Then print the 'keyring'

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'
8 changes: 4 additions & 4 deletions test/fixtures/planetmint_store_asset_amount.zen
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ When I create the hash of 'asset'

When I create the planetmint signatures of 'planetmint transaction'

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'

# Zenroom
Then print the data
Then print the 'keyring'

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'
6 changes: 3 additions & 3 deletions test/fixtures/planetmint_store_asset_metadata.zen
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Given I have a 'string' named 'planetmint transaction'

When I create the planetmint signatures of 'planetmint transaction'

# Zenroom
Then print the data

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'

# Zenroom
Then print the data
6 changes: 3 additions & 3 deletions test/fixtures/planetmint_transfer.zen
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Given I have a 'base58' named 'eddsa_public_key'

When I create the planetmint signatures of 'planetmint transaction'

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'
# Zenroom
Then print the data

# Restrom onSuccess
Then I prepare the signed planetmint transaction of 'planetmint_transaction' from 'eddsa_public_key'
Then ask planetmint to broadcast the 'signed_planetmint_transaction'
Loading
0