mirror of https://github.com/milvus-io/milvus.git
parent
210c801839
commit
f1ccbef06e
|
@ -20,15 +20,20 @@ if [ $? -ne 0 ]; then
|
|||
fi
|
||||
|
||||
for test in `ls ${DIR_UNITTEST}`; do
|
||||
echo $test
|
||||
case ${test} in
|
||||
db_test)
|
||||
# set run args for db_test
|
||||
args="mysql://root:Fantast1c@192.168.1.194:3306/test"
|
||||
;;
|
||||
*_test)
|
||||
args=""
|
||||
;;
|
||||
esac
|
||||
# run unittest
|
||||
./${DIR_UNITTEST}/${test}
|
||||
./${DIR_UNITTEST}/${test} "${args}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ${DIR_UNITTEST}/${test} "run failed"
|
||||
fi
|
||||
esac
|
||||
done
|
||||
|
||||
# gen test converage
|
||||
|
|
|
@ -36,7 +36,8 @@ TEST_F(MySQLTest, core) {
|
|||
// //dialect+driver://username:password@host:port/database
|
||||
// options.backend_uri = "mysql://root:1234@:/test";
|
||||
// options.path = "/tmp/vecwise_test";
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions());
|
||||
int mode = Options::MODE::SINGLE;
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
|
||||
// auto status = impl.Initialize();
|
||||
// ASSERT_TRUE(status.ok());
|
||||
|
||||
|
@ -58,7 +59,7 @@ TEST_F(MySQLTest, core) {
|
|||
status = impl.CreateTable(schema2);
|
||||
// std::cout << status.ToString() << std::endl;
|
||||
// ASSERT_THROW(impl.CreateTable(schema), mysqlpp::BadQuery);
|
||||
ASSERT_FALSE(status.ok());
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
||||
status = impl.DeleteTable(schema2.table_id_);
|
||||
// std::cout << status.ToString() << std::endl;
|
||||
|
@ -192,7 +193,8 @@ TEST_F(MySQLTest, core) {
|
|||
|
||||
TEST_F(MySQLTest, GROUP_TEST) {
|
||||
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions());
|
||||
int mode = Options::MODE::SINGLE;
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
|
||||
|
||||
auto table_id = "meta_test_group";
|
||||
|
||||
|
@ -214,7 +216,12 @@ TEST_F(MySQLTest, GROUP_TEST) {
|
|||
|
||||
group.table_id_ = table_id;
|
||||
status = impl.CreateTable(group);
|
||||
ASSERT_TRUE(!status.ok());
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
||||
group.table_id_ = "";
|
||||
status = impl.CreateTable(group);
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
||||
|
||||
status = impl.DropAll();
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
@ -222,12 +229,14 @@ TEST_F(MySQLTest, GROUP_TEST) {
|
|||
|
||||
TEST_F(MySQLTest, table_file_TEST) {
|
||||
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions());
|
||||
int mode = Options::MODE::SINGLE;
|
||||
meta::MySQLMetaImpl impl(getDBMetaOptions(), mode);
|
||||
|
||||
auto table_id = "meta_test_group";
|
||||
|
||||
meta::TableSchema group;
|
||||
group.table_id_ = table_id;
|
||||
group.dimension_ = 256;
|
||||
auto status = impl.CreateTable(group);
|
||||
|
||||
meta::TableFileSchema table_file;
|
||||
|
@ -237,6 +246,11 @@ TEST_F(MySQLTest, table_file_TEST) {
|
|||
ASSERT_TRUE(status.ok());
|
||||
ASSERT_EQ(table_file.file_type_, meta::TableFileSchema::NEW);
|
||||
|
||||
uint64_t cnt = 0;
|
||||
status = impl.Count(table_id, cnt);
|
||||
ASSERT_TRUE(status.ok());
|
||||
ASSERT_EQ(cnt, 0UL);
|
||||
|
||||
auto file_id = table_file.file_id_;
|
||||
|
||||
auto new_file_type = meta::TableFileSchema::INDEX;
|
||||
|
@ -287,8 +301,8 @@ TEST_F(MySQLTest, ARCHIVE_TEST_DAYS) {
|
|||
std::stringstream ss;
|
||||
ss << "days:" << days_num;
|
||||
options.archive_conf = ArchiveConf("delete", ss.str());
|
||||
|
||||
meta::MySQLMetaImpl impl(options);
|
||||
int mode = Options::MODE::SINGLE;
|
||||
meta::MySQLMetaImpl impl(options, mode);
|
||||
|
||||
auto table_id = "meta_test_group";
|
||||
|
||||
|
@ -336,11 +350,10 @@ TEST_F(MySQLTest, ARCHIVE_TEST_DAYS) {
|
|||
}
|
||||
|
||||
TEST_F(MySQLTest, ARCHIVE_TEST_DISK) {
|
||||
DBMetaOptions options;
|
||||
options.path = "/tmp/milvus_test";
|
||||
DBMetaOptions options = getDBMetaOptions();
|
||||
options.archive_conf = ArchiveConf("delete", "disk:11");
|
||||
|
||||
auto impl = meta::DBMetaImpl(options);
|
||||
int mode = Options::MODE::SINGLE;
|
||||
auto impl = meta::MySQLMetaImpl(options, mode);
|
||||
auto table_id = "meta_test_group";
|
||||
|
||||
meta::TableSchema group;
|
||||
|
@ -385,7 +398,8 @@ TEST_F(MySQLTest, ARCHIVE_TEST_DISK) {
|
|||
|
||||
TEST_F(MySQLTest, TABLE_FILES_TEST) {
|
||||
|
||||
auto impl = meta::DBMetaImpl(getDBMetaOptions());
|
||||
int mode = Options::MODE::SINGLE;
|
||||
auto impl = meta::MySQLMetaImpl(getDBMetaOptions(), mode);
|
||||
|
||||
auto table_id = "meta_test_group";
|
||||
|
||||
|
|
|
@ -293,20 +293,14 @@ TEST_F(MySQLDBTest, DB_TEST) {
|
|||
auto options = GetOptions();
|
||||
auto db_ = engine::DBFactory::Build(options);
|
||||
|
||||
static const std::string table_name = "test_group";
|
||||
static const int table_dim = 256;
|
||||
|
||||
engine::meta::TableSchema table_info;
|
||||
table_info.dimension_ = table_dim;
|
||||
table_info.table_id_ = table_name;
|
||||
table_info.engine_type_ = (int)engine::EngineType::FAISS_IDMAP;
|
||||
engine::meta::TableSchema table_info = BuildTableSchema();
|
||||
engine::Status stat = db_->CreateTable(table_info);
|
||||
|
||||
engine::meta::TableSchema table_info_get;
|
||||
table_info_get.table_id_ = table_name;
|
||||
table_info_get.table_id_ = TABLE_NAME;
|
||||
stat = db_->DescribeTable(table_info_get);
|
||||
ASSERT_STATS(stat);
|
||||
ASSERT_EQ(table_info_get.dimension_, table_dim);
|
||||
ASSERT_EQ(table_info_get.dimension_, TABLE_DIM);
|
||||
|
||||
engine::IDNumbers vector_ids;
|
||||
engine::IDNumbers target_ids;
|
||||
|
@ -335,7 +329,7 @@ TEST_F(MySQLDBTest, DB_TEST) {
|
|||
prev_count = count;
|
||||
|
||||
START_TIMER;
|
||||
stat = db_->Query(table_name, k, qb, qxb.data(), results);
|
||||
stat = db_->Query(TABLE_NAME, k, qb, qxb.data(), results);
|
||||
ss << "Search " << j << " With Size " << count/engine::meta::M << " M";
|
||||
STOP_TIMER(ss.str());
|
||||
|
||||
|
@ -358,10 +352,10 @@ TEST_F(MySQLDBTest, DB_TEST) {
|
|||
|
||||
for (auto i=0; i<loop; ++i) {
|
||||
if (i==40) {
|
||||
db_->InsertVectors(table_name, qb, qxb.data(), target_ids);
|
||||
db_->InsertVectors(TABLE_NAME, qb, qxb.data(), target_ids);
|
||||
ASSERT_EQ(target_ids.size(), qb);
|
||||
} else {
|
||||
db_->InsertVectors(table_name, nb, xb.data(), vector_ids);
|
||||
db_->InsertVectors(TABLE_NAME, nb, xb.data(), vector_ids);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(1));
|
||||
}
|
||||
|
@ -447,6 +441,18 @@ TEST_F(MySQLDBTest, ARHIVE_DISK_CHECK) {
|
|||
engine::meta::TableSchema table_info = BuildTableSchema();
|
||||
engine::Status stat = db_->CreateTable(table_info);
|
||||
|
||||
std::vector<engine::meta::TableSchema> table_schema_array;
|
||||
stat = db_->AllTables(table_schema_array);
|
||||
ASSERT_STATS(stat);
|
||||
bool bfound = false;
|
||||
for(auto& schema : table_schema_array) {
|
||||
if(schema.table_id_ == TABLE_NAME) {
|
||||
bfound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(bfound);
|
||||
|
||||
engine::meta::TableSchema table_info_get;
|
||||
table_info_get.table_id_ = TABLE_NAME;
|
||||
stat = db_->DescribeTable(table_info_get);
|
||||
|
|
|
@ -53,6 +53,7 @@ void DBTest::InitLog() {
|
|||
engine::Options DBTest::GetOptions() {
|
||||
auto options = engine::OptionsFactory::Build();
|
||||
options.meta.path = "/tmp/milvus_test";
|
||||
options.meta.backend_uri = "sqlite://:@:/";
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -71,6 +72,7 @@ engine::Options DBTest2::GetOptions() {
|
|||
auto options = engine::OptionsFactory::Build();
|
||||
options.meta.path = "/tmp/milvus_test";
|
||||
options.meta.archive_conf = engine::ArchiveConf("delete", "disk:1");
|
||||
options.meta.backend_uri = "sqlite://:@:/";
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue