avoid unitest hang

Former-commit-id: 95e1d10cb61ff5f8c7e5b8b38564f2c7ab78865c
This commit is contained in:
starlord 2019-06-30 16:42:12 +08:00 committed by jinhai
parent 72877cf3d9
commit 4bd3e1f2da
2 changed files with 54 additions and 7 deletions

View File

@ -32,12 +32,19 @@ using namespace zilliz::milvus::engine;
//}
TEST_F(MySQLTest, core) {
// DBMetaOptions options;
DBMetaOptions options;
// //dialect+driver://username:password@host:port/database
// options.backend_uri = "mysql://root:1234@:/test";
// options.path = "/tmp/vecwise_test";
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
int mode = Options::MODE::SINGLE;
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
meta::MySQLMetaImpl impl(options, mode);
// auto status = impl.Initialize();
// ASSERT_TRUE(status.ok());
@ -192,9 +199,16 @@ TEST_F(MySQLTest, core) {
}
TEST_F(MySQLTest, GROUP_TEST) {
DBMetaOptions options;
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
int mode = Options::MODE::SINGLE;
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
meta::MySQLMetaImpl impl(options, mode);
auto table_id = "meta_test_group";
@ -228,9 +242,16 @@ TEST_F(MySQLTest, GROUP_TEST) {
}
TEST_F(MySQLTest, table_file_TEST) {
DBMetaOptions options;
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
int mode = Options::MODE::SINGLE;
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
meta::MySQLMetaImpl impl(options, mode);
auto table_id = "meta_test_group";
@ -296,7 +317,14 @@ TEST_F(MySQLTest, table_file_TEST) {
TEST_F(MySQLTest, ARCHIVE_TEST_DAYS) {
srand(time(0));
DBMetaOptions options = getDBMetaOptions();
DBMetaOptions options;
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
int days_num = rand() % 100;
std::stringstream ss;
ss << "days:" << days_num;
@ -350,7 +378,14 @@ TEST_F(MySQLTest, ARCHIVE_TEST_DAYS) {
}
TEST_F(MySQLTest, ARCHIVE_TEST_DISK) {
DBMetaOptions options = getDBMetaOptions();
DBMetaOptions options;
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
options.archive_conf = ArchiveConf("delete", "disk:11");
int mode = Options::MODE::SINGLE;
auto impl = meta::MySQLMetaImpl(options, mode);
@ -397,9 +432,16 @@ TEST_F(MySQLTest, ARCHIVE_TEST_DISK) {
}
TEST_F(MySQLTest, TABLE_FILES_TEST) {
DBMetaOptions options;
try {
options = getDBMetaOptions();
} catch(std::exception& ex) {
ASSERT_TRUE(false);
return;
}
int mode = Options::MODE::SINGLE;
auto impl = meta::MySQLMetaImpl(getDBMetaOptions(), mode);
auto impl = meta::MySQLMetaImpl(options, mode);
auto table_id = "meta_test_group";

View File

@ -91,6 +91,11 @@ zilliz::milvus::engine::DBMetaOptions MySQLTest::getDBMetaOptions() {
zilliz::milvus::engine::DBMetaOptions options;
options.path = "/tmp/milvus_test";
options.backend_uri = DBTestEnvironment::getURI();
if(options.backend_uri.empty()) {
throw std::exception();
}
return options;
}