提交 ca102bdc 编写于 作者: wafwerar's avatar wafwerar

test: fix mnode leader follower order error

上级 4bf6eac5
...@@ -63,10 +63,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] ...@@ -63,10 +63,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
if $data(1)[2] != leader then $leaderNum = 0
goto step3 if $data(1)[2] == leader then
$leaderNum = 1
endi
if $data(2)[2] == leader then
$leaderNum = 1
endi endi
if $data(2)[2] != follower then if $leaderNum == 0 then
goto step3 goto step3
endi endi
if $data(3)[2] != offline then if $data(3)[2] != offline then
...@@ -97,10 +101,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] ...@@ -97,10 +101,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
if $data(1)[2] != leader then $leaderNum = 0
goto step4 if $data(1)[2] == leader then
$leaderNum = 1
endi
if $data(2)[2] == leader then
$leaderNum = 1
endi endi
if $data(2)[2] != follower then if $leaderNum == 0 then
goto step4 goto step4
endi endi
if $data(3)[2] != follower then if $data(3)[2] != follower then
...@@ -132,10 +140,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] ...@@ -132,10 +140,14 @@ print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
if $data(1)[2] != leader then $leaderNum = 0
goto step5 if $data(1)[2] == leader then
$leaderNum = 1
endi
if $data(2)[2] == leader then
$leaderNum = 1
endi endi
if $data(2)[2] != follower then if $leaderNum == 0 then
goto step5 goto step5
endi endi
if $data(3)[2] != offline then if $data(3)[2] != offline then
...@@ -169,10 +181,14 @@ print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] ...@@ -169,10 +181,14 @@ print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4]
if $rows != 2 then if $rows != 2 then
goto step6 goto step6
endi endi
if $data(1)[2] != leader then $leaderNum = 0
goto step6 if $data(1)[2] == leader then
$leaderNum = 1
endi
if $data(2)[2] == leader then
$leaderNum = 1
endi endi
if $data(2)[2] != follower then if $leaderNum == 0 then
goto step6 goto step6
endi endi
if $data(3)[2] != null then if $data(3)[2] != null then
......
...@@ -68,13 +68,17 @@ step31: ...@@ -68,13 +68,17 @@ step31:
return -1 return -1
endi endi
sql show mnodes sql show mnodes
if $data(1)[2] != leader then $leaderNum = 0
goto step31 if $data(1)[2] == leader then
$leaderNum = 1
endi endi
if $data(2)[2] != follower then if $data(2)[2] == leader then
goto step31 $leaderNum = 1
endi endi
if $data(3)[2] != follower then if $data(3)[2] == leader then
$leaderNum = 1
endi
if $leaderNum == 0 then
goto step31 goto step31
endi endi
...@@ -302,10 +306,10 @@ print ===> $data00 $data01 $data02 $data03 $data04 $data05 ...@@ -302,10 +306,10 @@ print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25 print ===> $data20 $data21 $data22 $data23 $data24 $data25
$leaderNum = 0 $leaderNum = 0
if $data(2)[2] == leader then if $data(1)[2] == leader then
$leaderNum = 1 $leaderNum = 1
endi endi
if $data(3)[2] == leader then if $data(2)[2] == leader then
$leaderNum = 1 $leaderNum = 1
endi endi
if $data(3)[2] == leader then if $data(3)[2] == leader then
......
echo '2020-1-1 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' > C:\\Windows\\Temp\\data.sql
echo '2020-1-2 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' >> C:\\Windows\\Temp\\data.sql
echo '2020-1-3 1:1:1','abc','device',123,'9876', 'abc', 'net', 'mno', 'province', 'city', 'al' >> C:\\Windows\\Temp\\data.sql
...@@ -7,8 +7,11 @@ sql drop database if exists indb ...@@ -7,8 +7,11 @@ sql drop database if exists indb
sql create database if not exists indb sql create database if not exists indb
sql use indb sql use indb
$inFileName = '/tmp/data.csv' $inFileName = '/tmp/data.sql'
$numOfRows = 10000 system_content printf %OS%
if $system_content == Windows_NT then
$inFileName = 'C:\\Windows\\Temp\\data.sql'
endi
system tsim/parser/gendata.sh system tsim/parser/gendata.sh
sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) tags(a int, b binary(12)); sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) tags(a int, b binary(12));
...@@ -16,8 +19,8 @@ sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16 ...@@ -16,8 +19,8 @@ sql create table stbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16
sql create table tbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2)) sql create table tbx (ts TIMESTAMP, collect_area NCHAR(12), device_id BINARY(16), imsi BINARY(16), imei BINARY(16), mdn BINARY(10), net_type BINARY(4), mno NCHAR(4), province NCHAR(10), city NCHAR(16), alarm BINARY(2))
print ====== create tables success, starting insert data print ====== create tables success, starting insert data
sql insert into tbx file '/tmp/data.sql' sql insert into tbx file $inFileName
sql import into tbx file '/tmp/data.sql' sql import into tbx file $inFileName
sql select count(*) from tbx sql select count(*) from tbx
if $rows != 1 then if $rows != 1 then
...@@ -31,8 +34,8 @@ endi ...@@ -31,8 +34,8 @@ endi
sql drop table tbx; sql drop table tbx;
sql insert into tbx using stbx tags(1,'abc') file '/tmp/data.sql'; sql insert into tbx using stbx tags(1,'abc') file $inFileName ;
sql insert into tbx using stbx tags(1,'abc') file '/tmp/data.sql'; sql insert into tbx using stbx tags(1,'abc') file $inFileName ;
sql select count(*) from tbx sql select count(*) from tbx
if $rows != 1 then if $rows != 1 then
...@@ -44,7 +47,7 @@ if $data00 != 3 then ...@@ -44,7 +47,7 @@ if $data00 != 3 then
endi endi
sql drop table tbx; sql drop table tbx;
sql insert into tbx using stbx(b) tags('abcf') file '/tmp/data.sql'; sql insert into tbx using stbx(b) tags('abcf') file $inFileName ;
sql select ts,a,b from tbx; sql select ts,a,b from tbx;
if $rows != 3 then if $rows != 3 then
...@@ -64,6 +67,6 @@ if $data02 != @abcf@ then ...@@ -64,6 +67,6 @@ if $data02 != @abcf@ then
return -1 return -1
endi endi
system rm -f /tmp/data.sql system rm -f $inFileName
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -91,4 +91,5 @@ goto :eof ...@@ -91,4 +91,5 @@ goto :eof
:CheckSkipCase :CheckSkipCase
set skipCase=false set skipCase=false
if "%*" == "python3 ./test.py -f 1-insert/insertWithMoreVgroup.py" ( set skipCase=true ) if "%*" == "python3 ./test.py -f 1-insert/insertWithMoreVgroup.py" ( set skipCase=true )
echo %* | grep "\-R" && set skipCase=true
:goto eof :goto eof
\ No newline at end of file
...@@ -328,7 +328,7 @@ if __name__ == "__main__": ...@@ -328,7 +328,7 @@ if __name__ == "__main__":
conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) conn = taos.connect(host,config=tdDnodes.getSimCfgPath())
else: else:
conn = taosrest.connect(url=f"http://{host}:6041") conn = taosrest.connect(url=f"http://{host}:6041")
tdLog.info(tdDnodes.getSimCfgPath(),host) # tdLog.info(tdDnodes.getSimCfgPath(),host)
if createDnodeNums == 1: if createDnodeNums == 1:
createDnodeNums=dnodeNums createDnodeNums=dnodeNums
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册