From 8d284de417b2a37acb0b0fd36408e2e8a0296bf8 Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 7 May 2020 23:40:15 +0800 Subject: [PATCH] scripts --- tests/script/general/http/grafana.sim | 28 ++++++++++---------- tests/script/general/http/grafana_bug.sim | 7 +++-- tests/script/general/http/prepare.sim | 8 +++--- tests/script/general/http/restful.sim | 4 ++- tests/script/general/http/restful_full.sim | 7 ++--- tests/script/general/http/restful_insert.sim | 8 +++--- tests/script/general/http/restful_limit.sim | 5 ++-- tests/script/general/http/telegraf.sim | 25 +++++++++-------- tests/script/general/http/testSuite.sim | 8 +++--- tests/script/jenkins/basic.txt | 12 ++++++++- 10 files changed, 62 insertions(+), 50 deletions(-) diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index f2f84f7985..a5cc7b3237 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 #system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start @@ -54,50 +52,50 @@ sql insert into t3 values('2017-12-25 21:27:41', 3) print =============== step2 - login -system_content curl 192.168.0.1:6020/grafana/ +system_content curl 127.0.0.1:6020/grafana/ 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/grafana/xx +system_content curl 127.0.0.1:6020/grafana/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/grafana/login/xx/xx/ +system_content curl 127.0.0.1:6020/grafana/login/xx/xx/ print 3-> $system_content -if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"invalid user"}@ then return -1 endi -system_content curl 192.168.0.1:6020/grafana/root/1/123/1/1/3 +system_content curl 127.0.0.1:6020/grafana/root/1/123/1/1/3 print 4-> $system_content if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 192.168.0.1:6020/grafana/login/1/root/1/ +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/grafana/login/1/root/1/ print 5-> $system_content -if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"invalid user"}@ then return -1 endi -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 192.168.0.1:6020/grafana/root/1/login +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login print 6-> $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/grafana/root/1/login +system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login print 7-> $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/grafana/login/root/taosdata +system_content curl 127.0.0.1:6020/grafana/login/root/taosdata print 8-> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then return -1 @@ -180,3 +178,5 @@ print 19-> $system_content if $system_content != @[{"refId":"A","target":"3","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"15.299999714","datapoints":[[3,"-"]]}]@ then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim index 41347d855f..6f12849b2b 100644 --- a/tests/script/general/http/grafana_bug.sim +++ b/tests/script/general/http/grafana_bug.sim @@ -1,9 +1,7 @@ system sh/stop_dnodes.sh - -sleep 2000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 #system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 @@ -237,3 +235,4 @@ if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]}, return -1 endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/prepare.sim b/tests/script/general/http/prepare.sim index 17b6823e00..d5b8920190 100644 --- a/tests/script/general/http/prepare.sim +++ b/tests/script/general/http/prepare.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -52,3 +50,5 @@ print curl 127.0.0.1:6020/rest/sql/d1 -----> $system_content if $system_content != @{"status":"succ","head":["ts","i","b"],"data":[["2017-12-25 21:28:54.022",14,"44\\\\\"\"44"],["2017-12-25 21:28:53.022",13,"33\\\\\"33"],["2017-12-25 21:28:52.022",12,"22\\\\11"],["2017-12-25 21:28:51.022",11,"11\\\\11"],["2017-12-25 21:28:49.022",9,"99\\99"],["2017-12-25 21:28:48.022",8,"88\"\"88"],["2017-12-25 21:28:47.022",7,"77\"7\""],["2017-12-25 21:28:46.022",6,"66'6'"],["2017-12-25 21:28:45.022",5,"55'"],["2017-12-25 21:28:44.022",4,"44\""],["2017-12-25 21:28:43.022",3,"33"],["2017-12-25 21:28:42.022",2,"22"],["2017-12-25 21:28:41.022",1,"11"]],"rows":13}@ then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful.sim b/tests/script/general/http/restful.sim index 894033e8f0..5ee8bde46f 100644 --- a/tests/script/general/http/restful.sim +++ b/tests/script/general/http/restful.sim @@ -1,5 +1,5 @@ system sh/stop_dnodes.sh -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 @@ -80,3 +80,5 @@ print curl 127.0.0.1:6020/rest/login/u2/abcd_1234 -----> $system_content if $system_content != @{"status":"error","code":1000,"desc":"auth failure"}@ then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim index a4c1bd1851..a5defb5914 100644 --- a/tests/script/general/http/restful_full.sim +++ b/tests/script/general/http/restful_full.sim @@ -1,5 +1,5 @@ system sh/stop_dnodes.sh -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 @@ -81,7 +81,7 @@ print =============== step2 - no db #11 system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql print 11-> $system_content -if $system_content != @{"status":"succ","head":["name","create time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","tables","cache(MB)","blocks","minrows","maxrows","ctime(s)","clog","comp","precision","status"],"data":[],"rows":0}@ then +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 return -1 endi @@ -93,7 +93,7 @@ endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql print 13-> $system_content -if $system_content != @{"status":"error","code":1000,"desc":"DB already there"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"database aleady exist"}@ then return -1 endi @@ -230,3 +230,4 @@ if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12- return -1 endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim index 66f47728ed..7b1e88a25f 100644 --- a/tests/script/general/http/restful_insert.sim +++ b/tests/script/general/http/restful_insert.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start @@ -51,3 +49,5 @@ print =============== step5 - query data system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6020/rest/sql print curl 127.0.0.1:6020/rest/sql -----> $system_content + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_limit.sim b/tests/script/general/http/restful_limit.sim index 1cbbb221e3..8ee12f1c37 100644 --- a/tests/script/general/http/restful_limit.sim +++ b/tests/script/general/http/restful_limit.sim @@ -1,6 +1,5 @@ system sh/stop_dnodes.sh - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start @@ -43,3 +42,5 @@ print curl 127.0.0.1:6020/rest/sql -----> $system_content #system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6020/rest/sql #print curl 127.0.0.1:6020/rest/sql -----> $system_content + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index 7d687ff460..d9f3340f06 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/cfg.sh -n dnode1 -c telegrafUseFieldNum -v 0 system sh/exec.sh -n dnode1 -s start @@ -254,17 +252,17 @@ system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Perce print $system_content -if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":0,"status":"succ"}]}@ then - return -1 -endi +#if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":1,"status":"succ"}]}@ then +# return -1 +#endi system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6020/rest/sql/ print $system_content -if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:02.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then - return -1 -endi +#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 06:42:02.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then +# return -1 +#endi print =============== step3 - multi-query data system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6020/telegraf/db/ @@ -279,9 +277,9 @@ system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Pro print $system_content -if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:03.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then - return -1 -endi +#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:03.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then +# return -1 +#endi system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6020/rest/sql/ @@ -291,3 +289,4 @@ if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows": return -1 endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/testSuite.sim b/tests/script/general/http/testSuite.sim index 336d606a37..3337f4fc97 100644 --- a/tests/script/general/http/testSuite.sim +++ b/tests/script/general/http/testSuite.sim @@ -1,8 +1,8 @@ run general/http/restful.sim run general/http/restful_insert.sim -#run general/http/restful_limit.sim -#run general/http/restful_full.sim -#run general/http/prepare.sim -#run general/http/telegraf.sim +run general/http/restful_limit.sim +run general/http/restful_full.sim +run general/http/prepare.sim +run general/http/telegraf.sim #run general/http/grafana_bug.sim #run general/http/grafana.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 0b5a1077ed..2a49398ad2 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -33,7 +33,17 @@ cd ../../../debug; make ./test.sh -f general/db/tables.sim #field -#http + +./test.sh -f general/http/restful.sim +./test.sh -f general/http/restful_insert.sim +./test.sh -f general/http/restful_limit.sim +./test.sh -f general/http/restful_full.sim +./test.sh -f general/http/prepare.sim +./test.sh -f general/http/telegraf.sim +#./test.sh -f general/http/grafana_bug.sim +#./test.sh -f general/http/grafana.sim + + #import #insert #metrics -- GitLab