admin.sim 9.8 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3
system sh/deploy.sh -n dnode1 -i 1
S
scripts  
slguan 已提交
4
system sh/cfg.sh -n dnode1 -c http -v 1
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c wallevel -v 0
S
slguan 已提交
6 7
#system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10
system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135
S
Shengliang Guan 已提交
8
system sh/exec.sh -n dnode1 -s start
S
slguan 已提交
9 10

sql connect
H
Haojun Liao 已提交
11
sleep 2000
S
slguan 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

print ============================ dnode1 start

print ===============  step0 - prepare data
sql create database d1
sql use d1

sql create table table_admin (ts timestamp, i int)

sql insert into table_admin values('2017-12-25 21:28:41.022', 1)
sql insert into table_admin values('2017-12-25 21:28:42.022', 2)
sql insert into table_admin values('2017-12-25 21:28:43.022', 3)
sql insert into table_admin values('2017-12-25 21:28:44.022', 4)
sql insert into table_admin values('2017-12-25 21:28:45.022', 5)
sql insert into table_admin values('2017-12-25 21:28:46.022', 6)
sql insert into table_admin values('2017-12-25 21:28:47.022', 7)
sql insert into table_admin values('2017-12-25 21:28:48.022', 8)
sql insert into table_admin values('2017-12-25 21:28:49.022', 9)
sql insert into table_admin values('2017-12-25 21:28:50.022', 10)

print ===============  step1 - login

34
system_content curl 127.0.0.1:7111/admin/
S
slguan 已提交
35
print 1-> $system_content
R
TD-1311  
root 已提交
36
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
H
Haojun Liao 已提交
37
  print actual: $system_content
S
slguan 已提交
38 39 40
  return -1
endi

41
system_content curl 127.0.0.1:7111/admin/xx
S
slguan 已提交
42
print 2-> $system_content
R
TD-1311  
root 已提交
43
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
44 45 46
  return -1
endi

47
system_content curl 127.0.0.1:7111/admin/login
S
slguan 已提交
48
print 3-> $system_content
R
TD-1311  
root 已提交
49
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
50 51 52
  return -1
endi

53
system_content curl 127.0.0.1:7111/admin/login/root
S
slguan 已提交
54
print 4-> $system_content
R
TD-1311  
root 已提交
55
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
56 57 58
  return -1
endi

59
system_content curl 127.0.0.1:7111/admin/login/root/123
S
slguan 已提交
60
print 5-> $system_content
61
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
S
slguan 已提交
62 63 64
  return -1
endi

65
system_content curl 127.0.0.1:7111/admin/login/root/123/1/1/3
S
slguan 已提交
66
print 6-> $system_content
67
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
S
slguan 已提交
68 69 70
  return -1
endi

71
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.'  -d 'show databases' 127.0.0.1:7111/admin/login/root/1
S
slguan 已提交
72
print 7-> $system_content
S
TD-1207  
Shengliang Guan 已提交
73
if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then
S
slguan 已提交
74 75 76
  return -1
endi

77
system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:7111/admin/login/root/1
S
slguan 已提交
78
print 8-> $system_content
S
TD-1207  
Shengliang Guan 已提交
79
if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then
S
slguan 已提交
80 81 82
  return -1
endi

H
Haojun Liao 已提交
83
sleep 2000
84
system_content curl 127.0.0.1:7111/admin/login/root/taosdata
S
slguan 已提交
85 86 87 88 89 90
print 9 -----> $system_content

if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then
  return -1
endi

91
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 127.0.0.1:7111/admin/login/root/1
S
slguan 已提交
92 93 94 95 96 97 98
#print 10-> $system_content
#if $system_content != @{"status":"error","code":29,"desc":"failed to connect to server"}@ then
#  return -1
#endi

print ===============  step2 - logout

99
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'   127.0.0.1:7111/admin/logout
S
slguan 已提交
100 101 102 103 104 105
print 10 -----> $system_content

if $system_content != @{"status":"succ","code":0,"desc":"logout success"}@ then
  return -1
