提交 5746eb5c 编写于 作者: L liuyq-617

fix dict error

上级 b66428c3
...@@ -30,12 +30,15 @@ class TDTestCase: ...@@ -30,12 +30,15 @@ class TDTestCase:
self.startTime = 1520000010000 self.startTime = 1520000010000
tdDnodes.stop(1) tdDnodes.stop(1)
print('-'*40)
cfg={ cfg={
'dataDir': '/mnt/data1', '/mnt/data1' : 'dataDir',
'dataDir': '/mnt/data2 0 0' '/mnt/data2 0 0' : 'dataDir'
} }
print('*'*40)
tdSql.createDir('/mnt/data1') tdSql.createDir('/mnt/data1')
tdSql.createDir('/mnt/data2') tdSql.createDir('/mnt/data2')
print('+'*40)
tdDnodes.deploy(1,cfg) tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1) tdDnodes.startWithoutSleep(1)
......
###################################################################
# 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:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 10
self.rowsPerTable = 10
self.startTime = 1520000010000
tdDnodes.stop(1)
cfg={
'dataDir': '/mnt/data1 0 0 ',
'dataDir': '/mnt/data2 0 0'
}
tdSql.createDir('/mnt/data1')
tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1)
tdSql.taosdStatus(0)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 10
self.rowsPerTable = 10
self.startTime = 1520000010000
tdDnodes.stop(1)
cfg={
'dataDir': '/mnt/data1 0 0',
'dataDir': '/mnt/data2 0 0',
'dataDir': '/mnt/data3 0 0',
'dataDir': '/mnt/data4 0 0',
'dataDir': '/mnt/data5 0 0',
'dataDir': '/mnt/data6 0 0',
'dataDir': '/mnt/data7 0 0',
'dataDir': '/mnt/data8 0 0',
'dataDir': '/mnt/data9 0 0',
'dataDir': '/mnt/data10 0 0',
'dataDir': '/mnt/data11 0 0',
'dataDir': '/mnt/data12 0 0',
'dataDir': '/mnt/data13 0 0',
'dataDir': '/mnt/data14 0 0',
'dataDir': '/mnt/data15 0 0',
'dataDir': '/mnt/data16 0 0',
'dataDir': '/mnt/data17 0 0'
}
tdSql.createDir('/mnt/data1')
tdSql.createDir('/mnt/data2')
tdSql.createDir('/mnt/data3')
tdSql.createDir('/mnt/data4')
tdSql.createDir('/mnt/data5')
tdSql.createDir('/mnt/data6')
tdSql.createDir('/mnt/data7')
tdSql.createDir('/mnt/data8')
tdSql.createDir('/mnt/data9')
tdSql.createDir('/mnt/data10')
tdSql.createDir('/mnt/data11')
tdSql.createDir('/mnt/data12')
tdSql.createDir('/mnt/data13')
tdSql.createDir('/mnt/data14')
tdSql.createDir('/mnt/data15')
tdSql.createDir('/mnt/data16')
tdSql.createDir('/mnt/data17')
tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1)
tdSql.taosdStatus(0)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 10
self.rowsPerTable = 10
self.startTime = 1520000010000
tdDnodes.stop(1)
cfg={
'dataDir': '/mnt/data1',
'dataDir': '/mnt/data2'
}
tdSql.createDir('/mnt/data1')
tdSql.createDir('/mnt/data2')
tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1)
tdSql.taosdStatus(0)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 10
self.rowsPerTable = 10
self.startTime = 1520000010000
tdDnodes.stop(1)
cfg={
'dataDir': '/mnt/data1 0 0',
'dataDir': '/mnt/data2 0 0'
}
tdSql.createDir('/mnt/data1')
tdSql.createDir('/mnt/data2')
tdDnodes.deploy(1,cfg)
tdDnodes.startWithoutSleep(1)
tdSql.taosdStatus(0)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
cfg={
'/mnt/data1 0 0': 'dataDir' ,
'dataDir': '/mnt/data2 0 0',
'dataDir': '/mnt/data3 0 0',
'dataDir': '/mnt/data4 0 0',
'dataDir': '/mnt/data5 0 0',
'dataDir': '/mnt/data6 0 0',
'dataDir': '/mnt/data7 0 0',
'dataDir': '/mnt/data8 0 0',
'dataDir': '/mnt/data9 0 0',
'dataDir': '/mnt/data10 0 0',
'dataDir': '/mnt/data11 0 0',
'dataDir': '/mnt/data12 0 0',
'dataDir': '/mnt/data13 0 0',
'dataDir': '/mnt/data14 0 0',
'dataDir': '/mnt/data15 0 0',
'dataDir': '/mnt/data16 0 0',
'dataDir': '/mnt/data17 0 0'
}
print(cfg)
\ No newline at end of file
...@@ -208,13 +208,23 @@ class TDDnode: ...@@ -208,13 +208,23 @@ class TDDnode:
self.cfg("publicIp", "192.168.0.%d" % (self.index)) self.cfg("publicIp", "192.168.0.%d" % (self.index))
self.cfg("internalIp", "192.168.0.%d" % (self.index)) self.cfg("internalIp", "192.168.0.%d" % (self.index))
self.cfg("privateIp", "192.168.0.%d" % (self.index)) self.cfg("privateIp", "192.168.0.%d" % (self.index))
self.cfgDict["dataDir"] = self.dataDir
self.cfg("dataDir",self.dataDir) self.cfgDict["logDir"] = self.logDir
self.cfg("logDir",self.logDir) # self.cfg("dataDir",self.dataDir)
# self.cfg("logDir",self.logDir)
print(updatecfgDict) print(updatecfgDict)
isFirstDir = 1
if updatecfgDict[0] and updatecfgDict[0][0]: if updatecfgDict[0] and updatecfgDict[0][0]:
print(updatecfgDict[0][0]) print(updatecfgDict[0][0])
for key,value in updatecfgDict[0][0].items(): for key,value in updatecfgDict[0][0].items():
if value == 'dataDir' :
if isFirstDir:
self.cfgDict.pop('dataDir')
self.cfg(value,key)
isFirstDir = 0
else:
self.cfg(value,key)
else:
self.addExtraCfg(key,value) self.addExtraCfg(key,value)
for key, value in self.cfgDict.items(): for key, value in self.cfgDict.items():
self.cfg(key, value) self.cfg(key, value)
......
...@@ -199,33 +199,33 @@ class TDSql: ...@@ -199,33 +199,33 @@ class TDSql:
break break
if loop:break if loop:break
time.sleep(5) time.sleep(5)
args=(pstate,state)
if pstate == state: if pstate == state:
tdLog.info("taosd state is %d == expect:%d",pstate,state) tdLog.info("taosd state is %d == expect:%d" %args)
else: else:
tdLog.exit("taosd state is %d != expect:%d" ,pstate,state) tdLog.exit("taosd state is %d != expect:%d" %args)
pass pass
def haveFile(self, dir, state): def haveFile(self, dir, state):
if os.path.exists(dir) and os.path.isdir(dir): if os.path.exists(dir) and os.path.isdir(dir):
if not os.listdir(dir): if not os.listdir(dir):
if state : if state :
tdLog.exit("dir: %s is empty, expect: not empty" ,dir) tdLog.exit("dir: %s is empty, expect: not empty" %dir)
else: else:
tdLog.info("dir: %s is empty, expect: empty" ,dir) tdLog.info("dir: %s is empty, expect: empty" %dir)
else: else:
if state : if state :
tdLog.info("dir: %s is empty, expect: not empty" ,dir) tdLog.info("dir: %s is empty, expect: not empty" %dir)
else: else:
tdLog.exit("dir: %s is empty, expect: empty" ,dir) tdLog.exit("dir: %s is empty, expect: empty" %dir)
else: else:
tdLog.exit("dir: %s doesn't exist" ,dir) tdLog.exit("dir: %s doesn't exist" %dir)
def createDir(self, dir): def createDir(self, dir):
if os.path.exists(dir): if os.path.exists(dir):
shutil.rmtree(dir) shutil.rmtree(dir)
tdLog.info("dir: %s is removed" ,dir) tdLog.info("dir: %s is removed" %dir)
os.makedirs( dir, 755 ) os.makedirs( dir, 755 )
tdLog.info("dir: %s is created" ,dir) tdLog.info("dir: %s is created" %dir)
pass pass
tdSql = TDSql() tdSql = TDSql()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册