Skip to content
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

Merged

Conversation

ArtObr
Copy link
Contributor

@ArtObr ArtObr commented Feb 20, 2018

No description provided.

ArtObr added 30 commits February 7, 2018 12:28
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]>
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')
Copy link
Contributor

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 ...

Copy link
Contributor Author

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"]
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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))
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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)))
Copy link
Contributor

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sdk_pool_handle):
_, steward_did = sdk_wallet_steward
request = looper.loop.run_until_complete(
build_get_txn_request(steward_did, 1))
Copy link
Contributor

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

Copy link
Contributor Author

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same

Copy link
Contributor Author

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same

Copy link
Contributor Author

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()))
Copy link
Contributor

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

Copy link
Contributor Author

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extend name to RequestNackedException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pass


class RejectError(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extend name to RequestRejectedException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1060,10 +1061,10 @@ def sdk_check_reply(req_res):
raise AssertionError("Got an error with code {} for request {}"
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ArtObr ArtObr changed the title [INDY-1171] Integrate pool_transactions tests with libindy [skip ci] [INDY-1171] Integrate pool_transactions tests with libindy Mar 6, 2018
@ArtObr
Copy link
Contributor Author

ArtObr commented Mar 6, 2018

test this please

@ashcherbakov ashcherbakov merged commit 8a7df59 into hyperledger:master Mar 6, 2018
@ArtObr ArtObr deleted the indy-sdk-integration/INDY-1171 branch March 13, 2018 08:31
lampkin-diet pushed a commit to lampkin-diet/indy-plenum that referenced this pull request Apr 9, 2018
…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]>
lampkin-diet pushed a commit to lampkin-diet/indy-plenum that referenced this pull request Apr 10, 2018
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants