test(analytics): add tests for tdanalytics.
This commit is contained in:
parent
e5f617db79
commit
746cbc09c3
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#ifdef USE_ANALYTICS
|
#ifdef USE_ANALYTICS
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#define ANAL_ALGO_SPLIT ","
|
#define ANALYTICS_ALOG_SPLIT_CHAR ","
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t ver;
|
int64_t ver;
|
||||||
|
@ -136,7 +136,7 @@ bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pEnd = strstr(pStart, ANAL_ALGO_SPLIT);
|
pEnd = strstr(pStart, ANALYTICS_ALOG_SPLIT_CHAR);
|
||||||
if (optMaxLen > 0) {
|
if (optMaxLen > 0) {
|
||||||
if (pEnd > pStart) {
|
if (pEnd > pStart) {
|
||||||
int32_t len = (int32_t)(pEnd - pStart);
|
int32_t len = (int32_t)(pEnd - pStart);
|
||||||
|
@ -168,7 +168,7 @@ bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValu
|
||||||
int32_t bufLen = tsnprintf(buf, sizeof(buf), "%s=", optName);
|
int32_t bufLen = tsnprintf(buf, sizeof(buf), "%s=", optName);
|
||||||
|
|
||||||
char *pos1 = strstr(option, buf);
|
char *pos1 = strstr(option, buf);
|
||||||
char *pos2 = strstr(option, ANAL_ALGO_SPLIT);
|
char *pos2 = strstr(option, ANALYTICS_ALOG_SPLIT_CHAR);
|
||||||
if (pos1 != NULL) {
|
if (pos1 != NULL) {
|
||||||
*optValue = taosStr2Int64(pos1 + bufLen, NULL, 10);
|
*optValue = taosStr2Int64(pos1 + bufLen, NULL, 10);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -13,7 +13,7 @@ if [ -n "$PID" ]; then
|
||||||
systemctl stop taosd
|
systemctl stop taosd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
|
PID=`ps -ef|grep -w taosd | grep -v grep | grep -v taosanode | awk '{print $2}'`
|
||||||
while [ -n "$PID" ]; do
|
while [ -n "$PID" ]; do
|
||||||
echo kill -9 $PID
|
echo kill -9 $PID
|
||||||
#pkill -9 taosd
|
#pkill -9 taosd
|
||||||
|
@ -38,10 +38,10 @@ while [ -n "$PID" ]; do
|
||||||
else
|
else
|
||||||
lsof -nti:6030 | xargs kill -9
|
lsof -nti:6030 | xargs kill -9
|
||||||
fi
|
fi
|
||||||
PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'`
|
PID=`ps -ef|grep -w taos | grep -v grep |grep -v taosanode| awk '{print $2}'`
|
||||||
done
|
done
|
||||||
|
|
||||||
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
|
PID=`ps -ef|grep -w tmq_sim | grep -v grep | grep -v taosanode|awk '{print $2}'`
|
||||||
while [ -n "$PID" ]; do
|
while [ -n "$PID" ]; do
|
||||||
echo kill -9 $PID
|
echo kill -9 $PID
|
||||||
#pkill -9 tmq_sim
|
#pkill -9 tmq_sim
|
||||||
|
@ -52,5 +52,5 @@ while [ -n "$PID" ]; do
|
||||||
else
|
else
|
||||||
lsof -nti:6030 | xargs kill -9
|
lsof -nti:6030 | xargs kill -9
|
||||||
fi
|
fi
|
||||||
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
|
PID=`ps -ef|grep -w tmq_sim | grep -v grep | grep -v taosanode| awk '{print $2}'`
|
||||||
done
|
done
|
|
@ -3,7 +3,17 @@ system sh/deploy.sh -n dnode1 -i 1
|
||||||
system sh/exec.sh -n dnode1 -s start
|
system sh/exec.sh -n dnode1 -s start
|
||||||
sql connect
|
sql connect
|
||||||
|
|
||||||
print =============== create anode
|
print =============== failed to create anode on '127.0.0.1:1101'
|
||||||
|
sql_error create anode '127.0.0.1:1101'
|
||||||
|
|
||||||
|
sql show anodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql_error drop anode 1
|
||||||
|
|
||||||
|
print ================ create anode
|
||||||
sql create anode '192.168.1.116:6050'
|
sql create anode '192.168.1.116:6050'
|
||||||
|
|
||||||
sql show anodes
|
sql show anodes
|
||||||
|
@ -58,6 +68,61 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=0.5,wncheck=1,period=0') from ct1
|
||||||
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=119,wncheck=1,period=0') from ct1
|
||||||
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters1,conf=0.5,wncheck=1,period=0') from ct1
|
||||||
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, rows=0') from ct1
|
||||||
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, rows=-10') from ct1
|
||||||
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, every=0') from ct1
|
||||||
|
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters, conf=50 ') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, ' algo=holtwinters , conf=50 ') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, ' algo = holtwinters , conf = 50 ') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, ') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, ,') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, , ,') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, a =') from ct1
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, = a ,') from ct1
|
||||||
|
sql select forecast(c1, 'conf=50 ,algo = arima') from ct1
|
||||||
|
sql select forecast(c1, 'conf=50 ,algo = arima, rows=1') from ct1
|
||||||
|
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=50,wncheck=1,period=0,start=1700000000000,every=2') from ct1
|
||||||
|
if $rows != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data03 != 28 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != @23-11-15 06:13:20.000@ then
|
||||||
|
print expect 23-11-15 06:13:20.000 , actual $data00
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != @23-11-15 06:13:20.002@ then
|
||||||
|
print expect 23-11-15 06:13:20.002 , actual $data10
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data20 != @23-11-15 06:13:20.004@ then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print test the every option and rows option
|
||||||
|
|
||||||
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=50,wncheck=1,period=0,start=1700000000000,every=100,rows=5') from ct1
|
||||||
|
if $rows != 5 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != @23-11-15 06:13:20.000@ then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != @23-11-15 06:13:20.100@ then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
sql drop anode 1
|
sql drop anode 1
|
||||||
sql show anodes
|
sql show anodes
|
||||||
|
|
Loading…
Reference in New Issue