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

46 lines
1 KiB
C++
Raw Normal View History

2022-11-10 04:43:23 +00:00
#include "syncTest.h"
2022-03-02 08:37:04 +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");
}
int main() {
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog = 0;
sDebugFlag = 143 + 64;
logTest();
int32_t ret;
2022-03-13 08:36:32 +00:00
ret = syncIOStart((char*)"127.0.0.1", 7010);
2022-03-02 08:37:04 +00:00
assert(ret == 0);
for (int i = 0; i < 10; ++i) {
SEpSet epSet;
epSet.inUse = 0;
2022-03-02 10:30:21 +00:00
epSet.numOfEps = 0;
2022-03-02 08:37:04 +00:00
addEpIntoEpSet(&epSet, "127.0.0.1", 7030);
2022-03-13 08:36:32 +00:00
SRaftId srcId, destId;
srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234);
srcId.vgId = 100;
destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
destId.vgId = 100;
2022-03-02 08:37:04 +00:00
2022-04-18 13:50:56 +00:00
SyncPingReply* pSyncMsg = syncPingReplyBuild2(&srcId, &destId, 1000, "syncIOClientTest");
2022-03-13 08:36:32 +00:00
SRpcMsg rpcMsg;
syncPingReply2RpcMsg(pSyncMsg, &rpcMsg);
2022-03-02 08:37:04 +00:00
2022-05-19 11:44:01 +00:00
syncIOSendMsg(&epSet, &rpcMsg);
2022-03-10 03:56:11 +00:00
taosSsleep(1);
2022-03-02 08:37:04 +00:00
}
return 0;
}