add stream backend test
This commit is contained in:
parent
c54e4aeaad
commit
e41e10bf35
|
@ -21,6 +21,10 @@
|
||||||
#include "streamState.h"
|
#include "streamState.h"
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct SCfComparator {
|
typedef struct SCfComparator {
|
||||||
rocksdb_comparator_t** comp;
|
rocksdb_comparator_t** comp;
|
||||||
int32_t numOfComp;
|
int32_t numOfComp;
|
||||||
|
@ -253,4 +257,9 @@ int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname);
|
||||||
void bkdMgtDestroy(SBkdMgt* bm);
|
void bkdMgtDestroy(SBkdMgt* bm);
|
||||||
|
|
||||||
int32_t taskDbGenChkpUploadData(void* arg, void* bkdMgt, int64_t chkpId, int8_t type, char** path, SArray* list);
|
int32_t taskDbGenChkpUploadData(void* arg, void* bkdMgt, int64_t chkpId, int8_t type, char** path, SArray* list);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -57,26 +57,48 @@
|
||||||
#)
|
#)
|
||||||
|
|
||||||
|
|
||||||
add_executable(backendTest "")
|
#add_executable(backendTest "")
|
||||||
|
|
||||||
target_sources(backendTest
|
#target_sources(backendTest
|
||||||
PRIVATE
|
#PUBLIC
|
||||||
"backendTest.cpp"
|
#"backendTest.cpp"
|
||||||
)
|
#)
|
||||||
|
|
||||||
target_include_directories(
|
#target_include_directories(
|
||||||
backendTest
|
#backendTest
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
|
#PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
|
||||||
PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
|
#PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
|
||||||
)
|
#)
|
||||||
|
|
||||||
target_link_libraries(
|
#target_link_libraries(
|
||||||
backendTest
|
#backendTest
|
||||||
PUBLIC rocksdb
|
#PUBLIC rocksdb
|
||||||
PUBLIC os common gtest stream executor qcom index transport util
|
#PUBLIC os common gtest stream executor qcom index transport util
|
||||||
)
|
#)
|
||||||
|
|
||||||
add_test(
|
|
||||||
NAME backendTest
|
MESSAGE(STATUS "build parser unit test")
|
||||||
COMMAND backendTest
|
|
||||||
)
|
IF(NOT TD_DARWIN)
|
||||||
|
# GoogleTest requires at least C++11
|
||||||
|
SET(CMAKE_CXX_STANDARD 11)
|
||||||
|
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(backendTest ${SOURCE_LIST})
|
||||||
|
TARGET_LINK_LIBRARIES(
|
||||||
|
backendTest
|
||||||
|
PUBLIC rocksdb
|
||||||
|
PUBLIC os common gtest stream executor qcom index transport util vnode
|
||||||
|
)
|
||||||
|
|
||||||
|
TARGET_INCLUDE_DIRECTORIES(
|
||||||
|
backendTest
|
||||||
|
PUBLIC "${TD_SOURCE_DIR}/include/libs/stream/"
|
||||||
|
PRIVATE "${TD_SOURCE_DIR}/source/libs/stream/inc"
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_TEST(
|
||||||
|
NAME backendTest
|
||||||
|
COMMAND backendTest
|
||||||
|
)
|
||||||
|
ENDIF ()
|
|
@ -4,6 +4,11 @@
|
||||||
#include <tglobal.h>
|
#include <tglobal.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "streamBackendRocksdb.h"
|
#include "streamBackendRocksdb.h"
|
||||||
|
#include "streamSnapshot.h"
|
||||||
|
#include "streamState.h"
|
||||||
|
#include "tstream.h"
|
||||||
|
#include "tstreamFileState.h"
|
||||||
|
#include "tstreamUpdate.h"
|
||||||
|
|
||||||
class BackendEnv : public ::testing::Test {
|
class BackendEnv : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
|
@ -13,22 +18,35 @@ class BackendEnv : public ::testing::Test {
|
||||||
|
|
||||||
void *backendCreate() {
|
void *backendCreate() {
|
||||||
const char *streamPath = "/tmp";
|
const char *streamPath = "/tmp";
|
||||||
|
void *p = NULL;
|
||||||
|
|
||||||
char *absPath = NULL;
|
// char *absPath = NULL;
|
||||||
void *p = NULL;
|
// // SBackendWrapper *p = (SBackendWrapper *)streamBackendInit(streamPath, -1, 2);
|
||||||
// SBackendWrapper *p = streamBackendInit(streamPath, -1, 2);
|
// STaskDbWrapper *p = taskDbOpen((char *)streamPath, (char *)"stream-backend", -1);
|
||||||
// p = taskDbOpen((char *)streamPath, (char *)"test", -1);
|
// ASSERT(p != NULL);
|
||||||
// p = bkdMgtCreate((char *)streamPath);
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
SStreamState *stateCreate(void *pBackend, char *keyidr) {
|
||||||
|
const char *streamPath = "/tmp";
|
||||||
|
SStreamTask *pTask = (SStreamTask *)taosMemoryCalloc(1, sizeof(SStreamTask));
|
||||||
|
pTask->ver = 1024;
|
||||||
|
pTask->id.streamId = 1023;
|
||||||
|
pTask->id.taskId = 1111111;
|
||||||
|
|
||||||
|
SStreamState *p = streamStateOpen((char *)streamPath, pTask, true, 32, 32 * 1024);
|
||||||
ASSERT(p != NULL);
|
ASSERT(p != NULL);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
void backendOpen() {
|
void backendOpen() {
|
||||||
void *p = backendCreate();
|
void *p = backendCreate();
|
||||||
ASSERT(p != NULL);
|
ASSERT(p != NULL);
|
||||||
|
taskDbDestroy(p, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BackendEnv, checkOpen) { backendOpen(); }
|
TEST_F(BackendEnv, checkOpen) {
|
||||||
|
backendOpen();
|
||||||
|
}
|
||||||
TEST_F(BackendEnv, backendOpt) {}
|
TEST_F(BackendEnv, backendOpt) {}
|
||||||
TEST_F(BackendEnv, backendDestroy) {}
|
TEST_F(BackendEnv, backendDestroy) {}
|
||||||
|
|
||||||
|
|
|
@ -25,24 +25,24 @@
|
||||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||||
|
|
||||||
|
#include "cos.h"
|
||||||
#include "rsync.h"
|
#include "rsync.h"
|
||||||
#include "streamInt.h"
|
#include "streamInt.h"
|
||||||
#include "cos.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
// int main(int argc, char **argv) {
|
||||||
testing::InitGoogleTest(&argc, argv);
|
// testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
if (taosInitCfg("/etc/taos/", NULL, NULL, NULL, NULL, 0) != 0) {
|
// if (taosInitCfg("/etc/taos/", NULL, NULL, NULL, NULL, 0) != 0) {
|
||||||
printf("error");
|
// printf("error");
|
||||||
}
|
// }
|
||||||
if (s3Init() < 0) {
|
// if (s3Init() < 0) {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
strcpy(tsSnodeAddress, "127.0.0.1");
|
// strcpy(tsSnodeAddress, "127.0.0.1");
|
||||||
int ret = RUN_ALL_TESTS();
|
// int ret = RUN_ALL_TESTS();
|
||||||
s3CleanUp();
|
// s3CleanUp();
|
||||||
return ret;
|
// return ret;
|
||||||
}
|
// }
|
||||||
|
|
||||||
TEST(testCase, checkpointUpload_Test) {
|
TEST(testCase, checkpointUpload_Test) {
|
||||||
stopRsync();
|
stopRsync();
|
||||||
|
|
Loading…
Reference in New Issue