tmq_offset.py 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

import taos
import sys
import time
import socket
import os
import threading

from util.log import *
from util.sql import *
from util.cases import *
from util.dnodes import *
from util.common import *
sys.path.append("./7-tmq")
from tmqCommon import *

class TDTestCase:
    def init(self, conn, logSql, replicaVar=1):
        self.replicaVar = int(replicaVar)
        tdLog.debug(f"start to excute {__file__}")
        tdSql.init(conn.cursor())

    def run(self):
        tdSql.prepare()
        buildPath = tdCom.getBuildPath()
26
        cmdStr1 = '%s/build/bin/taosBenchmark -i 50 -B 1 -t 1000 -n 100000 -y &'%(buildPath)
27 28
        tdLog.info(cmdStr1)
        os.system(cmdStr1)
29
        time.sleep(15)
30 31 32 33 34

        cmdStr2 = '%s/build/bin/tmq_offset_test &'%(buildPath)
        tdLog.info(cmdStr2)
        os.system(cmdStr2)

35
        time.sleep(20)
36 37 38 39 40 41 42 43 44 45 46 47

        os.system("kill -9 `pgrep taosBenchmark`")
        result = os.system("kill -9 `pgrep tmq_offset_test`")
        if result != 0:
            tdLog.exit("tmq_offset_test error!")

    def stop(self):
        tdSql.close()
        tdLog.success(f"{__file__} successfully executed")

tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())