feat(TSG-7599): 修改测试用例

This commit is contained in:
“pengxuanzheng”
2021-09-06 15:26:20 +08:00
committed by pengxuanzheng
parent 8c49f4d2c2
commit 89a92df45a
15 changed files with 148 additions and 119 deletions

View File

@@ -43,7 +43,7 @@ static void gtest_hos_handle_init(hos_client_handle_t *hos_handle, int thread_nu
static void gtest_hos_instance_init(hos_instance instance)
{
memset(instance, 0, sizeof(hos_instance_s));
instance->result = true;
instance->status = INSTANCE_ENABLE_STATE;
instance->error_code = 0;
instance->error_message[0] ='\0';
instance->hos_url_prefix = "http://127.0.0.1:9098/hos/";
@@ -70,7 +70,8 @@ TEST(hos_open_fd, normal)
hos_client_handle_t expect_hos_handle;
hos_fd_context_t expect_fd_info[2];
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2, HOS_BUCKET);
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2);
ASSERT_NE(hos_instance, nullptr);
gtest_hos_instance_init(&expect_hos_instance);
CheckHosInstance(hos_instance, &expect_hos_instance);
gtest_hos_handle_init(&expect_hos_handle, 2);
@@ -100,7 +101,7 @@ TEST(hos_open_fd, normal)
ret = hos_shutdown_instance();
EXPECT_EQ(ret, HOS_CLIENT_OK);
expect_hos_instance.result = 0;
expect_hos_instance.status = 0;
expect_hos_instance.hos_url_prefix = NULL;
CheckHosInstance(hos_instance, &expect_hos_instance);
@@ -122,7 +123,7 @@ TEST(hos_open_fd, paramer_error)
hos_instance_s expect_hos_instance;
hos_client_handle_t expect_hos_handle;
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2, HOS_BUCKET);
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2);
gtest_hos_instance_init(&expect_hos_instance);
CheckHosInstance(hos_instance, &expect_hos_instance);
gtest_hos_handle_init(&expect_hos_handle, 2);
@@ -135,7 +136,7 @@ TEST(hos_open_fd, paramer_error)
int ret = hos_shutdown_instance();
EXPECT_EQ(ret, HOS_CLIENT_OK);
expect_hos_instance.result = 0;
expect_hos_instance.status = 0;
expect_hos_instance.hos_url_prefix = NULL;
CheckHosInstance(hos_instance, &expect_hos_instance);
@@ -157,7 +158,7 @@ TEST(hos_open_fd, over_threadnums)
hos_instance_s expect_hos_instance;
hos_client_handle_t expect_hos_handle;
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2, HOS_BUCKET);
hos_instance hos_instance = hos_init_instance(HOS_CONF, "hos_default_conf", 2);
gtest_hos_instance_init(&expect_hos_instance);
CheckHosInstance(hos_instance, &expect_hos_instance);
gtest_hos_handle_init(&expect_hos_handle, 2);
@@ -170,7 +171,7 @@ TEST(hos_open_fd, over_threadnums)
int ret = hos_shutdown_instance();
EXPECT_EQ(ret, HOS_CLIENT_OK);
expect_hos_instance.result = 0;
expect_hos_instance.status = 0;
expect_hos_instance.hos_url_prefix = NULL;
CheckHosInstance(hos_instance, &expect_hos_instance);
@@ -190,5 +191,5 @@ TEST(hos_open_fd, over_threadnums)
TEST(hos_open_fd, not_init_instance)
{
int fd = hos_open_fd(HOS_CONF, "object", NULL, NULL, 0);
EXPECT_EQ(fd, HOS_INSTANCE_NOT_INIT);
EXPECT_EQ(fd, HOS_INSTANCE_NOT_ENABLE);
}