restful_full.sim 11.3 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
scripts  
slguan 已提交
2
sleep 3000
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

8
#sleep 3000
S
slguan 已提交
9 10 11 12 13 14
sql connect

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

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

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

S
scripts  
slguan 已提交
21
system_content curl 127.0.0.1:6020/rest/xx
S
slguan 已提交
22 23 24 25 26
print 2-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

S
scripts  
slguan 已提交
27
system_content curl 127.0.0.1:6020/rest/login
S
slguan 已提交
28 29 30 31 32 33
print 3-> $system_content
if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then
  return -1
endi

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

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

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

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

#8
S
scripts  
slguan 已提交
59
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:6020/rest/login/root/1
S
slguan 已提交
60 61 62 63 64
print 8-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

S
scripts  
slguan 已提交
65
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi'  -d 'show databases' 127.0.0.1:6020/rest/login/root/1
S
slguan 已提交
66 67 68 69 70 71 72
print 9-> $system_content
if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then
  return -1
endi

sleep 3000

S
scripts  
slguan 已提交
73
system_content curl 127.0.0.1:6020/rest/login/root/taosdata/
S
slguan 已提交
74 75 76 77 78 79 80 81
print 10-> $system_content
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
  return -1
endi

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

#11
S
scripts  
slguan 已提交
82
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'show databases' 127.0.0.1:6020/rest/sql
S
slguan 已提交
83
print 11-> $system_content
S
scripts  
slguan 已提交
84
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","maxtables","cache(MB)","blocks","minrows","maxrows","ctime(Sec.)","wallevel","comp","precision","status"],"data":[],"rows":0}@ then
S
slguan 已提交
85 86 87
  return -1
endi

S
scripts  
slguan 已提交
88
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 127.0.0.1:6020/rest/sql
S
slguan 已提交
89
print 12-> $system_content
S
[TD-19]  
slguan 已提交
90
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
S
slguan 已提交
91 92 93
  return -1
endi

S
scripts  
slguan 已提交
94
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d1' 127.0.0.1:6020/rest/sql
S
slguan 已提交
95
print 13-> $system_content
S
scripts  
slguan 已提交
96
if $system_content != @{"status":"error","code":1000,"desc":"database aleady exist"}@ then
S
slguan 已提交
97 98 99 100
  return -1
endi

#14
S
scripts  
slguan 已提交
101
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '' 127.0.0.1:6020/rest/sql
S
slguan 已提交
102 103 104 105 106
print 14-> $system_content
if $system_content != @{"status":"error","code":1012,"desc":"no sql input"}@ then
  return -1
endi

S
scripts  
slguan 已提交
107
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'use d1' 127.0.0.1:6020/rest/sql
S
slguan 已提交
108 109 110 111 112 113
#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

S
scripts  
slguan 已提交
114
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  use d1' 127.0.0.1:6020/rest/sql
S
slguan 已提交
115 116 117 118 119
#print 16-> $system_content
#if $system_content != @{"status":"error","code":1017,"desc":"no need to execute use db cmd"}@ then
#  return -1
#endi

S
scripts  
slguan 已提交
120
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d '  used1' 127.0.0.1:6020/rest/sql
S
slguan 已提交
121
print 17-> $system_content
S
[TD-19]  
slguan 已提交
122
if $system_content != @{"status":"error","code":1000,"desc":"invalid SQL: invalid SQL: syntax error near 'used1'"}@ then
S
slguan 已提交
123 124 125 126
  return -1
endi

#18
S
scripts  
slguan 已提交
127
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:6020/rest/sql
S
slguan 已提交
128
print 18-> $system_content
S
[TD-19]  
slguan 已提交
129
if $system_content != @{"status":"error","code":1000,"desc":"db not selected"}@ then
S
slguan 已提交
130 131 132 133 134 135
  return -1
endi

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

#19
S
scripts  
slguan 已提交
136
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:6020/rest/sql/d4
S
slguan 已提交
137
#print 19-> $system_content
S
[TD-19]  
slguan 已提交
138
#if $system_content != @{"status":"error","code":1000,"desc":"invalid DB"}@ then
S
slguan 已提交
139 140 141
#  return -1
#endi

S
scripts  
slguan 已提交
142
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' show tables;' 127.0.0.1:6020/rest/sql/d1
S
slguan 已提交
143 144 145 146 147
#print 20-> $system_content
#if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then
#  return -1
#endi

S
scripts  
slguan 已提交
148
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1;' 127.0.0.1:6020/rest/sql
S
slguan 已提交
149
print 21-> $system_content
S
Shengliang Guan 已提交
150
if $system_content != @{"status":"error","code":1000,"desc":"invalid table id"}@ then
S
slguan 已提交
151 152 153
  return -1
endi

S
scripts  
slguan 已提交
154
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql
S
slguan 已提交
155
print 22-> $system_content
S
[TD-19]  
slguan 已提交
156
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
S
slguan 已提交
157 158 159
  return -1
endi

S
scripts  
slguan 已提交
160
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
S
slguan 已提交
161 162 163 164 165 166
print 23-> $system_content
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[],"rows":0}@ then
  return -1
endi

#24
S
scripts  
slguan 已提交
167
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:6020/rest/sql
S
slguan 已提交
168 169 170 171 172
print 24-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

S
scripts  
slguan 已提交
173
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
S
slguan 已提交
174 175 176 177 178 179 180
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
S
scripts  
slguan 已提交
181
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:6020/rest/sql
S
slguan 已提交
182

S
scripts  
slguan 已提交
183
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:6020/rest/sql
S
slguan 已提交
184

S
scripts  
slguan 已提交
185
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:6020/rest/sql
S
slguan 已提交
186

S
scripts  
slguan 已提交
187
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:6020/rest/sql
S
slguan 已提交
188

S
scripts  
slguan 已提交
189
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:6020/rest/sql
S
slguan 已提交
190

S
scripts  
slguan 已提交
191
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:6020/rest/sql
S
slguan 已提交
192

S
scripts  
slguan 已提交
193
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:6020/rest/sql
S
slguan 已提交
194

S
scripts  
slguan 已提交
195
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:6020/rest/sql
S
slguan 已提交
196

S
scripts  
slguan 已提交
197
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:6020/rest/sql
S
slguan 已提交
198

S
scripts  
slguan 已提交
199
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:6020/rest/sql
S
slguan 已提交
200 201

#27
S
scripts  
slguan 已提交
202
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
S
slguan 已提交
203 204 205 206 207
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

S
scripts  
slguan 已提交
208
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d 'create database d2' 127.0.0.1:6020/rest/sql
S
slguan 已提交
209
print 28-> $system_content
S
[TD-19]  
slguan 已提交
210
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
S
slguan 已提交
211 212 213
  return -1
endi

S
scripts  
slguan 已提交
214
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql
S
slguan 已提交
215
print 29-> $system_content
S
[TD-19]  
slguan 已提交
216
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
S
slguan 已提交
217 218 219 220
  return -1
endi

#30
S
scripts  
slguan 已提交
221
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:6020/rest/sql
S
slguan 已提交
222 223 224 225 226
print 30-> $system_content
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
  return -1
endi

S
scripts  
slguan 已提交
227
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04'  -d ' select * from d2.t1 ' 127.0.0.1:6020/rest/sql
S
slguan 已提交
228 229 230 231 232
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

S
scripts  
slguan 已提交
233
system sh/exec.sh -n dnode1 -s stop -x SIGINT