transUT.cpp 12.1 KB
Newer Older
dengyihao's avatar
dengyihao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free
 * Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#include <gtest/gtest.h>
#include <cstdio>
#include <cstring>
H
Haojun Liao 已提交
18
#include "tdatablock.h"
dengyihao's avatar
dengyihao 已提交
19
#include "tglobal.h"
S
log  
Shengliang Guan 已提交
20
#include "tlog.h"
dengyihao's avatar
dengyihao 已提交
21
#include "transLog.h"
H
Haojun Liao 已提交
22
#include "trpc.h"
dengyihao's avatar
dengyihao 已提交
23 24
using namespace std;

dengyihao's avatar
dengyihao 已提交
25 26 27 28
const char *label = "APP";
const char *secret = "secret";
const char *user = "user";
const char *ckey = "ckey";
dengyihao's avatar
dengyihao 已提交
29

dengyihao's avatar
dengyihao 已提交
30 31 32
class Server;
int port = 7000;
// server process
dengyihao's avatar
dengyihao 已提交
33
// server except
dengyihao's avatar
dengyihao 已提交
34

dengyihao's avatar
dengyihao 已提交
35
typedef void (*CB)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
36 37

static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
38 39
static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
dengyihao's avatar
dengyihao 已提交
40 41 42 43 44 45
static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
// client process;
static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet);
class Client {
 public:
  void Init(int nThread) {
dengyihao's avatar
dengyihao 已提交
46
    memcpy(tsTempDir, "/tmp", strlen("/tmp"));
dengyihao's avatar
dengyihao 已提交
47 48 49 50 51 52 53 54 55
    memset(&rpcInit_, 0, sizeof(rpcInit_));
    rpcInit_.localPort = 0;
    rpcInit_.label = (char *)label;
    rpcInit_.numOfThreads = nThread;
    rpcInit_.cfp = processResp;
    rpcInit_.user = (char *)user;
    rpcInit_.parent = this;
    rpcInit_.connType = TAOS_CONN_CLIENT;
    this->transCli = rpcOpen(&rpcInit_);
dengyihao's avatar
dengyihao 已提交
56
    tsem_init(&this->sem, 0, 0);
dengyihao's avatar
dengyihao 已提交
57
  }
dengyihao's avatar
dengyihao 已提交
58 59 60 61 62 63
  void SetResp(SRpcMsg *pMsg) {
    // set up resp;
    this->resp = *pMsg;
  }
  SRpcMsg *Resp() { return &this->resp; }

dengyihao's avatar
dengyihao 已提交
64 65 66 67 68
  void Restart(CB cb) {
    rpcClose(this->transCli);
    rpcInit_.cfp = cb;
    this->transCli = rpcOpen(&rpcInit_);
  }
dengyihao's avatar
dengyihao 已提交
69 70 71 72
  void Stop() {
    rpcClose(this->transCli);
    this->transCli = NULL;
  }
dengyihao's avatar
dengyihao 已提交
73

dengyihao's avatar
dengyihao 已提交
74
  void SendAndRecv(SRpcMsg *req, SRpcMsg *resp) {
dengyihao's avatar
dengyihao 已提交
75 76
    SEpSet epSet = {0};
    epSet.inUse = 0;
dengyihao's avatar
dengyihao 已提交
77
    addEpIntoEpSet(&epSet, "127.0.0.1", 7000);
dengyihao's avatar
dengyihao 已提交
78

dengyihao's avatar
dengyihao 已提交
79 80 81
    rpcSendRequest(this->transCli, &epSet, req, NULL);
    SemWait();
    *resp = this->resp;
dengyihao's avatar
dengyihao 已提交
82
  }
dengyihao's avatar
dengyihao 已提交
83
  void SendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) {
S
Shengliang Guan 已提交
84 85 86
    if (req->info.handle != NULL) {
      rpcReleaseHandle(req->info.handle, TAOS_CONN_CLIENT);
      req->info.handle = NULL;
dengyihao's avatar
dengyihao 已提交
87 88 89 90
    }
    SendAndRecv(req, resp);
  }

dengyihao's avatar
dengyihao 已提交
91 92 93 94 95 96
  void SemWait() { tsem_wait(&this->sem); }
  void SemPost() { tsem_post(&this->sem); }
  void Reset() {}

  ~Client() {
    if (this->transCli) rpcClose(this->transCli);
dengyihao's avatar
dengyihao 已提交
97 98 99
  }

 private:
dengyihao's avatar
dengyihao 已提交
100
  tsem_t   sem;
dengyihao's avatar
dengyihao 已提交
101
  SRpcInit rpcInit_;
