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

3
#sleep 5000
S
slguan 已提交
4 5 6 7 8 9

system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c clog -v 0
system sh/exec.sh -n dnode1 -s start

10
#sleep 3000
S
slguan 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
sql connect

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

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

system_content curl 192.168.0.1:6020/rest/
print 1-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/rest/xx
print 2-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/rest/login
print 3-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

#4
system_content curl 192.168.0.1:6020/rest/login/root
print 4-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

system_content curl 192.168.0.1:6020/rest/login/root/123
print 5-> $system_content
44
if $system_content != @{"status":"error","code":1000,"desc":"auth failure"}@ then
S
slguan 已提交
45 46 47 48 49
  return -1
endi

system_content curl 192.168.0.1:6020/rest/login/root/123/1/1/3
print 6-> $system_content
50
if $system_content != @{"status":"error","code":1000,"desc":"auth failure"}@ then
S
slguan 已提交
51 52 53 54 55
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 192.168.0.1:6020/rest/login/root/1
print 7-> $system_content
56
if $system_content != @{"status":"error","code":1000,"desc":"auth failure"}@ then
S
slguan 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
  return -1
endi

#8
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 192.168.0.1:6020/rest/login/root/1
print 8-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 192.168.0.1:6020/rest/login/root/1
print 9-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

sleep 3000

system_content curl 192.168.0.1:6020/rest/login/root/taosdata/
print 10-> $system_content
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
  return -1
endi

print ===============  step2 - no db

#11
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 192.168.0.1:6020/rest/sql
print 11-> $system_content
if $system_content != @{"status":"succ","head":["name","created time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","tables","rows","cache(b)","ablocks","tblocks","ctime(s)","clog","comp","time precision","status"],"data":[],"rows":0}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 192.168.0.1:6020/rest/sql
print 12-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 192.168.0.1:6020/rest/sql
print 13-> $system_content
if $system_content != @{"status":"error","code":33,"desc":"DB already there"}@ then
  return -1
endi

#14
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '' 192.168.0.1:6020/rest/sql
print 14-> $system_content
if $system_content != @{"status":"error","code":1012,"desc":"no sql input"}@ then
  return -1
endi

#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'use d1' 192.168.0.1:6020/rest/sql
#print 15-> $system_content
#if $system_content != @{"status":"error","code":1017,"desc":"no need to execute use db cmd"}@ then
#if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
#  return -1
#endi

#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  use d1' 192.168.0.1:6020/rest/sql
#print 16-> $system_content
#if $system_content != @{"status":"error","code":1017,"desc":"no need to execute use db cmd"}@ then
#  return -1
#endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  used1' 192.168.0.1:6020/rest/sql
print 17-> $system_content
if $system_content != @{"status":"error","code":28,"desc":"invalid SQL: invalid SQL: syntax error near 'used1'"}@ then
  return -1
endi

#18
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 192.168.0.1:6020/rest/sql
print 18-> $system_content
if $system_content != @{"status":"error","code":38,"desc":"DB not selected"}@ then
  return -1
endi

print ===============  step3 - db

#19
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 192.168.0.1:6020/rest/sql/d4
#print 19-> $system_content
#if $system_content != @{"status":"error","code":102,"desc":"invalid DB"}@ then
#  return -1
#endi

#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 192.168.0.1:6020/rest/sql/d1
#print 20-> $system_content
#if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then
#  return -1
#endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1;' 192.168.0.1:6020/rest/sql
print 21-> $system_content
if $system_content != @{"status":"error","code":32,"desc":"invalid table"}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d1.t1 (ts timestamp, speed int)' 192.168.0.1:6020/rest/sql
print 22-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 192.168.0.1:6020/rest/sql
print 23-> $system_content
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[],"rows":0}@ then
  return -1
endi

#24
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 192.168.0.1:6020/rest/sql
print 24-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 192.168.0.1:6020/rest/sql
print 25-> $system_content
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
  return -1
endi

#26
print 25-> no print
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 192.168.0.1:6020/rest/sql

system_content  curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 192.168.0.1:6020/rest/sql

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 192.168.0.1:6020/rest/sql

#27
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 192.168.0.1:6020/rest/sql
print 27-> $system_content
if $system_content != @{"status":"succ","head":["ts","speed"],"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
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d2' 192.168.0.1:6020/rest/sql
print 28-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d2.t1 (ts timestamp, speed int)' 192.168.0.1:6020/rest/sql
print 29-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

#30
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 192.168.0.1:6020/rest/sql
print 30-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d2.t1 ' 192.168.0.1:6020/rest/sql
print 31-> $system_content
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
  return -1
endi