restful_full.sim 12.3 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
H
Haojun Liao 已提交
2
sleep 2000
S
slguan 已提交
3
system sh/deploy.sh -n dnode1 -i 1
S
scripts  
slguan 已提交
4
system sh/cfg.sh -n dnode1 -c wallevel -v 0
S
scripts  
slguan 已提交
5
system sh/cfg.sh -n dnode1 -c http -v 1
S
slguan 已提交
6 7
system sh/exec.sh -n dnode1 -s start

H
Haojun Liao 已提交
8
#sleep 2000
S
slguan 已提交
9 10 11 12 13 14
sql connect

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

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

15
system_content curl 127.0.0.1:7111/rest/
S
slguan 已提交
16
print 1-> $system_content
R
TD-1311  
root 已提交
17
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
18
  print $system_content
S
slguan 已提交
19 20 21
  return -1
endi

22
system_content curl 127.0.0.1:7111/rest/xx
S
slguan 已提交
23
print 2-> $system_content
R
TD-1311  
root 已提交
24
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
25 26 27
  return -1
endi

28
system_content curl 127.0.0.1:7111/rest/login
S
slguan 已提交
29
print 3-> $system_content
R
TD-1311  
root 已提交
30
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
S
slguan 已提交
31 32 33 34
  return -1
endi

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

41
system_content curl 127.0.0.1:7111/rest/login/root/123
S
slguan 已提交
42
print 5-> $system_content
43
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
S
slguan 已提交
44 45 46
  return -1
endi

47
system_content curl 127.0.0.1:7111/rest/login/root/123/1/1/3
S
slguan 已提交
48
print 6-> $system_content
49
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
S
slguan 已提交
50 51 52
  return -1
endi

53
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 127.0.0.1:7111/rest/login/root/1
S
slguan 已提交
54
print 7-> $system_content
55
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
S
slguan 已提交
56 57 58 59
  return -1
endi

#8
S
TD-1207  
Shengliang Guan 已提交
60
system_content curl -H 'Authorization: Beare eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'  -d 'show databases' 127.0.0.1:7111/rest/login/root/1
S
slguan 已提交
61
print 8-> $system_content
R
TD-1311  
root 已提交
62
if $system_content != @{"status":"error","code":4386,"desc":"invalid type of Authorization"}@ then
S
slguan 已提交
63 64 65
  return -1
endi

S
TD-1207  
Shengliang Guan 已提交
66 67 68 69 70 71
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:7111/rest/login/root/1
print 8-> $system_content
if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then
  return -1
endi

72
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:7111/rest/login/root/1
S
slguan 已提交
73
print 9-> $system_content
R
TD-1311  
root 已提交
74
if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then
S
slguan 已提交
75 76 77
  return -1
endi

H
Haojun Liao 已提交
78
sleep 2000
S
slguan 已提交
79

80
system_content curl 127.0.0.1:7111/rest/login/root/taosdata/
S
slguan 已提交
81 82 83 84 85 86 87 88
print 10-> $system_content
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
  return -1
endi

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

#11
89
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 127.0.0.1:7111/rest/sql
S
slguan 已提交
90
print 11-> $system_content
91
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[],"rows":0}@ then
S
slguan 已提交
92 93 94
  return -1
endi

95
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 127.0.0.1:7111/rest/sql
S
slguan 已提交
96
print 12-> $system_content
97
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
S
slguan 已提交
98 99 100
  return -1
endi

101
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 127.0.0.1:7111/rest/sql
S
slguan 已提交
102
print 13-> $system_content
103
if $system_content != @{"status":"error","code":897,"desc":"Database already exists"}@ then
S
slguan 已提交
104 105 106 107
  return -1
endi

#14
108
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '' 127.0.0.1:7111/rest/sql
S
slguan 已提交
109
print 14-> $system_content
R
TD-1311  
root 已提交
110
if $system_content != @{"status":"error","code":4359,"desc":"no sql input"}@ then
S
slguan 已提交
111 112 113
  return -1
