From 3af6d957ffc379049c294d95005c8473b4c628cf Mon Sep 17 00:00:00 2001 From: root Date: Mon, 14 Sep 2020 16:17:52 +0800 Subject: [PATCH] TD-1311 --- src/inc/taoserror.h | 6 +- src/plugins/http/inc/httpAuth.h | 6 +- src/plugins/http/inc/httpParser.h | 1 - src/plugins/http/src/httpAuth.c | 26 ++++----- src/plugins/http/src/httpParser.c | 30 +++++----- src/plugins/http/src/httpResp.c | 4 ++ src/plugins/http/src/httpServer.c | 10 +++- src/plugins/http/src/httpSql.c | 2 +- tests/script/general/http/grafana.sim | 10 ++-- tests/script/general/http/restful_full.sim | 14 ++--- tests/script/general/http/telegraf.sim | 64 +++++++++++----------- tests/script/sh/deploy.sh | 32 +++++------ tests/script/unique/http/admin.sim | 16 +++--- tests/script/unique/http/opentsdb.sim | 42 +++++++------- 14 files changed, 135 insertions(+), 128 deletions(-) diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index d8bd293dba..67e2d43c98 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -303,8 +303,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_NULL, 0, 0x1169, "timestamp TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_TYPE, 0, 0x116A, "timestamp type should be integer") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TIMESTAMP_VAL_NULL, 0, 0x116B, "timestamp value smaller than 0") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_NULL, 0, 0x116C, "tags not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_0, 0, 0x116D, "tags size too long") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_LONG, 0, 0x116E, "tags size is 0") +TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_0, 0, 0x116D, "tags size is 0") +TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAGS_SIZE_LONG, 0, 0x116E, "tags size too long") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NULL, 0, 0x116F, "tag is null") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NAME_NULL, 0, 0x1170, "tag name is null") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_TG_TAG_NAME_SIZE, 0, 0x1171, "tag name length too long") @@ -345,7 +345,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_TYPE, 0, 0x11A2, "tag value TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_NULL, 0, 0x11A3, "tag value is null") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_TOO_LONG, 0, 0x11A4, "tag value can not more than 64") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_NULL, 0, 0x11A5, "value not find") -TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_TYPE, 0, 0x11A5, "value type should be boolean, number or string") +TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_TYPE, 0, 0x11A6, "value type should be boolean, number or string") #ifdef TAOS_ERROR_C }; diff --git a/src/plugins/http/inc/httpAuth.h b/src/plugins/http/inc/httpAuth.h index 4becae6332..2ce9725d4b 100644 --- a/src/plugins/http/inc/httpAuth.h +++ b/src/plugins/http/inc/httpAuth.h @@ -16,8 +16,8 @@ #ifndef TDENGINE_HTTP_TOKEN_H #define TDENGINE_HTTP_TOKEN_H -bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len); -bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len); -bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen); +int32_t httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len); +int32_t httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len); +int32_t httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen); #endif \ No newline at end of file diff --git a/src/plugins/http/inc/httpParser.h b/src/plugins/http/inc/httpParser.h index 5694c8f0cd..7dd6d3e0fc 100644 --- a/src/plugins/http/inc/httpParser.h +++ b/src/plugins/http/inc/httpParser.h @@ -84,7 +84,6 @@ typedef struct HttpParser { HttpString path[HTTP_MAX_URL]; char * method; char * target; - char * target_raw; char * version; char * reasonPhrase; char * key; diff --git a/src/plugins/http/src/httpAuth.c b/src/plugins/http/src/httpAuth.c index 40bb691b5d..8beef7c042 100644 --- a/src/plugins/http/src/httpAuth.c +++ b/src/plugins/http/src/httpAuth.c @@ -23,28 +23,28 @@ #define KEY_DES_4 4971256377704625728L -bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len) { +int32_t httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len) { token[len] = '\0'; int32_t outlen = 0; char *base64 = (char *)base64_decode(token, len, &outlen); if (base64 == NULL || outlen == 0) { httpError("context:%p, fd:%d, basic token:%s parsed error", pContext, pContext->fd, token); free(base64); - return false; + return -1; } char *user = strstr(base64, ":"); if (user == NULL) { httpError("context:%p, fd:%d, basic token:%s invalid format", pContext, pContext->fd, token); free(base64); - return false; + return -1; } int32_t user_len = (int32_t)(user - base64); if (user_len < 1 || user_len >= TSDB_USER_LEN) { httpError("context:%p, fd:%d, basic token:%s parse user error", pContext, pContext->fd, token); free(base64); - return false; + return -1; } strncpy(pContext->user, base64, (size_t)user_len); pContext->user[user_len] = 0; @@ -54,36 +54,36 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len) { if (pass_len < 1 || pass_len >= TSDB_PASSWORD_LEN) { httpError("context:%p, fd:%d, basic token:%s parse password error", pContext, pContext->fd, token); free(base64); - return false; + return -1; } strncpy(pContext->pass, password, (size_t)pass_len); pContext->pass[pass_len] = 0; free(base64); httpDebug("context:%p, fd:%d, basic token parsed success, user:%s", pContext, pContext->fd, pContext->user); - return true; + return 0; } -bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len) { +int32_t httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len) { token[len] = '\0'; int32_t outlen = 0; unsigned char *base64 = base64_decode(token, len, &outlen); if (base64 == NULL || outlen == 0) { httpError("context:%p, fd:%d, taosd token:%s parsed error", pContext, pContext->fd, token); if (base64) free(base64); - return false; + return 01; } if (outlen != (TSDB_USER_LEN + TSDB_PASSWORD_LEN)) { httpError("context:%p, fd:%d, taosd token:%s length error", pContext, pContext->fd, token); free(base64); - return false; + return -1; } char *descrypt = taosDesDecode(KEY_DES_4, (char *)base64, outlen); if (descrypt == NULL) { httpError("context:%p, fd:%d, taosd token:%s descrypt error", pContext, pContext->fd, token); free(base64); - return false; + return -1; } else { tstrncpy(pContext->user, descrypt, sizeof(pContext->user)); tstrncpy(pContext->pass, descrypt + TSDB_USER_LEN, sizeof(pContext->pass)); @@ -92,11 +92,11 @@ bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len) { pContext->user); free(base64); free(descrypt); - return true; + return 0; } } -bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen) { +int32_t httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen) { char buffer[sizeof(pContext->user) + sizeof(pContext->pass)] = {0}; size_t size = sizeof(pContext->user); tstrncpy(buffer, pContext->user, size); @@ -113,5 +113,5 @@ bool httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen) { httpDebug("context:%p, fd:%d, generate taosd token:%s", pContext, pContext->fd, token); - return true; + return 0; } diff --git a/src/plugins/http/src/httpParser.c b/src/plugins/http/src/httpParser.c index d223b8f3a4..ec71bb2daf 100644 --- a/src/plugins/http/src/httpParser.c +++ b/src/plugins/http/src/httpParser.c @@ -112,7 +112,8 @@ static int32_t httpAppendString(HttpString *str, const char *s, int32_t len) { str->pos = 0; str->size = 32; str->str = malloc(str->size); - } else if (str->pos + len + 1 > str->size) { + } else if (str->pos + len + 1 >= str->size) { + str->size += len; str->size *= 10; str->str = realloc(str->str, str->size); } else { @@ -130,7 +131,6 @@ static void httpClearString(HttpString *str) { if (str->str) { str->str[0] = '\0'; str->pos = 0; - str->size = 0; } } @@ -138,7 +138,9 @@ static int32_t httpOnError(HttpParser *parser, int32_t httpCode, int32_t parseCo HttpContext *pContext = parser->pContext; if (httpCode != 0) parser->httpCode = httpCode; if (parseCode != 0) parser->parseCode = parseCode; - httpError("context:%p, fd:%d, parse failed, httpCode:%d parseCode:%d", pContext, pContext->fd, httpCode, parseCode); + + httpError("context:%p, fd:%d, parse failed, httpCode:%d parseCode:%d reason:%s", pContext, pContext->fd, httpCode, + parseCode & 0XFFFF, tstrerror(parseCode)); return 0; } @@ -309,19 +311,19 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const } return 0; } else { - free(t); - free(s); parser->authType = HTTP_INVALID_AUTH; httpError("context:%p, fd:%d, invalid auth, t:%s s:%s", pContext, pContext->fd, t, s); httpOnError(parser, 0, TSDB_CODE_HTTP_INVALID_AUTH_TYPE); + free(t); + free(s); return -1; } } else { - free(t); - free(s); parser->authType = HTTP_INVALID_AUTH; httpError("context:%p, fd:%d, parse auth failed, t:%s s:%s", pContext, pContext->fd, t, s); httpOnError(parser, 0, TSDB_CODE_HTTP_INVALID_AUTH_FORMAT); + free(t); + free(s); return -1; } } @@ -334,14 +336,15 @@ static int32_t httpOnBody(HttpParser *parser, const char *chunk, int32_t len) { HttpString * buf = &parser->body; if (parser->parseCode != TSDB_CODE_SUCCESS) return -1; - int32_t avail = buf->size - buf->pos; - if (len + 1 >= avail) { + int32_t newSize = buf->pos + len + 1; + if (newSize >= buf->size) { if (buf->size >= HTTP_BUFFER_SIZE) { httpError("context:%p, fd:%d, failed parse body, exceeding buffer size %d", pContext, pContext->fd, buf->size); httpOnError(parser, 0, TSDB_CODE_HTTP_REQUSET_TOO_BIG); return -1; } else { - int32_t newSize = buf->size * 10; + newSize = MAX(newSize, 32); + newSize *= 10; newSize = MIN(newSize, HTTP_BUFFER_SIZE); buf->str = realloc(buf->str, newSize); if (buf->str == NULL) { @@ -442,7 +445,6 @@ void httpInitParser(HttpParser *parser) { free(parser->method); parser->method = NULL; free(parser->target); parser->target = NULL; - free(parser->target_raw); parser->target_raw = NULL; free(parser->version); parser->version = NULL; free(parser->reasonPhrase); parser->reasonPhrase = NULL; free(parser->key); parser->key = NULL; @@ -481,7 +483,6 @@ void httpDestroyParser(HttpParser *parser) { free(parser->method); parser->method = NULL; free(parser->target); parser->target = NULL; - free(parser->target_raw); parser->target_raw = NULL; free(parser->version); parser->version = NULL; free(parser->reasonPhrase); parser->reasonPhrase = NULL; free(parser->key); parser->key = NULL; @@ -638,9 +639,8 @@ static int32_t httpParserOnTarget(HttpParser *parser, HTTP_PARSER_STATE state, c } break; } - parser->target_raw = strdup(parser->str.str); - parser->target = httpDecodeUrl(parser->str.str); - if (!parser->target_raw || !parser->target) { + parser->target = strdup(parser->str.str); + if (!parser->target) { httpError("context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom", pContext, pContext->fd, state, c, c); ok = -1; httpOnError(parser, 507, TSDB_CODE_HTTP_PARSE_TARGET_FAILED); diff --git a/src/plugins/http/src/httpResp.c b/src/plugins/http/src/httpResp.c index 77dfdb1bf4..755dad2d85 100644 --- a/src/plugins/http/src/httpResp.c +++ b/src/plugins/http/src/httpResp.c @@ -136,6 +136,10 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) { else httpCode = 400; + if (pContext->parser->httpCode != 0) { + httpCode = pContext->parser->httpCode; + } + char *httpCodeStr = httpGetStatusDesc(httpCode); httpSendErrorRespImp(pContext, httpCode, httpCodeStr, errNo & 0XFFFF, tstrerror(errNo)); } diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 2a558e25d5..0bca8cf041 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -319,21 +319,25 @@ static bool httpReadData(HttpContext *pContext) { if (ok) { httpError("context:%p, fd:%d, parse failed, ret:%d code:%d close connect", pContext, pContext->fd, ok, pParser->parseCode); + httpSendErrorResp(pContext, pParser->parseCode); httpNotifyContextClose(pContext); return false; } if (pParser->parseCode) { httpError("context:%p, fd:%d, parse failed, code:%d close connect", pContext, pContext->fd, pParser->parseCode); + httpSendErrorResp(pContext, pParser->parseCode); httpNotifyContextClose(pContext); return false; } - if (pParser->parsed) { + if (!pParser->parsed) { + httpDebug("context:%p, fd:%d, read not over yet, len:%d", pContext, pContext->fd, pParser->body.pos); + return false; + } else { httpDebug("context:%p, fd:%d, len:%d, body:%s", pContext, pContext->fd, pParser->body.pos, pParser->body.str); + return true; } - - return true; } else if (nread < 0) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { httpDebug("context:%p, fd:%d, read from socket error:%d, wait another event", pContext, pContext->fd, errno); diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index c60124a991..207f5d7923 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -344,7 +344,7 @@ void httpProcessSingleSqlCmd(HttpContext *pContext) { void httpProcessLoginCmd(HttpContext *pContext) { char token[128] = {0}; - if (!httpGenTaosdAuthToken(pContext, token, 128)) { + if (httpGenTaosdAuthToken(pContext, token, 128) != 0) { httpSendErrorResp(pContext, TSDB_CODE_HTTP_GEN_TAOSD_TOKEN_ERR); } else { httpDebug("context:%p, fd:%d, user:%s, login via http, return token:%s", pContext, pContext->fd, pContext->user, diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index cea804cfbb..c7866e5f4c 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -54,13 +54,13 @@ print =============== step2 - login system_content curl 127.0.0.1:7111/grafana/ print 1-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/grafana/xx print 2-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi @@ -72,7 +72,7 @@ endi system_content curl 127.0.0.1:7111/grafana/root/1/123/1/1/3 print 4-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi @@ -84,13 +84,13 @@ endi system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/grafana/root/1/login print 6-> $system_content -if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then +if $system_content != @{"status":"error","code":4386,"desc":"invalid type of Authorization"}@ then return -1 endi system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/grafana/root/1/login print 7-> $system_content -if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then +if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then return -1 endi diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim index b7f98e49e0..a02140a419 100644 --- a/tests/script/general/http/restful_full.sim +++ b/tests/script/general/http/restful_full.sim @@ -14,26 +14,26 @@ print =============== step1 - login system_content curl 127.0.0.1:7111/rest/ print 1-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/rest/xx print 2-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/rest/login print 3-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi #4 system_content curl 127.0.0.1:7111/rest/login/root print 4-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi @@ -58,13 +58,13 @@ endi #8 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":5010,"desc":"invalid type of Authorization"}@ then +if $system_content != @{"status":"error","code":4386,"desc":"invalid type of Authorization"}@ then return -1 endi system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:7111/rest/login/root/1 print 9-> $system_content -if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then +if $system_content != @{"status":"error","code":4387,"desc":"invalid format of Authorization"}@ then return -1 endi @@ -100,7 +100,7 @@ endi #14 system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:7111/rest/sql print 14-> $system_content -if $system_content != @{"status":"error","code":5012,"desc":"no sql input"}@ then +if $system_content != @{"status":"error","code":4359,"desc":"no sql input"}@ then return -1 endi diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index e54af99ad7..4018d9661a 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -16,224 +16,224 @@ print =============== step1 - parse system_content curl -u root:taosdata -d '{"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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/ print $system_content -if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":4448,"desc":"database name can not be null"}@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/ print $system_content -if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":4448,"desc":"database name can not be null"}@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/d123456789012345678901234567890123456 print $system_content -if $system_content != @{"status":"error","code":5023,"desc":"database name too long"}@ then +if $system_content != @{"status":"error","code":4449,"desc":"database name too long"}@ then return -1 endi system_content curl -u root:taosdata -d '[]' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then +if $system_content != @{"status":"error","code":4451,"desc":"metrics size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then +if $system_content != @{"status":"error","code":4451,"desc":"metrics size is 0"}@ then return -1 endi #system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:7111/telegraf/db/root/taosdata1 #print $system_content -#if $system_content != @{"status":"error","code":5026,"desc":"metrics size can not more than 50"}@ then +#if $system_content != @{"status":"error","code":4452,"desc":"metrics size can not more than 50"}@ then # return -1 #endi system_content curl -u root:taosdata -d '{"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},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4453,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5028,"desc":"metric name type should be string"}@ then +if $system_content != @{"status":"error","code":4454,"desc":"metric name type should be string"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5029,"desc":"metric name length is 0"}@ then +if $system_content != @{"status":"error","code":4455,"desc":"metric name length is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5030,"desc":"metric name length too long"}@ then +if $system_content != @{"status":"error","code":4456,"desc":"metric name length too long"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5031,"desc":"timestamp not find"}@ then +if $system_content != @{"status":"error","code":4457,"desc":"timestamp not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5032,"desc":"timestamp type should be integer"}@ then +if $system_content != @{"status":"error","code":4458,"desc":"timestamp type should be integer"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5033,"desc":"timestamp value smaller than 0"}@ then +if $system_content != @{"status":"error","code":4459,"desc":"timestamp value smaller than 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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","timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5034,"desc":"tags not find"}@ then +if $system_content != @{"status":"error","code":4460,"desc":"tags not find"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":{},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then +if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"","timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then +if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ then return -1 endi #system_content curl -u root:taosdata -d '{"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":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata #print $system_content -#if $system_content != @{"status":"error","code":5036,"desc":"tags size too long"}@ then +#if $system_content != @{"status":"error","code":4461,"desc":"tags size too long"}@ then # return -1 #endi system_content curl -u root:taosdata -d '{"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":{},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then +if $system_content != @{"status":"error","code":4461,"desc":"tags size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5038,"desc":"tag name is null"}@ then +if $system_content != @{"status":"error","code":4464,"desc":"tag name is null"}@ then return -1 endi #system_content curl -u root:taosdata -d '{"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":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 #print $system_content -#if $system_content != @{"status":"error","code":5039,"desc":"tag name length too long"}@ then +#if $system_content != @{"status":"error","code":4465,"desc":"tag name length too long"}@ then # return -1 #endi system_content curl -u root:taosdata -d '{"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":true},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5040,"desc":"tag value type should be number or string"}@ then +if $system_content != @{"status":"error","code":4466,"desc":"tag value type should be number or string"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":""},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5041,"desc":"tag value is null"}@ then +if $system_content != @{"status":"error","code":4467,"desc":"tag value is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5042,"desc":"table is null"}@ then +if $system_content != @{"status":"error","code":4468,"desc":"table is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"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":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5043,"desc":"table name length too long"}@ then +if $system_content != @{"status":"error","code":4469,"desc":"table name length too long"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5045,"desc":"fields size is 0"}@ then +if $system_content != @{"status":"error","code":4471,"desc":"fields size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{"":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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5048,"desc":"field name is null"}@ then +if $system_content != @{"status":"error","code":4474,"desc":"field name is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5051,"desc":"field value is null"}@ then +if $system_content != @{"status":"error","code":4477,"desc":"field value is null"}@ then return -1 endi system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"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":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:7111/telegraf/db/root/taosdata1 print $system_content -if $system_content != @{"status":"error","code":5050,"desc":"field value type should be number or string"}@ then +if $system_content != @{"status":"error","code":4476,"desc":"field value type should be number or string"}@ then return -1 endi diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 0d444a5a6e..45739b7d99 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -111,23 +111,23 @@ echo "serverPort ${NODE}" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "vDebugFlag 135" >> $TAOS_CFG -echo "tsdbDebugFlag 135" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "jnidebugFlag 135" >> $TAOS_CFG -echo "odbcdebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "mqttDebugFlag 135" >> $TAOS_CFG -echo "qdebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "mDebugFlag 131" >> $TAOS_CFG +echo "sdbDebugFlag 131" >> $TAOS_CFG +echo "dDebugFlag 131" >> $TAOS_CFG +echo "vDebugFlag 131" >> $TAOS_CFG +echo "tsdbDebugFlag 131" >> $TAOS_CFG +echo "cDebugFlag 131" >> $TAOS_CFG +echo "jnidebugFlag 131" >> $TAOS_CFG +echo "odbcdebugFlag 131" >> $TAOS_CFG +echo "httpDebugFlag 207" >> $TAOS_CFG +echo "monitorDebugFlag 131" >> $TAOS_CFG +echo "mqttDebugFlag 131" >> $TAOS_CFG +echo "qdebugFlag 131" >> $TAOS_CFG +echo "rpcDebugFlag 131" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG -echo "sdebugFlag 135" >> $TAOS_CFG -echo "wdebugFlag 135" >> $TAOS_CFG +echo "udebugFlag 131" >> $TAOS_CFG +echo "sdebugFlag 131" >> $TAOS_CFG +echo "wdebugFlag 131" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG diff --git a/tests/script/unique/http/admin.sim b/tests/script/unique/http/admin.sim index dc17520d02..8833397487 100644 --- a/tests/script/unique/http/admin.sim +++ b/tests/script/unique/http/admin.sim @@ -33,25 +33,25 @@ print =============== step1 - login system_content curl 127.0.0.1:7111/admin/ print 1-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/admin/xx print 2-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/admin/login print 3-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi system_content curl 127.0.0.1:7111/admin/login/root print 4-> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi @@ -69,13 +69,13 @@ endi system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.' -d 'show databases' 127.0.0.1:7111/admin/login/root/1 print 7-> $system_content -if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then +if $system_content != @{"status":"error","code":4386,"desc":"invalid type of Authorization"}@ then return -1 endi system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:7111/admin/login/root/1 print 8-> $system_content -if $system_content != @{"status":"error","code":5053,"desc":"parse http auth token error"}@ then +if $system_content != @{"status":"error","code":4389,"desc":"invalid taosd Authorization"}@ then return -1 endi @@ -105,7 +105,7 @@ endi system_content curl 127.0.0.1:7111/admin/logout print 11 -----> $system_content -if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then +if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then return -1 endi @@ -168,7 +168,7 @@ print =============== step7 - use dbs system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:7111/admin/all print 23-> $system_content -if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then +if $system_content != @{"status":"error","code":4360,"desc":"no need to execute use db cmd"}@ then return -1 endi diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index 4901c5b3fd..5269817165 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -13,62 +13,62 @@ print ============================ dnode1 start print =============== step1 - parse system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":4496,"desc":"database name can not be null"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db123456789012345678901234567890db print $system_content -if $system_content != @{"status":"error","code":5058,"desc":"database name too long"}@ then +if $system_content != @{"status":"error","code":4497,"desc":"database name too long"}@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":4496,"desc":"database name can not be null"}@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put2 print $system_content -if $system_content != @{"status":"error","code":5009,"desc":"http url parse error"}@ then +if $system_content != @{"status":"error","code":4354,"desc":"invalid url format"}@ then return -1 endi system_content curl -u root:taosdata -d '[]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then +if $system_content != @{"status":"error","code":4499,"desc":"metrics size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '[' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5059,"desc":"invalid opentsdb json fromat"}@ then +if $system_content != @{"status":"error","code":4498,"desc":"invalid opentsdb json fromat"}@ then return -1 endi system_content curl -u root:taosdata -d '{}' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then +if $system_content != @{"status":"error","code":4499,"desc":"metrics size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5062,"desc":"metric name not find"}@ then +if $system_content != @{"status":"error","code":4501,"desc":"metric name not find"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5063,"desc":"metric name type should be string"}@ then +if $system_content != @{"status":"error","code":4502,"desc":"metric name type should be string"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5064,"desc":"metric name length is 0"}@ then +if $system_content != @{"status":"error","code":4503,"desc":"metric name length is 0"}@ then return -1 endi @@ -80,25 +80,25 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5066,"desc":"timestamp not find"}@ then +if $system_content != @{"status":"error","code":4505,"desc":"timestamp not find"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5067,"desc":"timestamp type should be integer"}@ then +if $system_content != @{"status":"error","code":4506,"desc":"timestamp type should be integer"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5068,"desc":"timestamp value smaller than 0"}@ then +if $system_content != @{"status":"error","code":4507,"desc":"timestamp value smaller than 0"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5078,"desc":"value not find"}@ then +if $system_content != @{"status":"error","code":4517,"desc":"value not find"}@ then return -1 endi @@ -106,19 +106,19 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5069,"desc":"tags not find"}@ then +if $system_content != @{"status":"error","code":4508,"desc":"tags not find"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then +if $system_content != @{"status":"error","code":4509,"desc":"tags size is 0"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then +if $system_content != @{"status":"error","code":4509,"desc":"tags size is 0"}@ then return -1 endi @@ -130,25 +130,25 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5073,"desc":"tag name is null"}@ then +if $system_content != @{"status":"error","code":4512,"desc":"tag name is null"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5074,"desc":"tag name length too long"}@ then +if $system_content != @{"status":"error","code":4513,"desc":"tag name length too long"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5077,"desc":"tag value can not more than 64"}@ then +if $system_content != @{"status":"error","code":4516,"desc":"tag value can not more than 64"}@ then return -1 endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:7111/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":5076,"desc":"tag value is null"}@ then +if $system_content != @{"status":"error","code":4515,"desc":"tag value is null"}@ then return -1 endi -- GitLab