syncIOSendMsgClientTest.cpp 1.0 KB
Newer Older
1
#include <gtest/gtest.h>
M
Minghao Li 已提交
2
#include <stdio.h>
M
sync io  
Minghao Li 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.h"

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;

  ret = syncIOStart((char *)"127.0.0.1", 7010);
  assert(ret == 0);

  for (int i = 0; i < 10; ++i) {
    SEpSet epSet;
    epSet.inUse = 0;
M
Minghao Li 已提交
31
    epSet.numOfEps = 0;
M
sync io  
Minghao Li 已提交
32 33 34 35 36
    addEpIntoEpSet(&epSet, "127.0.0.1", 7030);

    SRpcMsg rpcMsg;
    rpcMsg.contLen = 64;
    rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
M
Minghao Li 已提交
37
    snprintf((char *)rpcMsg.pCont, rpcMsg.contLen, "%s", "syncIOSendMsgTest");
M
sync io  
Minghao Li 已提交
38 39 40 41
    rpcMsg.handle = NULL;
    rpcMsg.msgType = 77;

    syncIOSendMsg(gSyncIO->clientRpc, &epSet, &rpcMsg);
wafwerar's avatar
wafwerar 已提交
42
    taosSsleep(1);
M
sync io  
Minghao Li 已提交
43 44 45
  }

  while (1) {
wafwerar's avatar
wafwerar 已提交
46
    taosSsleep(1);
M
sync io  
Minghao Li 已提交
47 48 49 50
  }

  return 0;
}