2019-04-29 05:17:13 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
|
|
|
|
// Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
|
|
// Proprietary and confidential.
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <easylogging++.h>
|
2019-04-29 12:22:24 +00:00
|
|
|
#include <thread>
|
|
|
|
#include <boost/filesystem.hpp>
|
2019-04-29 05:17:13 +00:00
|
|
|
|
|
|
|
#include "utils.h"
|
2019-04-29 07:47:09 +00:00
|
|
|
#include "db/Factories.h"
|
2019-04-29 05:17:13 +00:00
|
|
|
|
|
|
|
using namespace zilliz::vecwise;
|
|
|
|
|
|
|
|
void ASSERT_STATS(engine::Status& stat) {
|
|
|
|
ASSERT_TRUE(stat.ok());
|
|
|
|
if(!stat.ok()) {
|
|
|
|
std::cout << stat.ToString() << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-29 11:05:48 +00:00
|
|
|
void DBTest::InitLog() {
|
2019-04-29 05:17:13 +00:00
|
|
|
el::Configurations defaultConf;
|
|
|
|
defaultConf.setToDefault();
|
|
|
|
defaultConf.set(el::Level::Debug,
|
|
|
|
el::ConfigurationType::Format, "[%thread-%datetime-%level]: %msg (%fbase:%line)");
|
|
|
|
el::Loggers::reconfigureLogger("default", defaultConf);
|
|
|
|
}
|
2019-04-29 07:47:09 +00:00
|
|
|
|
2019-05-24 10:16:27 +00:00
|
|
|
engine::Options DBTest::GetOptions() {
|
2019-04-29 12:22:24 +00:00
|
|
|
auto options = engine::OptionsFactory::Build();
|
|
|
|
options.meta.path = "/tmp/vecwise_test";
|
2019-05-24 10:16:27 +00:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DBTest::SetUp() {
|
|
|
|
InitLog();
|
|
|
|
auto options = GetOptions();
|
2019-05-07 10:29:45 +00:00
|
|
|
db_ = engine::DBFactory::Build(options, "Faiss,IDMap");
|
2019-04-29 12:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DBTest::TearDown() {
|
|
|
|
delete db_;
|
|
|
|
boost::filesystem::remove_all("/tmp/vecwise_test");
|
2019-04-29 11:05:48 +00:00
|
|
|
}
|
|
|
|
|
2019-05-24 10:16:27 +00:00
|
|
|
engine::Options DBTest2::GetOptions() {
|
|
|
|
auto options = engine::OptionsFactory::Build();
|
|
|
|
options.meta.path = "/tmp/vecwise_test";
|
2019-05-26 08:51:30 +00:00
|
|
|
options.meta.archive_conf = engine::ArchiveConf("delete", "disk:1");
|
2019-05-24 10:16:27 +00:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2019-04-29 07:47:09 +00:00
|
|
|
void MetaTest::SetUp() {
|
2019-04-29 11:05:48 +00:00
|
|
|
InitLog();
|
2019-04-29 07:47:09 +00:00
|
|
|
impl_ = engine::DBMetaImplFactory::Build();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MetaTest::TearDown() {
|
2019-05-27 11:22:58 +00:00
|
|
|
impl_->DropAll();
|
2019-04-29 07:47:09 +00:00
|
|
|
}
|