dengyihao's avatar
dengyihao 已提交
102 103 104 105 106 107
  void *   transCli;
  SRpcMsg  resp;
};
class Server {
 public:
  Server() {
dengyihao's avatar
dengyihao 已提交
108
    memcpy(tsTempDir, "/tmp", strlen("/tmp"));
dengyihao's avatar
dengyihao 已提交
109
    memset(&rpcInit_, 0, sizeof(rpcInit_));
dengyihao's avatar
dengyihao 已提交
110 111

    memcpy(rpcInit_.localFqdn, "localhost", strlen("localhost"));
dengyihao's avatar
dengyihao 已提交
112 113 114 115 116 117
    rpcInit_.localPort = port;
    rpcInit_.label = (char *)label;
    rpcInit_.numOfThreads = 5;
    rpcInit_.cfp = processReq;
    rpcInit_.user = (char *)user;
    rpcInit_.connType = TAOS_CONN_SERVER;
dengyihao's avatar
dengyihao 已提交
118 119
  }
  void Start() {
dengyihao's avatar
dengyihao 已提交
120
    this->transSrv = rpcOpen(&this->rpcInit_);
dengyihao's avatar
dengyihao 已提交
121 122
    taosMsleep(1000);
  }
dengyihao's avatar
dengyihao 已提交
123 124 125 126 127
  void SetSrvContinueSend(CB cb) {
    this->Stop();
    rpcInit_.cfp = cb;
    this->Start();
  }
dengyihao's avatar
dengyihao 已提交
128 129 130 131 132
  void Stop() {
    if (this->transSrv == NULL) return;
    rpcClose(this->transSrv);
    this->transSrv = NULL;
  }
dengyihao's avatar
dengyihao 已提交
133
  void SetSrvSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) {
dengyihao's avatar
dengyihao 已提交
134 135 136 137
    this->Stop();
    rpcInit_.cfp = cfp;
    this->Start();
  }
dengyihao's avatar
dengyihao 已提交
138 139 140 141 142 143 144 145 146 147
  void Restart() {
    this->Stop();
    this->Start();
  }
  ~Server() {
    if (this->transSrv) rpcClose(this->transSrv);
    this->transSrv = NULL;
  }

 private:
dengyihao's avatar
dengyihao 已提交
148
  SRpcInit rpcInit_;
dengyihao's avatar
dengyihao 已提交
149 150 151 152 153 154
  void *   transSrv;
};
static void processReq(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
S
Shengliang Guan 已提交
155
  rpcMsg.info = pMsg->info;
dengyihao's avatar
dengyihao 已提交
156 157 158
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);
}
dengyihao's avatar
dengyihao 已提交
159 160 161 162 163 164

static void processContinueSend(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  for (int i = 0; i < 10; i++) {
    SRpcMsg rpcMsg = {0};
    rpcMsg.pCont = rpcMallocCont(100);
    rpcMsg.contLen = 100;
S
Shengliang Guan 已提交
165
    rpcMsg.info = pMsg->info;
dengyihao's avatar
dengyihao 已提交
166 167 168 169
    rpcMsg.code = 0;
    rpcSendResponse(&rpcMsg);
  }
}
dengyihao's avatar
dengyihao 已提交
170 171 172 173
static void processReleaseHandleCb(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
S
Shengliang Guan 已提交
174
  rpcMsg.info = pMsg->info;
dengyihao's avatar
dengyihao 已提交
175 176 177
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);

S
Shengliang Guan 已提交
178
  rpcReleaseHandle(pMsg->info.handle, TAOS_CONN_SERVER);
dengyihao's avatar
dengyihao 已提交
179 180 181 182 183 184
}
static void processRegisterFailure(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  {
    SRpcMsg rpcMsg1 = {0};
    rpcMsg1.pCont = rpcMallocCont(100);
    rpcMsg1.contLen = 100;
S
Shengliang Guan 已提交
185
    rpcMsg1.info = pMsg->info;
dengyihao's avatar
dengyihao 已提交
186 187 188 189 190 191 192 193
    rpcMsg1.code = 0;
    rpcRegisterBrokenLinkArg(&rpcMsg1);
  }
  taosMsleep(10);

  SRpcMsg rpcMsg = {0};
  rpcMsg.pCont = rpcMallocCont(100);
  rpcMsg.contLen = 100;
S
Shengliang Guan 已提交
194
  rpcMsg.info = pMsg->info;
dengyihao's avatar
dengyihao 已提交
195 196 197
  rpcMsg.code = 0;
  rpcSendResponse(&rpcMsg);
}
dengyihao's avatar
dengyihao 已提交
198 199 200 201 202
// client process;
static void processResp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
  Client *client = (Client *)parent;
  client->SetResp(pMsg);
  client->SemPost();
