syncIOClientTest.cpp 1.0 KB
Newer Older
1
#include "syncTest.h"
M
sync io  
Minghao Li 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

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;

M
Minghao Li 已提交
21
  ret = syncIOStart((char*)"127.0.0.1", 7010);
M
sync io  
Minghao Li 已提交
22 23 24 25 26
  assert(ret == 0);

  for (int i = 0; i < 10; ++i) {
    SEpSet epSet;
    epSet.inUse = 0;
M
Minghao Li 已提交
27
    epSet.numOfEps = 0;
M
sync io  
Minghao Li 已提交
28 29
    addEpIntoEpSet(&epSet, "127.0.0.1", 7030);

M
Minghao Li 已提交
30 31 32 33 34
    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;
M
sync io  
Minghao Li 已提交
35

M
Minghao Li 已提交
36
    SyncPingReply* pSyncMsg = syncPingReplyBuild2(&srcId, &destId, 1000, "syncIOClientTest");
M
Minghao Li 已提交
37 38
    SRpcMsg        rpcMsg;
    syncPingReply2RpcMsg(pSyncMsg, &rpcMsg);
M
sync io  
Minghao Li 已提交
39

S
Shengliang Guan 已提交
40
    syncIOSendMsg(&epSet, &rpcMsg);
wafwerar's avatar
wafwerar 已提交
41
    taosSsleep(1);
M
sync io  
Minghao Li 已提交
42 43 44 45
  }

  return 0;
}