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/03/20 15:51:06 UTC
[ignite-3] 09/19: IGNITE-17607 Add test
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 f140d16b30891c2460b7ce7beb8afed7ab4641a7
Author: Igor Sapego <is...@apache.org>
AuthorDate: Tue Mar 7 17:56:08 2023 +0300
IGNITE-17607 Add test
---
.../cpp/tests/client-test/compute_test.cpp | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/modules/platforms/cpp/tests/client-test/compute_test.cpp b/modules/platforms/cpp/tests/client-test/compute_test.cpp
index 7cbd15cc85..94f274f41e 100644
--- a/modules/platforms/cpp/tests/client-test/compute_test.cpp
+++ b/modules/platforms/cpp/tests/client-test/compute_test.cpp
@@ -56,6 +56,15 @@ protected:
return nodes[id];
}
+ /**
+ * Get nodes as set.
+ * @return Nodes in set.
+ */
+ std::set<cluster_node> get_node_set() {
+ auto nodes = m_client.get_cluster_nodes();
+ return {nodes.begin(), nodes.end()};
+ }
+
/** Ignite client. */
ignite_client m_client;
};
@@ -101,4 +110,27 @@ TEST_F(compute_test, execute_on_specific_node) {
EXPECT_EQ(res2.value().get<std::string>(), PLATFORM_TEST_NODE_RUNNER + "_2:_22");
}
+TEST_F(compute_test, execute_broadcast_one_node) {
+ auto res = m_client.get_compute().broadcast({get_node(1)}, NODE_NAME_JOB, {"42"});
+
+ ASSERT_EQ(res.size(), 1);
+
+ EXPECT_EQ(res.begin()->first, get_node(1));
+
+ ASSERT_TRUE(res.begin()->second.has_value());
+ EXPECT_EQ(res.begin()->second.value(), PLATFORM_TEST_NODE_RUNNER + "_242");
+}
+
+TEST_F(compute_test, execute_broadcast_all_nodes) {
+ auto res = m_client.get_compute().broadcast(get_node_set(), NODE_NAME_JOB, {"42"});
+
+ ASSERT_EQ(res.size(), 2);
+
+ EXPECT_EQ(res[get_node(0)].value(), get_node(0).get_name() + "42");
+ EXPECT_EQ(res[get_node(1)].value(), get_node(1).get_name() + "42");
+}
+
+
+
+