endi

106
system_content curl  127.0.0.1:7111/admin/logout
S
slguan 已提交
107 108
print 11 -----> $system_content

R
TD-1311  
root 已提交
109
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
110 111 112 113 114
  return -1
endi

print ===============  step3 - info

115 116
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  127.0.0.1:7111/admin/info
print curl 127.0.0.1:7111/admin/info -----> $system_content
S
slguan 已提交
117 118 119 120 121 122
if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then
  return -1
endi

print ===============  step4 - meta

123 124
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show mnodes' 127.0.0.1:7111/admin/meta
print curl 127.0.0.1:7111/admin/meta -----> $system_content
S
scripts  
slguan 已提交
125 126 127
#if $system_content != @{"status":"succ","head":["column type","column name","column bytes"],"data":[["binary","IP",16],["timestamp","created time",8],["binary","status",10],["binary","role",10],["binary","public ip",16]],"rows":5}@ then
#  return -1
#endi
S
slguan 已提交
128 129 130

print ===============  step5 - query data

131 132
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:7111/admin/sql
print curl 127.0.0.1:7111/admin/all -----> $system_content
S
slguan 已提交
133 134 135 136
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
  return -1
endi

137 138
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:7111/admin/sql
print curl 127.0.0.1:7111/admin/sql -----> $system_content
S
slguan 已提交
139 140 141 142 143
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
  return -1
endi

print ===============  step6 - insert data
144 145
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_admin values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/admin/sql
print curl 127.0.0.1:7111/admin/sql -----> $system_content
S
slguan 已提交
146 147 148 149
if $system_content != @{"status":"succ","head":["affect_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

150 151
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:7111/admin/all
print curl 127.0.0.1:7111/admin/all -----> $system_content
S
slguan 已提交
152
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
H
Haojun Liao 已提交
153 154
  print actual: $system_content
  print expect =======> {"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}
S
slguan 已提交
155 156 157
  return -1
endi

158 159
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:7111/admin/sql
#print curl 127.0.0.1:7111/admin/sql -----> $system_content
S
slguan 已提交
160 161 162 163
#if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:51.022",11],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:42.022",2]],"rows":10}@ then
#  return -1
#endi

164 165
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:7111/admin/info
print curl 127.0.0.1:7111/admin/info -----> $system_content
S
slguan 已提交
166 167 168 169 170 171
if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then
  return -1
endi

print ===============  step7 - use dbs

172
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:7111/admin/all
S
slguan 已提交
173
print 23-> $system_content
R
TD-1311  
root 已提交
174
if $system_content != @{"status":"error","code":4360,"desc":"no need to execute use db cmd"}@ then
S
slguan 已提交
175 176 177 178
  return -1
endi

print ===============  step8 - monitor dbs
179
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes;show mnodes;' 127.0.0.1:7111/admin/sqls
S
slguan 已提交
180
#print 24-> $system_content
S
scripts  
slguan 已提交
181
#if $system_content != @[{"status":"succ","head":["IP","created time","open vnodes","free vnodes","status","balance state"],"data":[["127.0.0.1","2018-09-04 #11:16:13.985",1,3,"ready","balanced"]],"rows":1},{"status":"succ","head":["IP","created time","status","role"],"data":[["127.0.0.1","2018-09-04 11:16:13.371","serving","master"]],"rows":1}]@ then
S
slguan 已提交
182
#  return -1
S
scripts  
slguan 已提交
183 184
#	endi

S
Shengliang Guan 已提交
185 186 187 188 189 190 191 192
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
system sh/exec.sh -n dnode3 -s stop  -x SIGINT
system sh/exec.sh -n dnode4 -s stop  -x SIGINT
system sh/exec.sh -n dnode5 -s stop  -x SIGINT
system sh/exec.sh -n dnode6 -s stop  -x SIGINT
system sh/exec.sh -n dnode7 -s stop  -x SIGINT
system sh/exec.sh -n dnode8 -s stop  -x SIGINT