summaryrefslogtreecommitdiff
path: root/infra/module_manager/test
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-09-25 18:18:02 +0800
committeryangwei <[email protected]>2024-09-25 18:18:02 +0800
commit74f77f34112170d081868203441e71b2c78a5452 (patch)
tree7134993b9f9013d620777e03f8727648c79e404b /infra/module_manager/test
parent7291db59693c271f582cc5428306d74a007cb4b9 (diff)
✨ feat(polling manager): support polling manager
Diffstat (limited to 'infra/module_manager/test')
-rw-r--r--infra/module_manager/test/gtest_module_manager_main.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/infra/module_manager/test/gtest_module_manager_main.cpp b/infra/module_manager/test/gtest_module_manager_main.cpp
index e46037b..74aa611 100644
--- a/infra/module_manager/test/gtest_module_manager_main.cpp
+++ b/infra/module_manager/test/gtest_module_manager_main.cpp
@@ -200,61 +200,6 @@ TEST(module_manager, basic_module) {
}
-/***********************************
- * TEST MODULE MANAGER POLLING API *
- ***********************************/
-
-struct test_module_polling_env
-{
- int N_round;
- int polling_count;
- int polling_active_count;
-};
-
- void test_module_on_polling(struct stellar_module_manager* mod_mgr, void *polling_arg)
- {
- struct test_module_polling_env *env = (struct test_module_polling_env*)polling_arg;
- env->polling_count++;
- if(env->polling_count%2==0)
- {
- stellar_module_manager_polling_active(mod_mgr);
- env->polling_active_count++;
- }
- }
-
-TEST(module_manager_polling, basic_polling_module) {
-
- struct mq_schema *mq_schema=mq_schema_new();
-
- struct stellar_module_manager *mod_mgr=stellar_module_manager_new(NULL, 10, mq_schema);
- EXPECT_TRUE(mod_mgr!=NULL);
-
-
- EXPECT_EQ(stellar_module_manager_get_max_thread_num(mod_mgr), 10);
- EXPECT_EQ(stellar_module_manager_get_mq_schema(mod_mgr), mq_schema);
-
- struct test_module_polling_env env={};
- env.N_round=10;
-
- stellar_module_manager_polling_subscribe(mod_mgr, test_module_on_polling, &env);
-
- struct mq_runtime *mq_rt = mq_runtime_new(mq_schema);
- stellar_module_manager_register_thread(mod_mgr, 1, mq_rt);
-
- EXPECT_EQ((long)stellar_module_manager_get_thread_id(mod_mgr), 1);
- EXPECT_EQ(stellar_module_manager_get_mq_runtime(mod_mgr), mq_rt);
-
- for(int i=0; i<env.N_round; i++)
- {
- stellar_module_manager_polling_dispatch(mod_mgr);
- }
-
- stellar_module_manager_free(mod_mgr);
-
- EXPECT_EQ(env.polling_count, env.N_round+env.polling_active_count);
-
-}
-
/**********************************************
* GTEST MAIN *
**********************************************/