dengyihao's avatar
dengyihao 已提交
203
  tDebug("received resp");
dengyihao's avatar
dengyihao 已提交
204
}
dengyihao's avatar
dengyihao 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222

static void initEnv() {
  dDebugFlag = 143;
  vDebugFlag = 0;
  mDebugFlag = 143;
  cDebugFlag = 0;
  jniDebugFlag = 0;
  tmrDebugFlag = 143;
  uDebugFlag = 143;
  rpcDebugFlag = 143;
  qDebugFlag = 0;
  wDebugFlag = 0;
  sDebugFlag = 0;
  tsdbDebugFlag = 0;
  tsLogEmbedded = 1;
  tsAsyncLog = 0;

  std::string path = "/tmp/transport";
dengyihao's avatar
dengyihao 已提交
223
  // taosRemoveDir(path.c_str());
dengyihao's avatar
dengyihao 已提交
224 225 226 227 228 229 230
  taosMkDir(path.c_str());

  tstrncpy(tsLogDir, path.c_str(), PATH_MAX);
  if (taosInitLog("taosdlog", 1) != 0) {
    printf("failed to init log file\n");
  }
}
dengyihao's avatar
dengyihao 已提交
231

dengyihao's avatar
dengyihao 已提交
232 233 234
class TransObj {
 public:
  TransObj() {
dengyihao's avatar
dengyihao 已提交
235
    initEnv();
dengyihao's avatar
dengyihao 已提交
236 237 238 239 240
    cli = new Client;
    cli->Init(1);
    srv = new Server;
    srv->Start();
  }
dengyihao's avatar
dengyihao 已提交
241

dengyihao's avatar
dengyihao 已提交
242 243 244 245 246 247 248 249 250 251 252 253
  void RestartCli(CB cb) {
    //
    cli->Restart(cb);
  }
  void StopSrv() {
    //
    srv->Stop();
  }
  // call when link broken, and notify query or fetch stop
  void SetSrvContinueSend(void (*cfp)(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet)) {
    ///////
    srv->SetSrvContinueSend(cfp);
dengyihao's avatar
dengyihao 已提交
254
  }
dengyihao's avatar
dengyihao 已提交
255
  void RestartSrv() { srv->Restart(); }
dengyihao's avatar
dengyihao 已提交
256
  void StopCli() {
dengyihao's avatar
dengyihao 已提交
257 258 259
    ///////
    cli->Stop();
  }
dengyihao's avatar
dengyihao 已提交
260
  void cliSendAndRecv(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecv(req, resp); }
dengyihao's avatar
dengyihao 已提交
261
  void cliSendAndRecvNoHandle(SRpcMsg *req, SRpcMsg *resp) { cli->SendAndRecvNoHandle(req, resp); }
dengyihao's avatar
dengyihao 已提交
262

dengyihao's avatar
dengyihao 已提交
263 264 265 266 267 268 269 270
  ~TransObj() {
    delete cli;
    delete srv;
  }

 private:
  Client *cli;
  Server *srv;
dengyihao's avatar
dengyihao 已提交
271 272 273 274 275 276 277 278 279 280 281 282 283 284
};
class TransEnv : public ::testing::Test {
 protected:
  virtual void SetUp() {
    // set up trans obj
    tr = new TransObj();
  }
  virtual void TearDown() {
    // tear down
    delete tr;
  }

  TransObj *tr = NULL;
};
dengyihao's avatar
dengyihao 已提交
285

dengyihao's avatar
dengyihao 已提交
286
TEST_F(TransEnv, 01sendAndRec) {
dengyihao's avatar
dengyihao 已提交
287
  for (int i = 0; i < 10; i++) {
dengyihao's avatar
dengyihao 已提交
288 289 290 291 292 293 294 295
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }
}
dengyihao's avatar
dengyihao 已提交
296 297 298 299 300

TEST_F(TransEnv, 02StopServer) {
  for (int i = 0; i < 1; i++) {
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
dengyihao's avatar
dengyihao 已提交
301
    req.info.ahandle = (void *)0x35;
dengyihao's avatar
dengyihao 已提交
302 303 304 305 306 307
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }
  SRpcMsg req = {0}, resp = {0};
dengyihao's avatar
dengyihao 已提交
308
  req.info.ahandle = (void *)0x35;
dengyihao's avatar
dengyihao 已提交
309 310 311 312 313 314 315
  req.msgType = 1;
  req.pCont = rpcMallocCont(10);
  req.contLen = 10;
  tr->StopSrv();
  // tr->RestartSrv();
  tr->cliSendAndRecv(&req, &resp);
  assert(resp.code != 0);
dengyihao's avatar
dengyihao 已提交
316
}
dengyihao's avatar
dengyihao 已提交
317 318 319 320 321 322 323 324 325 326 327 328 329
TEST_F(TransEnv, clientUserDefined) {
  tr->RestartSrv();
  for (int i = 0; i < 10; i++) {
    SRpcMsg req = {0}, resp = {0};
    req.msgType = 0;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
    assert(resp.code == 0);
  }

  //////////////////
}
dengyihao's avatar
dengyihao 已提交
330 331

