TDengine/tests/script/tsim/mnode/basic2.sim

138 lines
2.8 KiB
Text
Raw Normal View History

2022-05-24 07:05:01 +00:00
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect
2022-08-11 12:56:31 +00:00
print =============== select * from information_schema.ins_dnodes
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes;
2022-05-24 07:05:01 +00:00
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
2022-06-02 06:35:59 +00:00
if $data02 != leader then
2022-05-24 07:05:01 +00:00
return -1
endi
print =============== create dnodes
sql create dnode $hostname port 7200
2022-05-26 12:21:00 +00:00
$x = 0
step1:
$x = $x + 1
sleep 500
if $x == 20 then
return -1
endi
2022-08-11 12:56:31 +00:00
sql select * from information_schema.ins_dnodes -x step1
2022-05-26 12:21:00 +00:00
if $data(1)[4] != ready then
goto step1
2022-05-24 07:05:01 +00:00
endi
2022-05-26 12:21:00 +00:00
if $data(2)[4] != ready then
goto step1
2022-05-24 07:05:01 +00:00
endi
print =============== create mnode 2
sql create mnode on dnode 2
2022-05-26 12:21:00 +00:00
$x = 0
step2:
2022-05-26 12:21:00 +00:00
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
print $data(1)[0] $data(1)[1] $data(1)[2]
print $data(2)[0] $data(2)[1] $data(2)[2]
2022-05-24 07:05:01 +00:00
if $rows != 2 then
return -1
endi
if $data(1)[0] != 1 then
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(1)[2] != leader then
return -1
endi
if $data(2)[0] != 2 then
return -1
endi
2022-06-02 06:35:59 +00:00
if $data(2)[2] != follower then
goto step2
endi
print =============== create user
2024-12-10 11:08:58 +00:00
sql create user user1 PASS 'user1@#xy'
2022-08-11 12:56:31 +00:00
sql select * from information_schema.ins_users
if $rows != 2 then
return -1
endi
2022-05-26 12:21:00 +00:00
sql create database db
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-05-26 12:21:00 +00:00
if $rows != 3 then
return -1
endi
2022-05-26 08:47:37 +00:00
sleep 5000
2022-05-26 12:21:00 +00:00
print =============== restart
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sql connect
2022-08-11 13:21:59 +00:00
sql select * from information_schema.ins_mnodes
if $rows != 2 then
return -1
endi
2022-06-11 06:11:10 +00:00
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
2022-05-26 12:21:00 +00:00
2022-08-11 12:56:31 +00:00
sql select * from information_schema.ins_users
2022-05-26 12:21:00 +00:00
if $rows != 2 then
return -1
endi
2022-05-26 12:21:00 +00:00
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-05-26 12:21:00 +00:00
if $rows != 3 then
return -1
endi
$x = 0
step3:
$x = $x + 1
sleep 500
if $x == 20 then
return -1
endi
2022-08-11 12:56:31 +00:00
sql select * from information_schema.ins_dnodes -x step3
2022-06-11 06:11:10 +00:00
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
2022-05-26 12:21:00 +00:00
if $data(1)[4] != ready then
goto step3
2022-05-26 12:21:00 +00:00
endi
if $data(2)[4] != ready then
goto step3
endi
2022-05-26 12:21:00 +00:00
print =============== insert data
2022-05-26 14:50:46 +00:00
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, 102, "103")
sql insert into db.ctb values(now, 1, "2")
2022-05-27 07:21:23 +00:00
sql select * from db.ctb
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode2 -s stop