This is an automated email from the ASF dual-hosted git repository. isapego pushed a commit to branch ignite-17607 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit d84db92eba3939abccc9acdb6d47e9f77855cb63 Author: Igor Sapego <[email protected]> AuthorDate: Tue Mar 7 16:29:47 2023 +0300 IGNITE-17607 Add execute test, fix bug --- .../platforms/cpp/ignite/client/detail/ignite_client_impl.h | 1 + modules/platforms/cpp/tests/client-test/compute_test.cpp | 12 ++++++++++-- .../platforms/cpp/tests/client-test/ignite_runner_suite.h | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/platforms/cpp/ignite/client/detail/ignite_client_impl.h b/modules/platforms/cpp/ignite/client/detail/ignite_client_impl.h index 8e9123332e..55274053f5 100644 --- a/modules/platforms/cpp/ignite/client/detail/ignite_client_impl.h +++ b/modules/platforms/cpp/ignite/client/detail/ignite_client_impl.h @@ -53,6 +53,7 @@ public: , m_connection(cluster_connection::create(m_configuration)) , m_tables(std::make_shared<tables_impl>(m_connection)) , m_sql(std::make_shared<sql_impl>(m_connection)) + , m_compute(std::make_shared<compute_impl>(m_connection)) , m_transactions(std::make_shared<transactions_impl>(m_connection)) {} /** diff --git a/modules/platforms/cpp/tests/client-test/compute_test.cpp b/modules/platforms/cpp/tests/client-test/compute_test.cpp index 10b6e3aa1b..a90b4eac69 100644 --- a/modules/platforms/cpp/tests/client-test/compute_test.cpp +++ b/modules/platforms/cpp/tests/client-test/compute_test.cpp @@ -54,8 +54,7 @@ TEST_F(compute_test, get_cluster_nodes) { return n1.get_name() < n2.get_name(); }); - EXPECT_FALSE(cluster_nodes.empty()); - EXPECT_EQ(2, cluster_nodes.size()); + ASSERT_EQ(2, cluster_nodes.size()); EXPECT_FALSE(cluster_nodes[0].get_id().empty()); EXPECT_FALSE(cluster_nodes[1].get_id().empty()); @@ -68,3 +67,12 @@ TEST_F(compute_test, get_cluster_nodes) { EXPECT_EQ(cluster_nodes[0].get_address().host, cluster_nodes[1].get_address().host); } + +TEST_F(compute_test, execute_on_random_node) { + auto cluster_nodes = m_client.get_cluster_nodes(); + + auto result = m_client.get_compute().execute(cluster_nodes, NODE_NAME_JOB, {}); + + ASSERT_TRUE(result.has_value()); + EXPECT_THAT(result.value().get<std::string>(), ::testing::StartsWith(PLATFORM_TEST_NODE_RUNNER)); +} 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 eba5d5e926..0766823eed 100644 --- a/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h +++ b/modules/platforms/cpp/tests/client-test/ignite_runner_suite.h @@ -43,6 +43,14 @@ public: static constexpr std::string_view TABLE_1 = "tbl1"sv; static constexpr std::string_view TABLE_NAME_ALL_COLUMNS = "tbl_all_columns"sv; + inline static const std::string PLATFORM_TEST_NODE_RUNNER = + "org.apache.ignite.internal.runner.app.PlatformTestNodeRunner"; + + inline static const std::string IT_THIN_CLIENT_COMPUTE_TEST = + "org.apache.ignite.internal.runner.app.client.ItThinClientComputeTest"; + + inline static const std::string NODE_NAME_JOB = IT_THIN_CLIENT_COMPUTE_TEST + "$NodeNameJob"; + static constexpr const char *KEY_COLUMN = "key"; static constexpr const char *VAL_COLUMN = "val";
