TDengine/source/libs/sync/test/syncRaftStoreTest.cpp

43 lines
957 B
C++
Raw Normal View History

#include "syncRaftStore.h"
2022-03-06 09:59:24 +00:00
//#include <gtest/gtest.h>
#include <stdio.h>
2022-03-03 02:46:48 +00:00
#include "syncIO.h"
#include "syncInt.h"
2022-03-07 06:18:46 +00:00
void logTest() {
sTrace("--- sync log test: trace");
sDebug("--- sync log test: debug");
sInfo("--- sync log test: info");
sWarn("--- sync log test: warn");
sError("--- sync log test: error");
sFatal("--- sync log test: fatal");
2022-03-03 02:46:48 +00:00
}
int main() {
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog = 0;
sDebugFlag = 143 + 64;
2022-03-07 06:18:46 +00:00
logTest();
2022-03-03 02:46:48 +00:00
SRaftStore *pRaftStore = raftStoreOpen("./raft_store.json");
assert(pRaftStore != NULL);
raftStorePrint(pRaftStore);
2022-03-10 11:21:02 +00:00
#if 0
2022-03-03 02:46:48 +00:00
pRaftStore->currentTerm = 100;
pRaftStore->voteFor.addr = 200;
pRaftStore->voteFor.vgId = 300;
2022-03-10 11:21:02 +00:00
raftStorePersist(pRaftStore);
2022-03-03 02:46:48 +00:00
raftStorePrint(pRaftStore);
2022-03-10 11:21:02 +00:00
#endif
++(pRaftStore->currentTerm);
++(pRaftStore->voteFor.addr);
++(pRaftStore->voteFor.vgId);
2022-03-03 02:46:48 +00:00
raftStorePersist(pRaftStore);
2022-03-10 11:21:02 +00:00
raftStorePrint(pRaftStore);
2022-03-03 02:46:48 +00:00
return 0;
}