endi

114
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'use d1' 127.0.0.1:7111/rest/sql
S
slguan 已提交
115
#print 15-> $system_content
S
Shengliang Guan 已提交
116
#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then
S
slguan 已提交
117 118 119 120
#if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
#  return -1
#endi

121
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  use d1' 127.0.0.1:7111/rest/sql
S
slguan 已提交
122
#print 16-> $system_content
S
Shengliang Guan 已提交
123
#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then
S
slguan 已提交
124 125 126
#  return -1
#endi

127
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  used1' 127.0.0.1:7111/rest/sql
S
slguan 已提交
128
print 17-> $system_content
S
scripts  
Shengliang Guan 已提交
129
if $system_content != @{"status":"error","code":534,"desc":"Syntax error in SQL"}@ then
S
slguan 已提交
130 131 132 133
  return -1
endi

#18
134
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:7111/rest/sql
S
slguan 已提交
135
print 18-> $system_content
136
if $system_content != @{"status":"error","code":896,"desc":"Database not specified or available"}@ then
S
slguan 已提交
137 138 139 140 141 142
  return -1
endi

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

#19
143
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:7111/rest/sql/d4
S
slguan 已提交
144
#print 19-> $system_content
S
[TD-19]  
slguan 已提交
145
#if $system_content != @{"status":"error","code":1000,"desc":"invalid DB"}@ then
S
slguan 已提交
146 147 148
#  return -1
#endi

149
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:7111/rest/sql/d1
S
slguan 已提交
150 151 152 153 154
#print 20-> $system_content
#if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then
#  return -1
#endi

155
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1;' 127.0.0.1:7111/rest/sql
S
slguan 已提交
156
print 21-> $system_content
157
if $system_content != @{"status":"error","code":866,"desc":"Table does not exist"}@ then
S
slguan 已提交
158 159 160
  return -1
endi

161
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
S
slguan 已提交
162
print 22-> $system_content
163
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
S
slguan 已提交
164 165 166
  return -1
endi

167
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
S
slguan 已提交
168
print 23-> $system_content
169
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[],"rows":0}@ then
S
slguan 已提交
170 171 172 173
  return -1
endi

#24
174
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
175
print 24-> $system_content
176
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then
S
slguan 已提交
177 178 179
  return -1
endi

180
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
S
slguan 已提交
181
print 25-> $system_content
182
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
S
slguan 已提交
183 184 185 186 187
  return -1
endi

#26
print 25-> no print
188
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
189

190
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
191

192
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
193

194
system_content  curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
195

196
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
197

198
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
199

200
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
201

202
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
203

204
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
205

206
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
207 208

#27
209
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:7111/rest/sql
S
slguan 已提交
210
print 27-> $system_content
211
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"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
S
slguan 已提交
212 213 214
  return -1
endi

215
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d2' 127.0.0.1:7111/rest/sql
S
slguan 已提交
216
print 28-> $system_content
217
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
S
slguan 已提交
218 219 220
  return -1
endi

221
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:7111/rest/sql
S
slguan 已提交
222
print 29-> $system_content
223
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[0]],"rows":1}@ then
S
slguan 已提交
224 225 226 227
  return -1
endi

#30
228
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:7111/rest/sql
S
slguan 已提交
229
print 30-> $system_content
230
if $system_content != @{"status":"succ","head":["affected_rows"],"column_meta":[["affected_rows",4,4]],"data":[[1]],"rows":1}@ then
S
slguan 已提交
231 232 233
  return -1
endi

234
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d2.t1 ' 127.0.0.1:7111/rest/sql
S
slguan 已提交
235
print 31-> $system_content
236
if $system_content != @{"status":"succ","head":["ts","speed"],"column_meta":[["ts",9,8],["speed",4,4]],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
S
slguan 已提交
237 238 239
  return -1
endi

Y
TD-934  
yihaoDeng 已提交
240
system sh/exec.sh -n dnode1 -s stop -x SIGINT