Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
f1ccbef0
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f1ccbef0
编写于
6月 30, 2019
作者:
Z
zhiru
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Former-commit-id: ebcc47ee9f40f0616f1b7035f407a787afd39ea0
上级
210c8018
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
59 addition
and
32 deletion
+59
-32
cpp/coverage.sh
cpp/coverage.sh
+12
-7
cpp/unittest/db/MySQLMetaImpl_test.cpp
cpp/unittest/db/MySQLMetaImpl_test.cpp
+27
-13
cpp/unittest/db/db_tests.cpp
cpp/unittest/db/db_tests.cpp
+18
-12
cpp/unittest/db/utils.cpp
cpp/unittest/db/utils.cpp
+2
-0
未找到文件。
cpp/coverage.sh
浏览文件 @
f1ccbef0
...
...
@@ -20,15 +20,20 @@ if [ $? -ne 0 ]; then
fi
for
test
in
`
ls
${
DIR_UNITTEST
}
`
;
do
echo
$test
case
${
test
}
in
case
${
test
}
in
db_test
)
# set run args for db_test
args
=
"mysql://root:Fantast1c@192.168.1.194:3306/test"
;;
*
_test
)
# run unittest
./
${
DIR_UNITTEST
}
/
${
test
}
if
[
$?
-ne
0
]
;
then
echo
${
DIR_UNITTEST
}
/
${
test
}
"run failed"
fi
args
=
""
;;
esac
# run unittest
./
${
DIR_UNITTEST
}
/
${
test
}
"
${
args
}
"
if
[
$?
-ne
0
]
;
then
echo
${
DIR_UNITTEST
}
/
${
test
}
"run failed"
fi
done
# gen test converage
...
...
cpp/unittest/db/MySQLMetaImpl_test.cpp
浏览文件 @
f1ccbef0
...
...
@@ -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_
FALS
E
(
status
.
ok
());
ASSERT_
TRU
E
(
status
.
ok
());
status
=
impl
.
DeleteTable
(
schema2
.
table_id_
);
// std::cout << status.ToString() << std::endl;
...
...
@@ -191,8 +192,9 @@ 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"
;
...
...
cpp/unittest/db/db_tests.cpp
浏览文件 @
f1ccbef0
...
...
@@ -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
);
...
...
cpp/unittest/db/utils.cpp
浏览文件 @
f1ccbef0
...
...
@@ -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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录