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