mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
Merge branch 'branch-0.3.1-yuncong' into 'branch-0.3.1-yuncong'
Fix unittest error See merge request megasearch/milvus!207 Former-commit-id: 906107d2a559105a46a2e257af431be85c8287c8
This commit is contained in:
commit
520d4e9d71
@ -52,15 +52,13 @@ TEST_F(DBTest, CONFIG_TEST) {
|
||||
engine::ArchiveConf conf("delete");
|
||||
ASSERT_EQ(conf.GetType(), "delete");
|
||||
auto criterias = conf.GetCriterias();
|
||||
ASSERT_TRUE(criterias.size() == 1);
|
||||
ASSERT_TRUE(criterias["disk"] == 512);
|
||||
ASSERT_TRUE(criterias.size() == 0);
|
||||
}
|
||||
{
|
||||
engine::ArchiveConf conf("swap");
|
||||
ASSERT_EQ(conf.GetType(), "swap");
|
||||
auto criterias = conf.GetCriterias();
|
||||
ASSERT_TRUE(criterias.size() == 1);
|
||||
ASSERT_TRUE(criterias["disk"] == 512);
|
||||
ASSERT_TRUE(criterias.size() == 0);
|
||||
}
|
||||
{
|
||||
ASSERT_ANY_THROW(engine::ArchiveConf conf1("swap", "disk:"));
|
||||
@ -206,11 +204,21 @@ TEST_F(DBTest, SEARCH_TEST) {
|
||||
ASSERT_STATS(stat);
|
||||
}
|
||||
|
||||
sleep(2); // wait until build index finish
|
||||
db_->BuildIndex(TABLE_NAME); // wait until build index finish
|
||||
|
||||
engine::QueryResults results;
|
||||
stat = db_->Query(TABLE_NAME, k, nq, xq.data(), results);
|
||||
ASSERT_STATS(stat);
|
||||
{
|
||||
engine::QueryResults results;
|
||||
stat = db_->Query(TABLE_NAME, k, nq, xq.data(), results);
|
||||
ASSERT_STATS(stat);
|
||||
}
|
||||
|
||||
{//search by specify index file
|
||||
engine::meta::DatesT dates;
|
||||
std::vector<std::string> file_ids = {"1", "2", "3", "4"};
|
||||
engine::QueryResults results;
|
||||
stat = db_->Query(TABLE_NAME, file_ids, k, nq, xq.data(), dates, results);
|
||||
ASSERT_STATS(stat);
|
||||
}
|
||||
|
||||
// TODO(linxj): add groundTruth assert
|
||||
};
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "db/Options.h"
|
||||
#include "db/DBMetaImpl.h"
|
||||
#include "db/EngineFactory.h"
|
||||
#include "db/Utils.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -134,4 +135,32 @@ TEST(DBMiscTest, META_TEST) {
|
||||
int delta = 10;
|
||||
engine::meta::DateT dt = impl.GetDate(tt, delta);
|
||||
ASSERT_GT(dt, 0);
|
||||
}
|
||||
|
||||
TEST(DBMiscTest, UTILS_TEST) {
|
||||
engine::DBMetaOptions options;
|
||||
options.path = "/tmp/milvus_test/main";
|
||||
options.slave_paths.push_back("/tmp/milvus_test/slave_1");
|
||||
options.slave_paths.push_back("/tmp/milvus_test/slave_2");
|
||||
|
||||
const std::string TABLE_NAME = "test_tbl";
|
||||
auto status = engine::utils::CreateTablePath(options, TABLE_NAME);
|
||||
ASSERT_TRUE(status.ok());
|
||||
ASSERT_TRUE(boost::filesystem::exists(options.path));
|
||||
for(auto& path : options.slave_paths) {
|
||||
ASSERT_TRUE(boost::filesystem::exists(path));
|
||||
}
|
||||
|
||||
engine::meta::TableFileSchema file;
|
||||
file.id_ = 50;
|
||||
file.table_id_ = TABLE_NAME;
|
||||
file.file_type_ = 3;
|
||||
file.date_ = 155000;
|
||||
status = engine::utils::GetTableFilePath(options, file);
|
||||
ASSERT_FALSE(status.ok());
|
||||
ASSERT_TRUE(file.location_.empty());
|
||||
|
||||
status = engine::utils::DeleteTablePath(options, TABLE_NAME);
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user