feat(module manager): API new with file

This commit is contained in:
yangwei
2024-09-27 19:09:50 +08:00
parent 7aeb5949ee
commit 849df6b9cc
4 changed files with 84 additions and 85 deletions

View File

@@ -37,10 +37,12 @@ const char *gtest_mock_spec_toml =
TEST(polling_manager, basic_polling_module) {
struct mq_schema *mq_schema=mq_schema_new();
toml_table_t *conf = toml_parse((char*)gtest_mock_spec_toml, NULL, 0);
EXPECT_TRUE(conf!=NULL);
struct stellar_module_manager *mod_mgr=stellar_module_manager_new_with_toml(conf, 10, mq_schema);
FILE *fp = fmemopen((void *)gtest_mock_spec_toml, strlen(gtest_mock_spec_toml), "r");
EXPECT_TRUE(fp!=NULL);
struct stellar_module_manager *mod_mgr=stellar_module_manager_new_with_file(fp, 10, mq_schema);
fclose(fp);
EXPECT_TRUE(mod_mgr!=NULL);
struct stellar_polling_manager *polling_mgr=stellar_module_get_polling_manager(mod_mgr);
@@ -66,7 +68,6 @@ TEST(polling_manager, basic_polling_module) {
}
stellar_module_manager_free(mod_mgr);
toml_free(conf);
EXPECT_EQ(env.polling_count, env.N_round+env.polling_active_count);