[sheepdog] [PATCH] tests/unit: fixed unittest error

Kai Zhang kyle at zelin.io
Thu Jul 18 11:39:45 CEST 2013


Unittest is broken by previous series about membership management.

Signed-off-by: Kai Zhang <kyle at zelin.io>
---
 tests/unit/sheep/mock_group.c          |    5 +++--
 tests/unit/sheep/test_cluster_driver.c |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/unit/sheep/mock_group.c b/tests/unit/sheep/mock_group.c
index 7df96fd..b05891d 100644
--- a/tests/unit/sheep/mock_group.c
+++ b/tests/unit/sheep/mock_group.c
@@ -18,12 +18,13 @@
 MOCK_VOID_METHOD(sd_accept_handler, const struct sd_node *joined,
 		 const struct sd_node *members, size_t nr_members,
 		 const void *opaque)
+MOCK_VOID_METHOD(sd_join_handler, const struct sd_node *joining,
+		 const struct sd_node *nodes, size_t nr_nodes,
+		 void *opaque)
 MOCK_VOID_METHOD(sd_leave_handler, const struct sd_node *left,
 		 const struct sd_node *members, size_t nr_members)
 MOCK_VOID_METHOD(sd_notify_handler, const struct sd_node *sender, void *msg,
 		 size_t msg_len)
 MOCK_METHOD(sd_block_handler, bool, true, const struct sd_node *sender)
 MOCK_METHOD(sd_reconnect_handler, int, 0)
-MOCK_VOID_METHOD(sd_check_join_cb, const struct sd_node *joining,
-		 const struct sd_node *nodes, size_t nr_nodes, void *opaque)
 MOCK_VOID_METHOD(sd_update_node_handler, struct sd_node *node)
diff --git a/tests/unit/sheep/test_cluster_driver.c b/tests/unit/sheep/test_cluster_driver.c
index 02b6224..9e868ad 100644
--- a/tests/unit/sheep/test_cluster_driver.c
+++ b/tests/unit/sheep/test_cluster_driver.c
@@ -54,8 +54,9 @@ static void do_test(const char *arg)
 	assert_ret(driver->init(option), 0);
 	assert_ret(driver->join(&node, msg, len), 0);
 
-	LOOP_WHEN(method_nr_call(sd_check_join_cb) == 0);
+	LOOP_WHEN(method_nr_call(sd_join_handler) == 0);
 	LOOP_WHEN(method_nr_call(sd_accept_handler) == 0);
+	ck_assert_int_eq(method_nr_call(sd_join_handler), 1);
 	ck_assert_int_eq(method_nr_call(sd_accept_handler), 1);
 
 	assert_ret(driver->block(), 0);
-- 
1.7.9.5




More information about the sheepdog mailing list