提交 1de90208 编写于 作者: K kailixu

test: test case for alter dnode active code

上级 0e891c5c
...@@ -267,8 +267,8 @@ typedef enum ELogicConditionType { ...@@ -267,8 +267,8 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_CONFIG_LEN 128 #define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_VALUE_LEN 256 #define TSDB_DNODE_VALUE_LEN 256
#define TSDB_ACTIVE_KEY_LEN 109 // history 109:? #define TSDB_ACTIVE_KEY_LEN 109
#define TSDB_CONN_ACTIVE_KEY_LEN 257 // history 257:? #define TSDB_CONN_ACTIVE_KEY_LEN 255
#define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE #define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE
......
...@@ -1055,8 +1055,8 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { ...@@ -1055,8 +1055,8 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
int32_t vlen = strlen(cfgReq.value); int32_t vlen = strlen(cfgReq.value);
if (vlen > 0 && ((idx == 10 && vlen != (TSDB_ACTIVE_KEY_LEN - 1)) || if (vlen > 0 && ((idx == 10 && vlen != (TSDB_ACTIVE_KEY_LEN - 1)) ||
(idx == 11 && (vlen > (TSDB_CONN_ACTIVE_KEY_LEN - 1) || vlen < (TSDB_ACTIVE_KEY_LEN - 1))))) { (idx == 11 && (vlen > (TSDB_CONN_ACTIVE_KEY_LEN - 1) || vlen < (TSDB_ACTIVE_KEY_LEN - 1))))) {
mError("dnode:%d, failed to config activeCode since invalid vlen. conf:%s, val:%s", cfgReq.dnodeId, cfgReq.config, mError("dnode:%d, failed to config activeCode since invalid vlen:%d. conf:%s, val:%s", cfgReq.dnodeId, vlen,
cfgReq.value); cfgReq.config, cfgReq.value);
terrno = TSDB_CODE_INVALID_OPTION; terrno = TSDB_CODE_INVALID_OPTION;
return -1; return -1;
} }
......
...@@ -162,7 +162,48 @@ class TDTestCase: ...@@ -162,7 +162,48 @@ class TDTestCase:
for t in range (2): for t in range (2):
tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type=="NORMAL_TABLE"') tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type=="NORMAL_TABLE"')
tdSql.checkEqual(20470,len(tdSql.queryResult)) tdSql.checkEqual(20470,len(tdSql.queryResult))
def ins_dnodes_check(self):
tdSql.execute('drop database if exists db2')
tdSql.execute('create database if not exists db2 vgroups 1 replica 1')
tdSql.query(f'select * from information_schema.ins_dnodes')
result = tdSql.queryResult
tdSql.checkEqual(result[0][0],1)
tdSql.checkEqual(result[0][8],"")
tdSql.checkEqual(result[0][9],"")
self.str107 = 'Hc7VCc+'
for t in range (10):
self.str107 += 'tP+2soIXpP'
self.str108 = self.str107 + '='
self.str109 = self.str108 + '+'
self.str254 = self.str108 + self.str108 + '0123456789001234567890012345678901234567'
self.str255 = self.str254 + '='
self.str510 = self.str255 + self.str255
tdSql.error('alter dnode 1 "activeCode" "a"')
tdSql.error('alter dnode 1 "activeCode" "' + self.str107 + '"')
tdSql.execute('alter all dnodes "activeCode" "' + self.str108 + '"')
tdSql.error('alter dnode 1 "activeCode" "' + self.str109 + '"')
tdSql.error('alter all dnodes "activeCode" "' + self.str510 + '"')
tdSql.query(f'select * from information_schema.ins_dnodes')
tdSql.checkEqual(tdSql.queryResult[0][8],self.str108)
tdSql.execute('alter dnode 1 "activeCode" ""')
tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes')
tdSql.checkEqual(tdSql.queryResult[0][0],"")
tdSql.checkEqual(tdSql.queryResult[0][1],'')
tdSql.error('alter dnode 1 "cActiveCode" "a"')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str107 + '"')
tdSql.execute('alter dnode 1 "cActiveCode" "' + self.str254 + '"')
tdSql.error('alter all dnodes "cActiveCode" "' + self.str255 + '"')
tdSql.error('alter dnode 1 "cActiveCode" "' + self.str510 + '"')
tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes')
tdSql.checkEqual(tdSql.queryResult[0][0],"")
tdSql.checkEqual(tdSql.queryResult[0][1],self.str254)
tdSql.execute('alter dnode 1 "cActiveCode" "' + self.str109 + '"')
tdSql.query(f'show dnodes')
tdSql.checkEqual(tdSql.queryResult[0][0],self.str109)
tdSql.execute('alter all dnodes "activeCode" ""')
tdSql.query(f'select c_active_code from information_schema.ins_dnodes')
tdSql.checkEqual(tdSql.queryResult[0][0],'')
def run(self): def run(self):
self.prepare_data() self.prepare_data()
...@@ -170,6 +211,7 @@ class TDTestCase: ...@@ -170,6 +211,7 @@ class TDTestCase:
self.ins_columns_check() self.ins_columns_check()
# self.ins_col_check_4096() # self.ins_col_check_4096()
self.ins_stable_check() self.ins_stable_check()
self.ins_dnodes_check()
def stop(self): def stop(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册