utils.h 1.8 KB
Newer Older
X
Xu Peng 已提交
1 2 3 4 5 6 7 8 9 10
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include <gtest/gtest.h>
#include <chrono>
Z
update  
zhiru 已提交
11
//#include <src/db/MySQLMetaImpl.h>
X
Xu Peng 已提交
12 13

#include "db/DB.h"
X
Xu Peng 已提交
14
#include "db/DBMetaImpl.h"
Z
update  
zhiru 已提交
15
#include "db/MySQLMetaImpl.h"
X
Xu Peng 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


#define TIMING

#ifdef TIMING
#define INIT_TIMER auto start = std::chrono::high_resolution_clock::now();
#define START_TIMER  start = std::chrono::high_resolution_clock::now();
#define STOP_TIMER(name)  LOG(DEBUG) << "RUNTIME of " << name << ": " << \
    std::chrono::duration_cast<std::chrono::milliseconds>( \
            std::chrono::high_resolution_clock::now()-start \
    ).count() << " ms ";
#else
#define INIT_TIMER
#define START_TIMER
#define STOP_TIMER(name)
#endif


J
jinhai 已提交
34
void ASSERT_STATS(zilliz::milvus::engine::Status& stat);
X
Xu Peng 已提交
35 36 37 38


class DBTest : public ::testing::Test {
protected:
J
jinhai 已提交
39
    zilliz::milvus::engine::DB* db_;
X
Xu Peng 已提交
40

X
Xu Peng 已提交
41
    void InitLog();
X
Xu Peng 已提交
42
    virtual void SetUp() override;
X
Xu Peng 已提交
43
    virtual void TearDown() override;
J
jinhai 已提交
44
    virtual zilliz::milvus::engine::Options GetOptions();
X
Xu Peng 已提交
45 46 47 48
};

class DBTest2 : public DBTest {
protected:
J
jinhai 已提交
49
    virtual zilliz::milvus::engine::Options GetOptions() override;
X
Xu Peng 已提交
50
};
X
Xu Peng 已提交
51 52 53 54


class MetaTest : public DBTest {
protected:
J
jinhai 已提交
55
    std::shared_ptr<zilliz::milvus::engine::meta::DBMetaImpl> impl_;
X
Xu Peng 已提交
56 57 58 59

    virtual void SetUp() override;
    virtual void TearDown() override;
};
Z
update  
zhiru 已提交
60

61
class MySQLTest : public ::testing::Test {
Z
update  
zhiru 已提交
62
protected:
63
//    std::shared_ptr<zilliz::milvus::engine::meta::MySQLMetaImpl> impl_;
Z
update  
zhiru 已提交
64 65 66 67 68
    zilliz::milvus::engine::DBMetaOptions getDBMetaOptions();
};

class MySQLDBTest : public  ::testing::Test {

Z
update  
zhiru 已提交
69
};