Skip to content

Commit

Permalink
[Testing] Refactor tests [part2]
Browse files Browse the repository at this point in the history
FIXME FakePeerFixture StorageType::kPostgres

/build all

Signed-off-by: kuvaldini <[email protected]>
  • Loading branch information
kuvaldini committed Sep 1, 2021
1 parent e90a5f3 commit 2b7b3f6
Show file tree
Hide file tree
Showing 27 changed files with 2,100 additions and 2,148 deletions.
4 changes: 2 additions & 2 deletions .github/build-iroha1.src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
if: ${{ steps.comment_body.outcome == 'skipped' }} ## i.e. not github.event.issue.pull_request
run: |
set -x
git fetch origin ${{github.event.after}} --depth=2
git fetch origin ${{github.event.after}} --depth=2 ## depth=2 to detect if fetched commit is merge commit
git log -1 FETCH_HEAD
commit_message_body_build_spec(){
git log -n1 $1 --format=%B | grep '^/build '
Expand Down Expand Up @@ -620,7 +620,7 @@ jobs:
f=ctest_$t.out
if a=$(grep_failed_tests $f | exclude_allowed_to_fail | list_to_line) ;then
#${t^^} ## FixMe install bash 5.0 on macos
echo "::error::The following $t tests FAILED but not in list ALLOW_TO_FAIL: $a"
echo "::error::The following ${t^^} tests FAILED but not in list ALLOW_TO_FAIL: $a"
tests_passed=false
fi
if o=$(grep_failed_tests $f | only_allowed_to_fail | list_to_line) ;then
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-iroha1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
if: ${{ steps.comment_body.outcome == 'skipped' }} ## i.e. not github.event.issue.pull_request
run: |
set -x
git fetch origin ${{github.event.after}} --depth=2
git fetch origin ${{github.event.after}} --depth=2 ## depth=2 to detect if fetched commit is merge commit
git log -1 FETCH_HEAD
commit_message_body_build_spec(){
git log -n1 $1 --format=%B | grep '^/build '
Expand Down Expand Up @@ -663,7 +663,7 @@ jobs:
f=ctest_$t.out
if a=$(grep_failed_tests $f | exclude_allowed_to_fail | list_to_line) ;then
#${t^^} ## FixMe install bash 5.0 on macos
echo "::error::The following $t tests FAILED but not in list ALLOW_TO_FAIL: $a"
echo "::error::The following ${t^^} tests FAILED but not in list ALLOW_TO_FAIL: $a"
tests_passed=false
fi
if o=$(grep_failed_tests $f | only_allowed_to_fail | list_to_line) ;then
Expand Down Expand Up @@ -932,7 +932,7 @@ jobs:
f=ctest_$t.out
if a=$(grep_failed_tests $f | exclude_allowed_to_fail | list_to_line) ;then
#${t^^} ## FixMe install bash 5.0 on macos
echo "::error::The following $t tests FAILED but not in list ALLOW_TO_FAIL: $a"
echo "::error::The following ${t^^} tests FAILED but not in list ALLOW_TO_FAIL: $a"
tests_passed=false
fi
if o=$(grep_failed_tests $f | only_allowed_to_fail | list_to_line) ;then
Expand Down Expand Up @@ -1195,7 +1195,7 @@ jobs:
f=ctest_$t.out
if a=$(grep_failed_tests $f | exclude_allowed_to_fail | list_to_line) ;then
#${t^^} ## FixMe install bash 5.0 on macos
echo "::error::The following $t tests FAILED but not in list ALLOW_TO_FAIL: $a"
echo "::error::The following ${t^^} tests FAILED but not in list ALLOW_TO_FAIL: $a"
tests_passed=false
fi
if o=$(grep_failed_tests $f | only_allowed_to_fail | list_to_line) ;then
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ set(SM_SCHEMA_DIR "${PROJECT_SOURCE_DIR}/shared_model/schema")
set(SCHEMA_OUT_DIR ${CMAKE_BINARY_DIR}/schema)
set(GO_GENERATED_SCHEMA_PATH "${CMAKE_BINARY_DIR}/schema_go")
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/shared_model
${PROJECT_SOURCE_DIR}/irohad
${PROJECT_SOURCE_DIR}/libs
Expand Down
11 changes: 6 additions & 5 deletions libs/common/disable_warnings.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
# define DISABLE_WARNING_uninitialized // TODO
# define DISABLE_WARNING_maybe_uninitialized // TODO
# define DISABLE_WARNING_missing_field_initializers // TODO
// other warnings you want to deactivate...

#elif defined(__GNUC__) || defined(__clang__)
#elif defined(__GNUC__) || defined(__clang__) // Apple Clang defines both

# define DO_PRAGMA(X) _Pragma(#X)

Expand All @@ -31,11 +30,14 @@
# define DISABLE_WARNING_unused_parameter DISABLE_WARNING(-Wunused-parameter)
# define DISABLE_WARNING_unused_function DISABLE_WARNING(-Wunused-function)
# define DISABLE_WARNING_uninitialized DISABLE_WARNING(-Wuninitialized)
# define DISABLE_WARNING_maybe_uninitialized DISABLE_WARNING(-Wmaybe-uninitialized)
# define DISABLE_WARNING_missing_field_initializers DISABLE_WARNING(-Wmissing-field-initializers)
// clang-format on

// other warnings you want to deactivate...
# if defined(__clang__)
# define DISABLE_WARNING_maybe_uninitialized //ToDo
# elif defined(__GNUC__)
# define DISABLE_WARNING_maybe_uninitialized DISABLE_WARNING(-Wmaybe-uninitialized)
# endif

#else

Expand All @@ -46,6 +48,5 @@
# define DISABLE_WARNING_uninitialized
# define DISABLE_WARNING_maybe_uninitialized
# define DISABLE_WARNING_missing_field_initializers
// other warnings you want to deactivate...

#endif
2 changes: 1 addition & 1 deletion libs/common/radix_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace iroha {
typename AlphabetT = Alphabet,
typename CharT = char,
uint32_t KeySz = 16ul,
typename AllocT = std::allocator<void>>
typename AllocT = std::allocator<char>>
class RadixTree {
struct NodeContext {
NodeContext *parent;
Expand Down
3 changes: 2 additions & 1 deletion test/benchmark/bm_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

using namespace benchmark::utils;
using namespace common_constants;
using namespace integration_framework;
using shared_model::interface::types::PublicKeyHexStringView;

/**
Expand All @@ -24,7 +25,7 @@ using shared_model::interface::types::PublicKeyHexStringView;
static void BM_QueryAccount(benchmark::State &state) {
for (auto const type :
{iroha::StorageType::kPostgres, iroha::StorageType::kRocksDb}) {
integration_framework::IntegrationTestFramework itf(1, type);
IntegrationTestFramework itf(1, GetParam());
itf.setInitialState(kAdminKeypair);
itf.sendTx(
createUserWithPerms(
Expand Down
8 changes: 5 additions & 3 deletions test/framework/batch_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,14 @@ namespace framework {
*/
auto createBatchOneSignTransactions(
const shared_model::interface::types::BatchType batch_type,
std::vector<shared_model::interface::types::AccountIdType>
transactions_creators,
const std::vector<shared_model::interface::types::AccountIdType>
&transactions_creators,
size_t now = iroha::time::now(),
const shared_model::interface::types::QuorumType &quorum = 1) {
std::vector<std::pair<shared_model::interface::types::BatchType,
shared_model::interface::types::AccountIdType>>
batch_types_and_creators;
batch_types_and_creators.reserve(transactions_creators.size());
for (const auto &creator : transactions_creators) {
batch_types_and_creators.emplace_back(batch_type, creator);
}
Expand Down Expand Up @@ -213,8 +214,9 @@ namespace framework {
auto batch_type = shared_model::interface::types::BatchType::ATOMIC;
std::vector<std::pair<decltype(batch_type), std::string>>
transaction_fields;
transaction_fields.reserve(size);
for (size_t i = 0; i < size; ++i) {
transaction_fields.push_back(std::make_pair(
transaction_fields.emplace_back(std::make_pair(
batch_type, "account" + std::to_string(i) + "@domain"));
}

Expand Down
12 changes: 7 additions & 5 deletions test/integration/acceptance/acceptance_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
#ifndef IROHA_ACCEPTANCE_FIXTURE_HPP
#define IROHA_ACCEPTANCE_FIXTURE_HPP

#include <gtest/gtest.h>

#include <functional>
#include <string>
#include <vector>

#include <gtest/gtest.h>
#include "backend/protobuf/transaction_responses/proto_tx_response.hpp"
#include "cryptography/keypair.hpp"
#include "framework/common_constants.hpp"
#include "interfaces/common_objects/string_view_types.hpp"
#include "interfaces/permissions.hpp"
#include "interfaces/query_responses/query_response.hpp"
#include "interfaces/transaction_responses/tx_response.hpp"
#include "main/startup_params.hpp"
#include "module/shared_model/builders/protobuf/test_query_builder.hpp"
#include "module/shared_model/builders/protobuf/test_transaction_builder.hpp"

Expand Down Expand Up @@ -116,10 +118,10 @@ class AcceptanceFixture : public ::testing::Test {
template <typename Builder>
auto base(Builder builder,
const shared_model::interface::types::AccountIdType &account_id)
-> decltype(
builder
.creatorAccountId(shared_model::interface::types::AccountIdType())
.createdTime(uint64_t()));
-> decltype(builder
.creatorAccountId(
shared_model::interface::types::AccountIdType())
.createdTime(uint64_t()));

/**
* Create valid base pre-built transaction with specified creator
Expand Down
Loading

0 comments on commit 2b7b3f6

Please sign in to comment.