Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Refactor TransferAsset acceptance test #1482

Merged
merged 4 commits into from
Jun 25, 2018
Merged

Conversation

l4l
Copy link
Contributor

@l4l l4l commented Jun 19, 2018

Description of the Change

  • Add IntegrationTestFramework::sendTxAwait
  • Reuse AcceptanceFixture primitive in TA test
  • Move out primitive methods in fixture
  • Fix WithOnlyCanTransferPerm/WithOnlyCanReceivePerm tests

Also, I've tried to remove Role::kAddAssetQty from the first user but it seems to have some bug. Feel free to review/comment it as well

Benefits

Lesser simpler code -> lesser bugs

Possible Drawbacks

None?

Usage Examples or Tests

make transfer_asset_test && test_bin/transfer_asset_test

@l4l l4l added needs-review pr awaits review from maintainers refactoring internal stuff, that are changed/removed that doesn't affect client code tests pr aimed at the code coverage increase or test refactorings command All that relates to the commands performing at iroha labels Jun 19, 2018
- Add IntegrationTestFramework::sendTxAwait
- Reuse AcceptanceFixture primitive in TA test
- Move out primitive methods in fixture
- Fix WithOnlyCanTransferPerm/WithOnlyCanReceivePerm tests

Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l force-pushed the fix/transfer_asset_refactor branch from f766c30 to a701b3a Compare June 19, 2018 22:23
* @when execute tx with TransferAsset command
* @then there is an empty proposal
*/
TEST_F(TransferAsset, WithOnlyCanTransferPerm) {
TEST_F(TransferAsset, DISABLED_WithOnlyCanTransferPerm) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please specify in a comment the reason why the test is disabled. If the test can be enabled only after resolution of some other issue, denote it as a todo comment with Jira task id.

* @when execute tx with TransferAsset command
* @then there is an empty proposal
*/
TEST_F(TransferAsset, WithOnlyCanReceivePerm) {
TEST_F(TransferAsset, DISABLED_WithOnlyCanReceivePerm) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please specify in a comment the reason why the test is disabled. If the test can be enabled only after resolution of some other issue, denote it as a todo comment with Jira task id.

.sendTxAwait(create_asset, check(1))
.sendTxAwait(add_assets, check(1))
.sendTxAwait(make_transfer, check(1))
.sendQuery(make_query(kUserId), check_balance(kUserId, kLeft))
.sendQuery(make_query(kUser2Id), check_balance(kUser2Id, kForTransfer))
Copy link
Contributor

@igor-egorov igor-egorov Jun 21, 2018

Choose a reason for hiding this comment

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

Despite the test does not fail, both queries (lines 378, 379) cause postgres' errors:

[2018-06-21 22:45:45.536809398][th:20689][info] IntegrationTestFramework send query
[2018-06-21 22:45:45.543091771][th:20689][error] PostgresWsvQuery ERROR:  invalid input value for enum grantable_perm: ""
LINE 1: ...dmin@test' AND account_id = 'user@test' AND permission = '';
                                                                    ^

[2018-06-21 22:45:45.544989785][th:20689][info] IntegrationTestFramework send query
[2018-06-21 22:45:45.552626695][th:20689][error] PostgresWsvQuery ERROR:  invalid input value for enum grantable_perm: ""
LINE 1: ...n@test' AND account_id = 'usertwo@test' AND permission = '';
                                                                    ^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will be resolved with IR-1464

Copy link
Contributor

@luckychess luckychess left a comment

Choose a reason for hiding this comment

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

Looks good overall but fix test plz.

.finish())
.checkBlock(
[](auto &block) { ASSERT_EQ(block->transactions().size(), 0); })
.sendTxAwait(makeFirstUser(), check(1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently this test doesn't work for both me and CI, fix it please.

@@ -94,7 +94,7 @@ auto AcceptanceFixture::baseTx()

auto AcceptanceFixture::baseQry()
-> decltype(base(TestUnsignedQueryBuilder())) {
return base(TestUnsignedQueryBuilder());
return base(TestUnsignedQueryBuilder()).queryCounter(tx_counter);
Copy link
Contributor

Choose a reason for hiding this comment

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

Plz rename tx_counter -> query_counter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's the same counter for both tx and query, I may rename it to just counter

Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l force-pushed the fix/transfer_asset_refactor branch from 121698e to d02f4f5 Compare June 23, 2018 09:49
Signed-off-by: Kitsu <mail@kitsu.me>
Copy link
Contributor

@igor-egorov igor-egorov left a comment

Choose a reason for hiding this comment

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

Was able to compile only with the fix:

iff --git a/irohad/synchronizer/CMakeLists.txt b/irohad/synchronizer/CMakeLists.txt
index 1f31648..f27f01e 100644
--- a/irohad/synchronizer/CMakeLists.txt
+++ b/irohad/synchronizer/CMakeLists.txt
@@ -3,7 +3,7 @@ add_library(synchronizer
     )
 
 target_link_libraries(synchronizer
-    shared_model_interfaces
+    shared_model_proto_backend
     rxcpp
     logger
     )

@l4l l4l removed the needs-review pr awaits review from maintainers label Jun 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l merged commit fe4232d into develop Jun 25, 2018
@l4l l4l deleted the fix/transfer_asset_refactor branch June 25, 2018 12:28
l4l added a commit that referenced this pull request Jul 25, 2018
- Add IntegrationTestFramework::sendTxAwait
- Reuse AcceptanceFixture primitive in TA test
- Move out primitive methods in fixture
- Fix (and rename accordingly) WithOnlyCanTransferPerm/WithOnlyCanReceivePerm tests
- Rename tx_counter in AcceptanceFixture

Signed-off-by: Kitsu <mail@kitsu.me>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
command All that relates to the commands performing at iroha refactoring internal stuff, that are changed/removed that doesn't affect client code tests pr aimed at the code coverage increase or test refactorings
Development

Successfully merging this pull request may close these issues.

None yet

3 participants