You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by is...@apache.org on 2023/01/24 12:41:33 UTC
[ignite-3] 02/02: IGNITE-18583 Implement node startup waiting
This is an automated email from the ASF dual-hosted git repository.
isapego pushed a commit to branch ignite-18583
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 0b0264d873bdf6e857b9ae239a1cbf2b1bec21e8
Author: Igor Sapego <is...@apache.org>
AuthorDate: Tue Jan 24 16:37:00 2023 +0400
IGNITE-18583 Implement node startup waiting
---
.../platforms/cpp/tests/client-test/ignite_runner_suite.h | 2 +-
modules/platforms/cpp/tests/client-test/main.cpp | 12 ++++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h b/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h
index 20e152e735..3ffc59d38d 100644
--- a/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h
+++ b/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h
@@ -36,7 +36,7 @@ using namespace std::string_view_literals;
* Test suite.
*/
class ignite_runner_suite : public ::testing::Test {
-protected:
+public:
static constexpr std::initializer_list<std::string_view> SINGLE_NODE_ADDR = {"127.0.0.1:10942"sv};
static constexpr std::initializer_list<std::string_view> NODE_ADDRS = {"127.0.0.1:10942"sv, "127.0.0.1:10943"sv};
static constexpr std::string_view TABLE_1 = "tbl1"sv;
diff --git a/modules/platforms/cpp/tests/client-test/main.cpp b/modules/platforms/cpp/tests/client-test/main.cpp
index 00a871e5d6..b3538207f9 100644
--- a/modules/platforms/cpp/tests/client-test/main.cpp
+++ b/modules/platforms/cpp/tests/client-test/main.cpp
@@ -16,6 +16,7 @@
*/
#include "ignite_runner.h"
+#include "ignite_runner_suite.h"
#include "test_utils.h"
#include <ignite/common/ignite_error.h>
@@ -58,6 +59,14 @@ void set_process_abort_handler(std::function<void(int)> handler) {
signal(SIGSEGV, signal_handler);
}
+void wait_node_startup(std::chrono::seconds timeout) {
+ using namespace ignite;
+ for (auto addr : ignite_runner_suite::NODE_ADDRS) {
+ ignite_client_configuration cfg{addr};
+ auto client = ignite_client::start(cfg, timeout);
+ }
+}
+
int main(int argc, char **argv) {
if (ignite::single_node_mode())
std::cout << "Tests run in a single-node mode." << std::endl;
@@ -75,8 +84,7 @@ int main(int argc, char **argv) {
try {
runner.start();
- // TODO: Implement node startup await
- std::this_thread::sleep_for(std::chrono::seconds(60));
+ wait_node_startup(std::chrono::seconds(60));
::testing::InitGoogleTest(&argc, argv);
[[maybe_unused]] int run_res = RUN_ALL_TESTS();