-
Notifications
You must be signed in to change notification settings - Fork 370
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
[INDY-1171] Integrate pool_transactions tests with libindy #541
[INDY-1171] Integrate pool_transactions tests with libindy #541
Conversation
Signed-off-by: ArtObr <[email protected]>
…erting Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
…on/INDY-1172 Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
…INDY-1171 Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
if (sigseed is None and destination is None): | ||
raise AttributeError('You must specify destination directly or using sigseed') | ||
if (sigseed is not None and destination is not None): | ||
raise AttributeError('You must use only one of: sigseed or destination') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two conditions are simply XOR operation and it would be easier to read and understand one operation.
Rewrite it to something like this
none_sigseed = segseed is None
none_dest = dest is None
if none_sigseed == none_dest : error you should provide only one of ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if nodeIp is not None: data['node_ip'] = nodeIp | ||
if nodePort is not None: data['node_port'] = nodePort | ||
if bls_key is not None: data['blskey'] = bls_key | ||
data['services'] = ["VALIDATOR"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are some tests require to demote node - i.e. set 'services' to empty array [ ], so you can extend this func for such a case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# setting incorrect Ledger_ID | ||
request_json = json.loads(request) | ||
request_json['operation']['ledgerId'] = 5908 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a const INVALID_LEDGER_ID = 5908 and use it instead of raw 5908 in code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# setting incorrect data | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, -23)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here - use named const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# Check with and without ledger id | ||
request_json = json.loads(request) | ||
if i: request_json['operation']['ledgerId'] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't write it in one line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# setting incorrect data | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, randint(100, 1000))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create func - generate_invalid_smthg:
return randint...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
sdk_pool_handle): | ||
_, steward_did = sdk_wallet_steward | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to use raw sdk functions - create wrapper in conftest/helper, add test to sdk_tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# setting incorrect data | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, INVALID_SEQ_NO)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
_, steward_did = sdk_wallet_steward | ||
for i in range(2): | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return randint(500, 1000) | ||
|
||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, generate_non_existing_seq_no())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same - wrapper is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
_, steward_did = sdk_wallet_steward | ||
request = looper.loop.run_until_complete( | ||
build_get_txn_request(steward_did, seqNo)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plenum/common/exceptions.py
Outdated
@@ -280,3 +280,11 @@ def __init__(self, expLen, actLen, *args, **kwargs): | |||
ex_txt = 'Message len {} exceeded allowed limit of {}'.format( | |||
actLen, expLen) | |||
super().__init__(ex_txt, *args, **kwargs) | |||
|
|||
|
|||
class ReqNackError(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend name to RequestNackedException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plenum/common/exceptions.py
Outdated
pass | ||
|
||
|
||
class RejectError(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend name to RequestRejectedException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
plenum/test/helper.py
Outdated
@@ -1060,10 +1061,10 @@ def sdk_check_reply(req_res): | |||
raise AssertionError("Got an error with code {} for request {}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse sdk error code and create specific type for important runtime errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: ArtObr <[email protected]>
Signed-off-by: ArtObr <[email protected]>
test this please |
…er#541) * Additional checks for sdk_ functions Signed-off-by: ArtObr <[email protected]> * Fix for exception handling and new function for "json to object" converting Signed-off-by: ArtObr <[email protected]> * Space and the end Signed-off-by: ArtObr <[email protected]> * Most of test integrated with txnPoolNodeSet Signed-off-by: ArtObr <[email protected]> * 3 test left to do Signed-off-by: ArtObr <[email protected]> * two tests left in INDY-1019. Others integrated Signed-off-by: ArtObr <[email protected]> * Little fixes Signed-off-by: ArtObr <[email protected]> * Import resolve, TODO added Signed-off-by: ArtObr <[email protected]> * New line at the end Signed-off-by: ArtObr <[email protected]> * TODO for import added Signed-off-by: ArtObr <[email protected]> * Unused looper import removed Signed-off-by: ArtObr <[email protected]> * One more test integrated with sdk Signed-off-by: ArtObr <[email protected]> * Fixtures for prev test Signed-off-by: ArtObr <[email protected]> * Unused import removed Signed-off-by: ArtObr <[email protected]> * Start of integration Signed-off-by: ArtObr <[email protected]> * Changes for test_different_request integration with sdk Signed-off-by: ArtObr <[email protected]> * helper changes commited Signed-off-by: ArtObr <[email protected]> * INDY-1172 done with chages at pool_transactions Signed-off-by: ArtObr <[email protected]> * little fix Signed-off-by: ArtObr <[email protected]> * Code structure changes Signed-off-by: ArtObr <[email protected]> * Additinal code structure changes Signed-off-by: ArtObr <[email protected]> * Started sdk integration of tests Signed-off-by: ArtObr <[email protected]> * Review fixes Signed-off-by: ArtObr <[email protected]> * LibIndy versions update Signed-off-by: ArtObr <[email protected]> * temp Signed-off-by: ArtObr <[email protected]> * ha persist test done Signed-off-by: ArtObr <[email protected]> * more tests done Signed-off-by: ArtObr <[email protected]> * review fixes Signed-off-by: ArtObr <[email protected]> * More tests done, some problems Signed-off-by: ArtObr <[email protected]> * more tests done Signed-off-by: ArtObr <[email protected]> * temp Signed-off-by: ArtObr <[email protected]> * more tests Signed-off-by: ArtObr <[email protected]> * all tests done, except one. need more of exception handling Signed-off-by: ArtObr <[email protected]> * exception handling made. One test strange behaviour left Signed-off-by: ArtObr <[email protected]> * Exception handling additional fixes Signed-off-by: ArtObr <[email protected]> * Exception handling fixes. wrapper for builder Signed-off-by: ArtObr <[email protected]> * little tests fix Signed-off-by: ArtObr <[email protected]>
…er#541) * Additional checks for sdk_ functions Signed-off-by: ArtObr <[email protected]> * Fix for exception handling and new function for "json to object" converting Signed-off-by: ArtObr <[email protected]> * Space and the end Signed-off-by: ArtObr <[email protected]> * Most of test integrated with txnPoolNodeSet Signed-off-by: ArtObr <[email protected]> * 3 test left to do Signed-off-by: ArtObr <[email protected]> * two tests left in INDY-1019. Others integrated Signed-off-by: ArtObr <[email protected]> * Little fixes Signed-off-by: ArtObr <[email protected]> * Import resolve, TODO added Signed-off-by: ArtObr <[email protected]> * New line at the end Signed-off-by: ArtObr <[email protected]> * TODO for import added Signed-off-by: ArtObr <[email protected]> * Unused looper import removed Signed-off-by: ArtObr <[email protected]> * One more test integrated with sdk Signed-off-by: ArtObr <[email protected]> * Fixtures for prev test Signed-off-by: ArtObr <[email protected]> * Unused import removed Signed-off-by: ArtObr <[email protected]> * Start of integration Signed-off-by: ArtObr <[email protected]> * Changes for test_different_request integration with sdk Signed-off-by: ArtObr <[email protected]> * helper changes commited Signed-off-by: ArtObr <[email protected]> * INDY-1172 done with chages at pool_transactions Signed-off-by: ArtObr <[email protected]> * little fix Signed-off-by: ArtObr <[email protected]> * Code structure changes Signed-off-by: ArtObr <[email protected]> * Additinal code structure changes Signed-off-by: ArtObr <[email protected]> * Started sdk integration of tests Signed-off-by: ArtObr <[email protected]> * Review fixes Signed-off-by: ArtObr <[email protected]> * LibIndy versions update Signed-off-by: ArtObr <[email protected]> * temp Signed-off-by: ArtObr <[email protected]> * ha persist test done Signed-off-by: ArtObr <[email protected]> * more tests done Signed-off-by: ArtObr <[email protected]> * review fixes Signed-off-by: ArtObr <[email protected]> * More tests done, some problems Signed-off-by: ArtObr <[email protected]> * more tests done Signed-off-by: ArtObr <[email protected]> * temp Signed-off-by: ArtObr <[email protected]> * more tests Signed-off-by: ArtObr <[email protected]> * all tests done, except one. need more of exception handling Signed-off-by: ArtObr <[email protected]> * exception handling made. One test strange behaviour left Signed-off-by: ArtObr <[email protected]> * Exception handling additional fixes Signed-off-by: ArtObr <[email protected]> * Exception handling fixes. wrapper for builder Signed-off-by: ArtObr <[email protected]> * little tests fix Signed-off-by: ArtObr <[email protected]>
No description provided.