Skip to content

Commit

Permalink
Adapt external-project-test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErakhtinB committed Dec 5, 2024
1 parent 896d815 commit 23eef0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/external-project-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ find_package(kagome CONFIG REQUIRED)

add_executable(main src/main.cpp)
include(link_libraries.cmake)
external_project_link_libraries(main kagome::)
external_project_link_libraries(main kagome::)
1 change: 1 addition & 0 deletions test/external-project-test/link_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function(external_project_link_libraries target prefix)
blockchain
runtime_upgrade_tracker
runtime_properties_cache
GTest::gmock
)
list(TRANSFORM targets PREPEND "${prefix}")
target_link_libraries(${target} ${targets})
Expand Down
10 changes: 6 additions & 4 deletions test/external-project-test/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include <libp2p/common/final_action.hpp>
#include <libp2p/crypto/random_generator/boost_generator.hpp>
#include <libp2p/log/configurator.hpp>
#include "mock/core/blockchain/block_header_repository_mock.hpp"
#include "mock/core/blockchain/block_tree_mock.hpp"

int main() {
libp2p::common::FinalAction flush_std_streams_at_exit([] {
Expand Down Expand Up @@ -68,9 +70,6 @@ int main() {
kagome::storage::RocksDb::create("/tmp/kagome_tmp_db", db_options)
.value();
auto hasher = std::make_shared<kagome::crypto::HasherImpl>();
auto header_repo =
std::make_shared<kagome::blockchain::BlockHeaderRepositoryImpl>(database,
hasher);

using std::string_literals::operator""s;

Expand Down Expand Up @@ -115,7 +114,9 @@ int main() {
std::shared_ptr<kagome::runtime::RuntimeUpgradeTracker>
runtime_upgrade_tracker =
std::move(kagome::runtime::RuntimeUpgradeTrackerImpl::create(
header_repo, database, code_substitutes, std::make_shared<kagome::blockchain::BlockTreeMock>())
database,
code_substitutes,
std::make_shared<kagome::blockchain::BlockTreeMock>())
.value());

auto storage_batch =
Expand Down Expand Up @@ -223,6 +224,7 @@ int main() {
app_config,
module_factory,
std::make_shared<kagome::runtime::WasmInstrumenter>());
auto header_repo = std::make_shared<kagome::blockchain::BlockHeaderRepositoryMock>();
auto module_repo = std::make_shared<kagome::runtime::ModuleRepositoryImpl>(
runtime_instances_pool,
hasher,
Expand Down

0 comments on commit 23eef0b

Please sign in to comment.