TEST_F(TransEnv, cliPersistHandle) {
dengyihao's avatar
dengyihao 已提交
332
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
333
  void *  handle = NULL;
dengyihao's avatar
dengyihao 已提交
334
  for (int i = 0; i < 10; i++) {
H
Haojun Liao 已提交
335
    SRpcMsg req = {0};
S
Shengliang Guan 已提交
336 337
    req.info = resp.info;
    req.info.persistHandle = 1;
H
Haojun Liao 已提交
338

dengyihao's avatar
dengyihao 已提交
339 340 341 342
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
dengyihao's avatar
dengyihao 已提交
343 344 345 346 347 348 349
    // if (i == 5) {
    //  std::cout << "stop server" << std::endl;
    //  tr->StopSrv();
    //}
    // if (i >= 6) {
    //  EXPECT_TRUE(resp.code != 0);
    //}
S
Shengliang Guan 已提交
350
    handle = resp.info.handle;
dengyihao's avatar
dengyihao 已提交
351
  }
dengyihao's avatar
dengyihao 已提交
352 353 354 355 356 357 358 359 360 361
  rpcReleaseHandle(handle, TAOS_CONN_CLIENT);
  for (int i = 0; i < 10; i++) {
    SRpcMsg req = {0};
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
    tr->cliSendAndRecv(&req, &resp);
  }

  taosMsleep(1000);
dengyihao's avatar
dengyihao 已提交
362 363 364
  //////////////////
}

dengyihao's avatar
dengyihao 已提交
365
TEST_F(TransEnv, srvReleaseHandle) {
dengyihao's avatar
dengyihao 已提交
366
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
367 368
  tr->SetSrvContinueSend(processReleaseHandleCb);
  // tr->Restart(processReleaseHandleCb);
dengyihao's avatar
dengyihao 已提交
369 370
  void *  handle = NULL;
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
371
  for (int i = 0; i < 1; i++) {
dengyihao's avatar
dengyihao 已提交
372
    memset(&req, 0, sizeof(req));
S
Shengliang Guan 已提交
373 374
    req.info = resp.info;
    req.info.persistHandle = 1;
dengyihao's avatar
dengyihao 已提交
375 376 377
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
dengyihao's avatar
dengyihao 已提交
378 379
    tr->cliSendAndRecv(&req, &resp);
    // tr->cliSendAndRecvNoHandle(&req, &resp);
dengyihao's avatar
dengyihao 已提交
380 381 382 383 384 385
    EXPECT_TRUE(resp.code == 0);
  }
  //////////////////
}
TEST_F(TransEnv, cliReleaseHandleExcept) {
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
386
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
387
  for (int i = 0; i < 3; i++) {
dengyihao's avatar
dengyihao 已提交
388
    memset(&req, 0, sizeof(req));
S
Shengliang Guan 已提交
389 390
    req.info = resp.info;
    req.info.persistHandle = 1;
dengyihao's avatar
dengyihao 已提交
391
    req.info.ahandle = (void *)1234;
dengyihao's avatar
dengyihao 已提交
392 393 394
    req.msgType = 1;
    req.pCont = rpcMallocCont(10);
    req.contLen = 10;
dengyihao's avatar
dengyihao 已提交
395 396
    tr->cliSendAndRecv(&req, &resp);
    if (i == 1) {
dengyihao's avatar
dengyihao 已提交
397 398 399
      std::cout << "stop server" << std::endl;
      tr->StopSrv();
    }
dengyihao's avatar
dengyihao 已提交
400
    if (i > 1) {
dengyihao's avatar
dengyihao 已提交
401 402 403
      EXPECT_TRUE(resp.code != 0);
    }
  }
dengyihao's avatar
dengyihao 已提交
404
  //////////////////
dengyihao's avatar
dengyihao 已提交
405
}
dengyihao's avatar
dengyihao 已提交
406 407
TEST_F(TransEnv, srvContinueSend) {
  tr->SetSrvContinueSend(processContinueSend);
dengyihao's avatar
dengyihao 已提交
408
  SRpcMsg req = {0}, resp = {0};
dengyihao's avatar
dengyihao 已提交
409
  for (int i = 0; i < 10; i++) {
dengyihao's avatar
dengyihao 已提交
410 411 412 413 414 415
    // memset(&req, 0, sizeof(req));
    // memset(&resp, 0, sizeof(resp));
    // req.msgType = 1;
    // req.pCont = rpcMallocCont(10);
    // req.contLen = 10;
    // tr->cliSendAndRecv(&req, &resp);
dengyihao's avatar
dengyihao 已提交
416
  }
dengyihao's avatar
dengyihao 已提交
417
  taosMsleep(1000);
dengyihao's avatar
dengyihao 已提交
418 419
}

