Skip to content

Commit

Permalink
CmdService improvements from review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Egorov <igor@soramitsu.co.jp>
  • Loading branch information
Igor Egorov authored and lebdron committed Oct 25, 2019
1 parent 2a3f5cc commit a885c5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion irohad/torii/impl/command_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ namespace iroha {
cache_->addItem(request, response);
return response;
},
[this, &request](const auto &) {
[this, &request](
const iroha::ametsuchi::tx_cache_status_responses::Committed &) {
std::shared_ptr<shared_model::interface::TransactionResponse>
response = status_factory_->makeCommitted(request);
cache_->addItem(request, response);
Expand Down
12 changes: 7 additions & 5 deletions test/module/irohad/torii/command_service_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ TEST_F(CommandServiceTest, ProcessBatchOn) {
/**
* @given initialized command service
* @when status of a transaction is queried
* @and im-memory cache does not contain info about the transaction
* @and in-memory cache does not contain info about the transaction
* @and the transaction is saved to the ledger as Rejected
* @then query response tells that the transaction has been rejected
*/
Expand All @@ -148,8 +148,10 @@ TEST_F(CommandServiceTest, RejectedTxStatus) {

initCommandService();
auto response = command_service_->getStatus(hash);
iroha::visit_in_place(
response->get(),
[](const shared_model::interface::RejectedTxResponse &) {},
[](const auto &a) { FAIL() << "Wrong response!"; });

ASSERT_NO_THROW({
boost::get<const shared_model::interface::RejectedTxResponse &>(
response->get());
}) << "Wrong response. Expected: RejectedTxResponse, Received: "
<< response->toString();
}

0 comments on commit a885c5e

Please sign in to comment.