“0d1d9f6199af46c7e72860897a1e0f72f8c347f3”上不存在“docs/en/07-data-in/emqx/add-action-handler.webp”
提交 0c0d6b43 编写于 作者: P Ping Xiao

[TS-932]<test>: add test case for client clientMerge option

上级 2409a9d0
...@@ -156,6 +156,7 @@ python3 ./test.py -f import_merge/import_update_0.py ...@@ -156,6 +156,7 @@ python3 ./test.py -f import_merge/import_update_0.py
python3 ./test.py -f import_merge/import_update_1.py python3 ./test.py -f import_merge/import_update_1.py
python3 ./test.py -f import_merge/import_update_2.py python3 ./test.py -f import_merge/import_update_2.py
python3 ./test.py -f update/merge_commit_data.py python3 ./test.py -f update/merge_commit_data.py
python3 ./test.py -f update/updateWithClientMerge.py
#======================p1-end=============== #======================p1-end===============
#======================p2-start=============== #======================p2-start===============
# tools # tools
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
updatecfgDict={'clientMerge':1}
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.ts = 1606700000000
def run(self):
# TS-932
tdSql.execute("create database db3 update 2")
tdSql.execute("use db3")
tdSql.execute("drop table if exists tb")
tdSql.execute("create table tb (ts timestamp, c1 int, c2 int, c3 int)")
tdSql.execute("insert into tb values(%d, 1, 2, 3)(%d, null, 4, 5)(%d, 6, null, null)" % (self.ts, self.ts, self.ts))
tdSql.query("select * from tb")
tdSql.checkData(0, 1, 6)
tdSql.checkData(0, 2, None)
tdSql.checkData(0, 3, None)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -20,6 +20,7 @@ from util.dnodes import * ...@@ -20,6 +20,7 @@ from util.dnodes import *
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
...@@ -110,7 +111,6 @@ class TDTestCase: ...@@ -110,7 +111,6 @@ class TDTestCase:
tdSql.checkData(0, 2, 4) tdSql.checkData(0, 2, 4)
tdSql.checkData(0, 3, 7) tdSql.checkData(0, 3, 7)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -64,10 +64,12 @@ class TDSimClient: ...@@ -64,10 +64,12 @@ class TDSimClient:
cmd = "echo %s %s >> %s" % (option, value, self.cfgPath) cmd = "echo %s %s >> %s" % (option, value, self.cfgPath)
if os.system(cmd) != 0: if os.system(cmd) != 0:
tdLog.exit(cmd) tdLog.exit(cmd)
def os_string(self,path): def os_string(self,path):
os_path = path.replace("/",os.sep) os_path = path.replace("/",os.sep)
return os_path return os_path
def deploy(self):
def deploy(self, *updatecfgDict):
self.logDir = self.os_string("%s/sim/psim/log" % (self.path)) self.logDir = self.os_string("%s/sim/psim/log" % (self.path))
self.cfgDir = self.os_string("%s/sim/psim/cfg" % (self.path)) self.cfgDir = self.os_string("%s/sim/psim/cfg" % (self.path))
self.cfgPath = self.os_string("%s/sim/psim/cfg/taos.cfg" % (self.path)) self.cfgPath = self.os_string("%s/sim/psim/cfg/taos.cfg" % (self.path))
...@@ -108,6 +110,13 @@ class TDSimClient: ...@@ -108,6 +110,13 @@ class TDSimClient:
self.cfg("secondIp", "192.168.0.2") self.cfg("secondIp", "192.168.0.2")
self.cfg("logDir", self.logDir) self.cfg("logDir", self.logDir)
# update extra client config
clientCfgkeys = ["clientMerge"]
if updatecfgDict[0] and updatecfgDict[0][0]:
for key, value in updatecfgDict[0][0].items():
if key in clientCfgkeys:
self.cfg(key, value)
for key, value in self.cfgDict.items(): for key, value in self.cfgDict.items():
self.cfg(key, value) self.cfg(key, value)
...@@ -505,7 +514,7 @@ class TDDnodes: ...@@ -505,7 +514,7 @@ class TDDnodes:
self.sim.setTestCluster(self.testCluster) self.sim.setTestCluster(self.testCluster)
if (self.simDeployed == False): if (self.simDeployed == False):
self.sim.deploy() self.sim.deploy(updatecfgDict)
self.simDeployed = True self.simDeployed = True
self.check(index) self.check(index)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册