utils.h 1.7 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
////////////////////////////////////////////////////////////////////////////////
// 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>
//#include <src/db/MySQLMetaImpl.h>

#include "db/DB.h"
S
starlord 已提交
14 15
#include "db/meta/SqliteMetaImpl.h"
#include "db/meta/MySQLMetaImpl.h"
G
groot 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57


#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

void ASSERT_STATS(zilliz::milvus::engine::Status& stat);

//class TestEnv : public ::testing::Environment {
//public:
//
//    static std::string getURI() {
//        if (const char* uri = std::getenv("MILVUS_DBMETA_URI")) {
//            return uri;
//        }
//        else {
//            return "";
//        }
//    }
//
//    void SetUp() override {
//        getURI();
//    }
//
//};
//
//::testing::Environment* const test_env =
//        ::testing::AddGlobalTestEnvironment(new TestEnv);

class MetricTest : public ::testing::Test {
protected:
S
starlord 已提交
58
    zilliz::milvus::engine::DBPtr db_;
G
groot 已提交
59 60 61 62 63 64

    void InitLog();
    virtual void SetUp() override;
    virtual void TearDown() override;
    virtual zilliz::milvus::engine::Options GetOptions();
};