dengyihao's avatar
dengyihao 已提交
420
TEST_F(TransEnv, srvPersistHandleExcept) {
dengyihao's avatar
dengyihao 已提交
421
  tr->SetSrvContinueSend(processContinueSend);
dengyihao's avatar
dengyihao 已提交
422
  // tr->SetCliPersistFp(cliPersistHandle);
dengyihao's avatar
dengyihao 已提交
423
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
424
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
425
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
426 427 428 429 430 431 432 433 434 435
    // memset(&req, 0, sizeof(req));
    // req.info = resp.info;
    // req.msgType = 1;
    // req.pCont = rpcMallocCont(10);
    // req.contLen = 10;
    // tr->cliSendAndRecv(&req, &resp);
    // if (i > 2) {
    //  tr->StopCli();
    //  break;
    //}
dengyihao's avatar
dengyihao 已提交
436 437 438
  }
  taosMsleep(2000);
  // conn broken
dengyihao's avatar
dengyihao 已提交
439 440
  //
}
dengyihao's avatar
dengyihao 已提交
441 442 443
TEST_F(TransEnv, cliPersistHandleExcept) {
  tr->SetSrvContinueSend(processContinueSend);
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
444
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
445
  for (int i = 0; i < 5; i++) {
dengyihao's avatar
dengyihao 已提交
446 447 448 449 450 451 452 453 454 455
    // memset(&req, 0, sizeof(req));
    // req.info = resp.info;
    // req.msgType = 1;
    // req.pCont = rpcMallocCont(10);
    // req.contLen = 10;
    // tr->cliSendAndRecv(&req, &resp);
    // if (i > 2) {
    //  tr->StopSrv();
    //  break;
    //}
dengyihao's avatar
dengyihao 已提交
456 457 458 459 460
  }
  taosMsleep(2000);
  // conn broken
  //
}
dengyihao's avatar
dengyihao 已提交
461

dengyihao's avatar
dengyihao 已提交
462 463
TEST_F(TransEnv, multiCliPersistHandleExcept) {
  // conn broken
dengyihao's avatar
dengyihao 已提交
464
}
dengyihao's avatar
dengyihao 已提交
465 466 467
TEST_F(TransEnv, queryExcept) {
  tr->SetSrvContinueSend(processRegisterFailure);
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
468
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
469 470 471 472 473 474 475 476 477 478 479 480 481 482
  // for (int i = 0; i < 5; i++) {
  //  memset(&req, 0, sizeof(req));
  //  req.info = resp.info;
  //  req.info.persistHandle = 1;
  //  req.msgType = 1;
  //  req.pCont = rpcMallocCont(10);
  //  req.contLen = 10;
  //  tr->cliSendAndRecv(&req, &resp);
  //  if (i == 2) {
  //    rpcReleaseHandle(resp.info.handle, TAOS_CONN_CLIENT);
  //    tr->StopCli();
  //    break;
  //  }
  //}
dengyihao's avatar
dengyihao 已提交
483 484
  taosMsleep(4 * 1000);
}
dengyihao's avatar
dengyihao 已提交
485
TEST_F(TransEnv, noResp) {
dengyihao's avatar
dengyihao 已提交
486
  SRpcMsg resp = {0};
dengyihao's avatar
dengyihao 已提交
487
  SRpcMsg req = {0};
dengyihao's avatar
dengyihao 已提交
488 489 490 491 492 493 494 495 496
  // for (int i = 0; i < 5; i++) {
  //  memset(&req, 0, sizeof(req));
  //  req.info.noResp = 1;
  //  req.msgType = 1;
  //  req.pCont = rpcMallocCont(10);
  //  req.contLen = 10;
  //  tr->cliSendAndRecv(&req, &resp);
  //}
  // taosMsleep(2000);
dengyihao's avatar
dengyihao 已提交
497

dengyihao's avatar
dengyihao 已提交
498 499
  // no resp
}