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 64972d2429176e610ca407f5a6cf31c06b22dd54 Author: Igor Sapego <[email protected]> AuthorDate: Tue Mar 7 16:38:18 2023 +0300 IGNITE-17607 Add test --- .../cpp/tests/client-test/compute_test.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/platforms/cpp/tests/client-test/compute_test.cpp b/modules/platforms/cpp/tests/client-test/compute_test.cpp index a90b4eac69..b09fd1b11f 100644 --- a/modules/platforms/cpp/tests/client-test/compute_test.cpp +++ b/modules/platforms/cpp/tests/client-test/compute_test.cpp @@ -43,6 +43,19 @@ protected: // remove all } + /** + * Get specific node. + * @param id Node id. + * @return Node. + */ + cluster_node get_node(size_t id) { + auto nodes = m_client.get_cluster_nodes(); + std::sort(nodes.begin(), nodes.end(), [] (const auto &n1, const auto &n2) { + return n1.get_name() < n2.get_name(); + }); + return nodes[id]; + } + /** Ignite client. */ ignite_client m_client; }; @@ -76,3 +89,14 @@ TEST_F(compute_test, execute_on_random_node) { ASSERT_TRUE(result.has_value()); EXPECT_THAT(result.value().get<std::string>(), ::testing::StartsWith(PLATFORM_TEST_NODE_RUNNER)); } + +TEST_F(compute_test, execute_on_specific_node) { + auto res1 = m_client.get_compute().execute({get_node(0)}, NODE_NAME_JOB, {"-", 11}); + auto res2 = m_client.get_compute().execute({get_node(1)}, NODE_NAME_JOB, {":", 22}); + + ASSERT_TRUE(res1.has_value()); + ASSERT_TRUE(res2.has_value()); + + EXPECT_EQ(res1.value().get<std::string>(), PLATFORM_TEST_NODE_RUNNER + "-_11"); + EXPECT_EQ(res2.value().get<std::string>(), PLATFORM_TEST_NODE_RUNNER + "_2:_22"); +}
