Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/TS-4994-3.0
This commit is contained in:
commit
def6f69819
|
@ -161,4 +161,4 @@ version.h
|
||||||
geos_c.h
|
geos_c.h
|
||||||
source/libs/parser/src/sql.c
|
source/libs/parser/src/sql.c
|
||||||
include/common/ttokenauto.h
|
include/common/ttokenauto.h
|
||||||
|
!packaging/smokeTest/pytest_require.txt
|
||||||
|
|
|
@ -228,4 +228,35 @@ PAUSE STREAM [IF EXISTS] stream_name;
|
||||||
RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name;
|
RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name;
|
||||||
```
|
```
|
||||||
|
|
||||||
没有指定 IF EXISTS,如果该 stream 不存在,则报错。如果存在,则恢复流计算。指定了 IF EXISTS,如果 stream 不存在,则返回成功。如果存在,则恢复流计算。如果指定 IGNORE UNTREATED,则恢复流计算时,忽略流计算暂停期间写入的数据。
|
没有指定 IF EXISTS,如果该 stream 不存在,则报错。如果存在,则恢复流计算。指定了 IF EXISTS,如果 stream 不存在,则返回成功。如果存在,则恢复流计算。如果指定 IGNORE UNTREATED,则恢复流计算时,忽略流计算暂停期间写入的数据。
|
||||||
|
|
||||||
|
### 流计算升级故障恢复
|
||||||
|
|
||||||
|
升级 TDengine 后,如果流计算不兼容,需要删除流计算,然后重新创建流计算。步骤如下:
|
||||||
|
|
||||||
|
1.修改 taos.cfg,添加 disableStream 1
|
||||||
|
|
||||||
|
2.重启 taosd。如果启动失败,修改 stream 目录的名称,避免 taosd 启动的时候尝试加载 stream 目录下的流计算数据信息。不使用删除操作避免误操作导致的风险。需要修改的文件夹:$dataDir/vnode/vnode*/tq/stream,$dataDir 指 TDengine 存储数据的目录,在 $dataDir/vnode/ 目录下会有多个类似 vnode1 、vnode2...vnode* 的目录,全部需要修改里面的 tq/stream 目录的名字,改为 tq/stream.bk
|
||||||
|
|
||||||
|
3.启动 taos
|
||||||
|
|
||||||
|
```sql
|
||||||
|
drop stream xxxx; ---- xxx 指stream name
|
||||||
|
flush database stream_source_db; ---- 流计算读取数据的超级表所在的 database
|
||||||
|
flush database stream_dest_db; ---- 流计算写入数据的超级表所在的 database
|
||||||
|
```
|
||||||
|
|
||||||
|
举例:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
create stream streams1 into test1.streamst as select _wstart, count(a) c1 from test.st interval(1s) ;
|
||||||
|
drop database streams1;
|
||||||
|
flush database test;
|
||||||
|
flush database test1;
|
||||||
|
```
|
||||||
|
|
||||||
|
4.关闭 taosd
|
||||||
|
|
||||||
|
5.修改 taos.cfg,去掉 disableStream 1,或将 disableStream 改为 0
|
||||||
|
|
||||||
|
6.启动 taosd
|
|
@ -122,6 +122,7 @@ alter_database_option: {
|
||||||
| KEEP value
|
| KEEP value
|
||||||
| WAL_RETENTION_PERIOD value
|
| WAL_RETENTION_PERIOD value
|
||||||
| WAL_RETENTION_SIZE value
|
| WAL_RETENTION_SIZE value
|
||||||
|
| MINROWS value
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef struct {
|
||||||
int32_t anode;
|
int32_t anode;
|
||||||
int32_t urlLen;
|
int32_t urlLen;
|
||||||
char *url;
|
char *url;
|
||||||
} SAnalUrl;
|
} SAnalyticsUrl;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ANAL_BUF_TYPE_JSON = 0,
|
ANAL_BUF_TYPE_JSON = 0,
|
||||||
|
@ -53,18 +53,18 @@ typedef struct {
|
||||||
TdFilePtr filePtr;
|
TdFilePtr filePtr;
|
||||||
char fileName[TSDB_FILENAME_LEN + 10];
|
char fileName[TSDB_FILENAME_LEN + 10];
|
||||||
int64_t numOfRows;
|
int64_t numOfRows;
|
||||||
} SAnalColBuf;
|
} SAnalyticsColBuf;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EAnalBufType bufType;
|
EAnalBufType bufType;
|
||||||
TdFilePtr filePtr;
|
TdFilePtr filePtr;
|
||||||
char fileName[TSDB_FILENAME_LEN];
|
char fileName[TSDB_FILENAME_LEN];
|
||||||
int32_t numOfCols;
|
int32_t numOfCols;
|
||||||
SAnalColBuf *pCols;
|
SAnalyticsColBuf *pCols;
|
||||||
} SAnalBuf;
|
} SAnalBuf;
|
||||||
|
|
||||||
int32_t taosAnalInit();
|
int32_t taosAnalyticsInit();
|
||||||
void taosAnalCleanup();
|
void taosAnalyticsCleanup();
|
||||||
SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf);
|
SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf);
|
||||||
|
|
||||||
int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen);
|
int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen);
|
|
@ -0,0 +1,59 @@
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
|
||||||
|
# 执行 git fetch 命令并捕获输出
|
||||||
|
def git_fetch():
|
||||||
|
result = subprocess.run(['git', 'fetch'], capture_output=True, text=True)
|
||||||
|
return result
|
||||||
|
|
||||||
|
# 解析分支名称
|
||||||
|
def parse_branch_name_type1(error_output):
|
||||||
|
# 使用正则表达式匹配 'is at' 前的分支名称
|
||||||
|
match = re.search(r"error: cannot lock ref '(refs/remotes/origin/[^']+)': is at", error_output)
|
||||||
|
if match:
|
||||||
|
return match.group(1)
|
||||||
|
return None
|
||||||
|
|
||||||
|
# 解析第二种错误中的分支名称
|
||||||
|
def parse_branch_name_type2(error_output):
|
||||||
|
# 使用正则表达式匹配 'exists' 前的第一个引号内的分支名称
|
||||||
|
match = re.search(r"'(refs/remotes/origin/[^']+)' exists;", error_output)
|
||||||
|
if match:
|
||||||
|
return match.group(1)
|
||||||
|
return None
|
||||||
|
|
||||||
|
# 执行 git update-ref -d 命令
|
||||||
|
def git_update_ref(branch_name):
|
||||||
|
if branch_name:
|
||||||
|
subprocess.run(['git', 'update-ref', '-d', f'{branch_name}'], check=True)
|
||||||
|
|
||||||
|
# 解析错误类型并执行相应的修复操作
|
||||||
|
def handle_error(error_output):
|
||||||
|
# 错误类型1:本地引用的提交ID与远程不一致
|
||||||
|
if "is at" in error_output and "but expected" in error_output:
|
||||||
|
branch_name = parse_branch_name_type1(error_output)
|
||||||
|
if branch_name:
|
||||||
|
print(f"Detected error type 1, attempting to delete ref for branch: {branch_name}")
|
||||||
|
git_update_ref(branch_name)
|
||||||
|
else:
|
||||||
|
print("Error parsing branch name for type 1.")
|
||||||
|
# 错误类型2:尝试创建新的远程引用时,本地已经存在同名的引用
|
||||||
|
elif "exists; cannot create" in error_output:
|
||||||
|
branch_name = parse_branch_name_type2(error_output)
|
||||||
|
if branch_name:
|
||||||
|
print(f"Detected error type 2, attempting to delete ref for branch: {branch_name}")
|
||||||
|
git_update_ref(branch_name)
|
||||||
|
else:
|
||||||
|
print("Error parsing branch name for type 2.")
|
||||||
|
|
||||||
|
# 主函数
|
||||||
|
def main():
|
||||||
|
fetch_result = git_fetch()
|
||||||
|
if fetch_result.returncode != 0: # 如果 git fetch 命令失败
|
||||||
|
error_output = fetch_result.stderr
|
||||||
|
handle_error(error_output)
|
||||||
|
else:
|
||||||
|
print("Git fetch successful.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -0,0 +1,319 @@
|
||||||
|
body {
|
||||||
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
/* do not increase min-width as some may use split screens */
|
||||||
|
min-width: 800px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
* SUMMARY INFORMATION
|
||||||
|
******************************/
|
||||||
|
#environment td {
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
#environment tr:nth-child(odd) {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
|
#environment ul {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
* TEST RESULT COLORS
|
||||||
|
******************************/
|
||||||
|
span.passed,
|
||||||
|
.passed .col-result {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.skipped,
|
||||||
|
span.xfailed,
|
||||||
|
span.rerun,
|
||||||
|
.skipped .col-result,
|
||||||
|
.xfailed .col-result,
|
||||||
|
.rerun .col-result {
|
||||||
|
color: orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.error,
|
||||||
|
span.failed,
|
||||||
|
span.xpassed,
|
||||||
|
.error .col-result,
|
||||||
|
.failed .col-result,
|
||||||
|
.xpassed .col-result {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-links__extra {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
* RESULTS TABLE
|
||||||
|
*
|
||||||
|
* 1. Table Layout
|
||||||
|
* 2. Extra
|
||||||
|
* 3. Sorting items
|
||||||
|
*
|
||||||
|
******************************/
|
||||||
|
/*------------------
|
||||||
|
* 1. Table Layout
|
||||||
|
*------------------*/
|
||||||
|
#results-table {
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#results-table th,
|
||||||
|
#results-table td {
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
#results-table th {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* 2. Extra
|
||||||
|
*------------------*/
|
||||||
|
.logwrapper {
|
||||||
|
max-height: 230px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
}
|
||||||
|
.logwrapper.expanded {
|
||||||
|
max-height: none;
|
||||||
|
}
|
||||||
|
.logwrapper.expanded .logexpander:after {
|
||||||
|
content: "collapse [-]";
|
||||||
|
}
|
||||||
|
.logwrapper .logexpander {
|
||||||
|
z-index: 1;
|
||||||
|
position: sticky;
|
||||||
|
top: 10px;
|
||||||
|
width: max-content;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 5px 7px;
|
||||||
|
margin: 10px 0 10px calc(100% - 80px);
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
}
|
||||||
|
.logwrapper .logexpander:after {
|
||||||
|
content: "expand [+]";
|
||||||
|
}
|
||||||
|
.logwrapper .logexpander:hover {
|
||||||
|
color: #000;
|
||||||
|
border-color: #000;
|
||||||
|
}
|
||||||
|
.logwrapper .log {
|
||||||
|
min-height: 40px;
|
||||||
|
position: relative;
|
||||||
|
top: -50px;
|
||||||
|
height: calc(100% + 50px);
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
color: black;
|
||||||
|
display: block;
|
||||||
|
font-family: "Courier New", Courier, monospace;
|
||||||
|
padding: 5px;
|
||||||
|
padding-right: 80px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.media {
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
float: right;
|
||||||
|
height: 240px;
|
||||||
|
margin: 0 5px;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 320px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 25px auto 25px;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1 1;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-container--fullscreen {
|
||||||
|
grid-template-columns: 0px auto 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-container__nav--right,
|
||||||
|
.media-container__nav--left {
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media-container__viewport {
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
|
.media-container__viewport img,
|
||||||
|
.media-container__viewport video {
|
||||||
|
object-fit: cover;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.media__name,
|
||||||
|
.media__counter {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-around;
|
||||||
|
flex: 0 0 25px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapsible td:not(.col-links) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.collapsible td:not(.col-links):hover::after {
|
||||||
|
color: #bbb;
|
||||||
|
font-style: italic;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-result {
|
||||||
|
width: 130px;
|
||||||
|
}
|
||||||
|
.col-result:hover::after {
|
||||||
|
content: " (hide details)";
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-result.collapsed:hover::after {
|
||||||
|
content: " (show details)";
|
||||||
|
}
|
||||||
|
|
||||||
|
#environment-header h2:hover::after {
|
||||||
|
content: " (hide details)";
|
||||||
|
color: #bbb;
|
||||||
|
font-style: italic;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#environment-header.collapsed h2:hover::after {
|
||||||
|
content: " (show details)";
|
||||||
|
color: #bbb;
|
||||||
|
font-style: italic;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* 3. Sorting items
|
||||||
|
*------------------*/
|
||||||
|
.sortable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sortable.desc:after {
|
||||||
|
content: " ";
|
||||||
|
position: relative;
|
||||||
|
left: 5px;
|
||||||
|
bottom: -12.5px;
|
||||||
|
border: 10px solid #4caf50;
|
||||||
|
border-bottom: 0;
|
||||||
|
border-left-color: transparent;
|
||||||
|
border-right-color: transparent;
|
||||||
|
}
|
||||||
|
.sortable.asc:after {
|
||||||
|
content: " ";
|
||||||
|
position: relative;
|
||||||
|
left: 5px;
|
||||||
|
bottom: 12.5px;
|
||||||
|
border: 10px solid #4caf50;
|
||||||
|
border-top: 0;
|
||||||
|
border-left-color: transparent;
|
||||||
|
border-right-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden, .summary__reload__button.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary__data {
|
||||||
|
flex: 0 0 550px;
|
||||||
|
}
|
||||||
|
.summary__reload {
|
||||||
|
flex: 1 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.summary__reload__button {
|
||||||
|
flex: 0 0 300px;
|
||||||
|
display: flex;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #4caf50;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.summary__reload__button:hover {
|
||||||
|
background-color: #46a049;
|
||||||
|
}
|
||||||
|
.summary__spacer {
|
||||||
|
flex: 0 0 550px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filters,
|
||||||
|
.collapse {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.filters button,
|
||||||
|
.collapse button {
|
||||||
|
color: #999;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.filters button:hover,
|
||||||
|
.collapse button:hover {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__label {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
# conftest.py
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
parser.addoption(
|
||||||
|
"--verMode", default="enterprise", help="community or enterprise"
|
||||||
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--tVersion", default="3.3.2.6", help="the version of taos"
|
||||||
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--baseVersion", default="smoking", help="the path of nas"
|
||||||
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--sourcePath", default="nas", help="only support nas currently"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Collect the setup and teardown of each test case and their std information
|
||||||
|
setup_stdout_info = {}
|
||||||
|
teardown_stdout_info = {}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.hookimpl(hookwrapper=True)
|
||||||
|
def pytest_runtest_makereport(item, call):
|
||||||
|
outcome = yield
|
||||||
|
rep = outcome.get_result()
|
||||||
|
|
||||||
|
# Record the std of setup and teardown
|
||||||
|
if call.when == 'setup':
|
||||||
|
for i in rep.sections:
|
||||||
|
if i[0] == "Captured stdout setup":
|
||||||
|
if not setup_stdout_info:
|
||||||
|
setup_stdout_info[item.nodeid] = i[1]
|
||||||
|
elif call.when == 'teardown':
|
||||||
|
for i in rep.sections:
|
||||||
|
if i[0] == "Captured stdout teardown":
|
||||||
|
teardown_stdout_info[item.nodeid] = i[1]
|
||||||
|
|
||||||
|
|
||||||
|
# Insert setup and teardown's std in the summary section
|
||||||
|
def pytest_html_results_summary(prefix, summary, postfix):
|
||||||
|
if setup_stdout_info or teardown_stdout_info:
|
||||||
|
rows = []
|
||||||
|
|
||||||
|
# Insert setup stdout
|
||||||
|
if setup_stdout_info:
|
||||||
|
for nodeid, stdout in setup_stdout_info.items():
|
||||||
|
html_content = '''
|
||||||
|
<tr>
|
||||||
|
<td><b><span style="font-size: larger; color: black;">Setup:</span></b></td>
|
||||||
|
<td colspan="4">
|
||||||
|
<a href="#" id="toggleSetup">Show Setup</a>
|
||||||
|
<div id="setupContent" class="collapsible-content" style="display: none; white-space: pre-wrap; margin-top: 5px;">
|
||||||
|
<pre>{}</pre>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
'''.format(stdout.strip())
|
||||||
|
|
||||||
|
# 如果需要在 Python 脚本中生成 HTML,并使用 JavaScript 控制折叠内容的显示,可以这样做:
|
||||||
|
|
||||||
|
html_script = '''
|
||||||
|
<script>
|
||||||
|
document.getElementById('toggleSetup').addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var setupContentDiv = document.getElementById('setupContent');
|
||||||
|
setupContentDiv.style.display = setupContentDiv.style.display === 'none' ? 'block' : 'none';
|
||||||
|
var buttonText = setupContentDiv.style.display === 'none' ? 'Show Setup' : 'Hide Setup';
|
||||||
|
this.textContent = buttonText;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
'''
|
||||||
|
|
||||||
|
# 输出完整的 HTML 代码
|
||||||
|
final_html = html_content + html_script
|
||||||
|
rows.append(final_html)
|
||||||
|
rows.append("<br>")
|
||||||
|
# Insert teardown stdout
|
||||||
|
if teardown_stdout_info:
|
||||||
|
for nodeid, stdout in teardown_stdout_info.items():
|
||||||
|
html_content = '''
|
||||||
|
<tr>
|
||||||
|
<td><b><span style="font-size: larger; color: black;">Teardown:</span></b></td>
|
||||||
|
<td colspan="4">
|
||||||
|
<a href="#" id="toggleTeardown">Show Teardown</a>
|
||||||
|
<div id="teardownContent" class="collapsible-content" style="display: none; white-space: pre-wrap; margin-top: 5px;">
|
||||||
|
<pre>{}</pre>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
'''.format(stdout.strip())
|
||||||
|
|
||||||
|
# 如果需要在 Python 脚本中生成 HTML,并使用 JavaScript 控制折叠内容的显示,可以这样做:
|
||||||
|
|
||||||
|
html_script = '''
|
||||||
|
<script>
|
||||||
|
document.getElementById('toggleTeardown').addEventListener('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var teardownContentDiv = document.getElementById('teardownContent');
|
||||||
|
teardownContentDiv.style.display = teardownContentDiv.style.display === 'none' ? 'block' : 'none';
|
||||||
|
var buttonText = teardownContentDiv.style.display === 'none' ? 'Show Teardown' : 'Hide Teardown';
|
||||||
|
this.textContent = buttonText;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
'''
|
||||||
|
|
||||||
|
# 输出完整的 HTML 代码
|
||||||
|
final_html = html_content + html_script
|
||||||
|
rows.append(final_html)
|
||||||
|
|
||||||
|
prefix.extend(rows)
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/expect
|
||||||
|
set packageName [lindex $argv 0]
|
||||||
|
set packageSuffix [lindex $argv 1]
|
||||||
|
set timeout 30
|
||||||
|
if { ${packageSuffix} == "deb" } {
|
||||||
|
spawn dpkg -i ${packageName}
|
||||||
|
} elseif { ${packageSuffix} == "rpm"} {
|
||||||
|
spawn rpm -ivh ${packageName}
|
||||||
|
}
|
||||||
|
expect "*one:"
|
||||||
|
send "\r"
|
||||||
|
expect "*skip:"
|
||||||
|
send "\r"
|
||||||
|
|
||||||
|
expect eof
|
|
@ -0,0 +1,57 @@
|
||||||
|
set baseVersion=%1%
|
||||||
|
set version=%2%
|
||||||
|
set verMode=%3%
|
||||||
|
set sType=%4%
|
||||||
|
echo %fileType%
|
||||||
|
rem stop services
|
||||||
|
if EXIST C:\TDengine (
|
||||||
|
if EXIST C:\TDengine\stop-all.bat (
|
||||||
|
call C:\TDengine\stop-all.bat /silent
|
||||||
|
echo "***************Stop taos services***************"
|
||||||
|
)
|
||||||
|
if exist C:\TDengine\unins000.exe (
|
||||||
|
call C:\TDengine\unins000.exe /silent
|
||||||
|
echo "***************uninstall TDengine***************"
|
||||||
|
)
|
||||||
|
rd /S /q C:\TDengine
|
||||||
|
)
|
||||||
|
if EXIST C:\ProDB (
|
||||||
|
if EXIST C:\ProDB\stop-all.bat (
|
||||||
|
call C:\ProDB\stop-all.bat /silent
|
||||||
|
echo "***************Stop taos services***************"
|
||||||
|
)
|
||||||
|
if exist C:\ProDB\unins000.exe (
|
||||||
|
call C:\ProDB\unins000.exe /silent
|
||||||
|
echo "***************uninstall TDengine***************"
|
||||||
|
)
|
||||||
|
rd /S /q C:\ProDB
|
||||||
|
)
|
||||||
|
if "%verMode%"=="enterprise" (
|
||||||
|
if "%sType%"=="client" (
|
||||||
|
set fileType=enterprise-client
|
||||||
|
) else (
|
||||||
|
set fileType=enterprise
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
set fileType=%sType%
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%baseVersion%"=="ProDB" (
|
||||||
|
echo %fileType%
|
||||||
|
set installer=ProDB-%fileType%-%version%-Windows-x64.exe
|
||||||
|
) else (
|
||||||
|
echo %fileType%
|
||||||
|
set installer=TDengine-%fileType%-%version%-Windows-x64.exe
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%baseVersion%"=="ProDB" (
|
||||||
|
echo %installer%
|
||||||
|
scp root@192.168.1.213:/nas/OEM/ProDB/v%version%/%installer% C:\workspace
|
||||||
|
) else (
|
||||||
|
echo %installer%
|
||||||
|
scp root@192.168.1.213:/nas/TDengine/%baseVersion%/v%version%/%verMode%/%installer% C:\workspace
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "***************Finish installer transfer!***************"
|
||||||
|
C:\workspace\%installer% /silent
|
||||||
|
echo "***************Finish install!***************"
|
|
@ -0,0 +1,325 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo "$0"
|
||||||
|
echo -e "\t -f test file type,server/client/tools/"
|
||||||
|
echo -e "\t -m pacakage version Type,community/enterprise"
|
||||||
|
echo -e "\t -l package type,lite or not"
|
||||||
|
echo -e "\t -c operation type,x64/arm64"
|
||||||
|
echo -e "\t -v pacakage version,3.0.1.7"
|
||||||
|
echo -e "\t -o pacakage version,3.0.1.7"
|
||||||
|
echo -e "\t -s source Path,web/nas"
|
||||||
|
echo -e "\t -t package Type,tar/rpm/deb"
|
||||||
|
echo -e "\t -h help"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#parameter
|
||||||
|
scriptDir=$(dirname $(readlink -f $0))
|
||||||
|
version="3.0.1.7"
|
||||||
|
originversion="smoking"
|
||||||
|
testFile="server"
|
||||||
|
verMode="communtity"
|
||||||
|
sourcePath="nas"
|
||||||
|
cpuType="x64"
|
||||||
|
lite="true"
|
||||||
|
packageType="tar"
|
||||||
|
subFile="package.tar.gz"
|
||||||
|
while getopts "m:c:f:l:s:o:t:v:h" opt; do
|
||||||
|
case $opt in
|
||||||
|
m)
|
||||||
|
verMode=$OPTARG
|
||||||
|
;;
|
||||||
|
v)
|
||||||
|
version=$OPTARG
|
||||||
|
;;
|
||||||
|
f)
|
||||||
|
testFile=$OPTARG
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
lite=$OPTARG
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
sourcePath=$OPTARG
|
||||||
|
;;
|
||||||
|
o)
|
||||||
|
originversion=$OPTARG
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
cpuType=$OPTARG
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
packageType=$OPTARG
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
echo "Invalid option: -$OPTARG"
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
systemType=`uname`
|
||||||
|
if [ ${systemType} == "Darwin" ]; then
|
||||||
|
platform="macOS"
|
||||||
|
else
|
||||||
|
platform="Linux"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "testFile:${testFile},verMode:${verMode},lite:${lite},cpuType:${cpuType},packageType:${packageType},version-${version},originversion:${originversion},sourcePath:${sourcePath}"
|
||||||
|
# Color setting
|
||||||
|
RED='\033[41;30m'
|
||||||
|
GREEN='\033[1;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[1;34m'
|
||||||
|
GREEN_DARK='\033[0;32m'
|
||||||
|
YELLOW_DARK='\033[0;33m'
|
||||||
|
BLUE_DARK='\033[0;34m'
|
||||||
|
GREEN_UNDERLINE='\033[4;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
if [ "${originversion}" = "ProDB" ]; then
|
||||||
|
TDengine="ProDB"
|
||||||
|
else
|
||||||
|
TDengine="TDengine"
|
||||||
|
fi
|
||||||
|
if [[ ${verMode} = "enterprise" ]];then
|
||||||
|
prePackage="${TDengine}-enterprise"
|
||||||
|
if [[ ${testFile} = "client" ]];then
|
||||||
|
prePackage="${TDengine}-enterprise-${testFile}"
|
||||||
|
fi
|
||||||
|
elif [ ${verMode} = "community" ];then
|
||||||
|
prePackage="${TDengine}-${testFile}"
|
||||||
|
fi
|
||||||
|
if [ ${lite} = "true" ];then
|
||||||
|
packageLite="-Lite"
|
||||||
|
elif [ ${lite} = "false" ];then
|
||||||
|
packageLite=""
|
||||||
|
fi
|
||||||
|
if [[ "$packageType" = "tar" ]] ;then
|
||||||
|
packageType="tar.gz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tdPath="${prePackage}-${version}"
|
||||||
|
|
||||||
|
packageName="${tdPath}-${platform}-${cpuType}${packageLite}.${packageType}"
|
||||||
|
|
||||||
|
if [ "$testFile" == "server" ] ;then
|
||||||
|
installCmd="install.sh"
|
||||||
|
elif [ ${testFile} = "client" ];then
|
||||||
|
installCmd="install_client.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "tdPath:${tdPath},packageName:${packageName}}"
|
||||||
|
cmdInstall() {
|
||||||
|
command=$1
|
||||||
|
if command -v ${command} ;then
|
||||||
|
echoColor YD "${command} is already installed"
|
||||||
|
else
|
||||||
|
if command -v apt ;then
|
||||||
|
apt-get install ${command} -y
|
||||||
|
elif command -v yum ;then
|
||||||
|
yum -y install ${command}
|
||||||
|
echoColor YD "you should install ${command} manually"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echoColor() {
|
||||||
|
color=$1
|
||||||
|
command=$2
|
||||||
|
if [ ${color} = 'Y' ];then
|
||||||
|
echo -e "${YELLOW}${command}${NC}"
|
||||||
|
elif [ ${color} = 'YD' ];then
|
||||||
|
echo -e "${YELLOW_DARK}${command}${NC}"
|
||||||
|
elif [ ${color} = 'R' ];then
|
||||||
|
echo -e "${RED}${command}${NC}"
|
||||||
|
elif [ ${color} = 'G' ];then
|
||||||
|
echo -e "${GREEN}${command}${NC}\r\n"
|
||||||
|
elif [ ${color} = 'B' ];then
|
||||||
|
echo -e "${BLUE}${command}${NC}"
|
||||||
|
elif [ ${color} = 'BD' ];then
|
||||||
|
echo -e "${BLUE_DARK}${command}${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
wgetFile() {
|
||||||
|
|
||||||
|
file=$1
|
||||||
|
versionPath=$2
|
||||||
|
sourceP=$3
|
||||||
|
nasServerIP="192.168.1.213"
|
||||||
|
if [ "${originversion}" = "ProDB" ]; then
|
||||||
|
packagePath="/nas/OEM/ProDB/v${versionPath}"
|
||||||
|
else
|
||||||
|
packagePath="/nas/TDengine/${originversion}/v${versionPath}/${verMode}"
|
||||||
|
fi
|
||||||
|
if [ -f ${file} ];then
|
||||||
|
echoColor YD "${file} already exists ,it will delete it and download it again "
|
||||||
|
# rm -rf ${file}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${sourceP} = 'web' ]];then
|
||||||
|
echoColor BD "====download====:wget https://www.taosdata.com/assets-download/3.0/${file}"
|
||||||
|
wget https://www.taosdata.com/assets-download/3.0/${file}
|
||||||
|
elif [[ ${sourceP} = 'nas' ]];then
|
||||||
|
echoColor BD "====download====:scp root@${nasServerIP}:${packagePath}/${file} ."
|
||||||
|
scp root@${nasServerIP}:${packagePath}/${file} .
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function newPath {
|
||||||
|
|
||||||
|
buildPath=$1
|
||||||
|
|
||||||
|
if [ ! -d ${buildPath} ] ;then
|
||||||
|
echoColor BD "mkdir -p ${buildPath}"
|
||||||
|
mkdir -p ${buildPath}
|
||||||
|
else
|
||||||
|
echoColor YD "${buildPath} already exists"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echoColor G "===== install basesoft ====="
|
||||||
|
cmdInstall tree
|
||||||
|
cmdInstall wget
|
||||||
|
cmdInstall expect
|
||||||
|
|
||||||
|
echoColor G "===== Uninstall all components of TDeingne ====="
|
||||||
|
|
||||||
|
if command -v rmtaos ;then
|
||||||
|
echoColor YD "uninstall all components of TDeingne:rmtaos"
|
||||||
|
rmtaos
|
||||||
|
else
|
||||||
|
echoColor YD "os doesn't include TDengine"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${packageName} =~ "server" ]] ;then
|
||||||
|
echoColor BD " pkill -9 taosd "
|
||||||
|
pkill -9 taosd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v rmprodb ;then
|
||||||
|
echoColor YD "uninstall all components of TDeingne:rmprodb"
|
||||||
|
rmprodb
|
||||||
|
else
|
||||||
|
echoColor YD "os doesn't include TDengine"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${packageName} =~ "server" ]] ;then
|
||||||
|
echoColor BD " pkill -9 prodbd "
|
||||||
|
pkill -9 prodbd
|
||||||
|
fi
|
||||||
|
|
||||||
|
echoColor G "===== new workroom path ====="
|
||||||
|
installPath="/usr/local/src/packageTest"
|
||||||
|
|
||||||
|
if [ ${systemType} == "Darwin" ]; then
|
||||||
|
installPath="${WORK_DIR}/packageTest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
newPath ${installPath}
|
||||||
|
|
||||||
|
#if [ -d ${installPath}/${tdPath} ] ;then
|
||||||
|
# echoColor BD "rm -rf ${installPath}/${tdPath}/*"
|
||||||
|
# rm -rf ${installPath}/${tdPath}/*
|
||||||
|
#fi
|
||||||
|
|
||||||
|
echoColor G "===== download installPackage ====="
|
||||||
|
cd ${installPath} && wgetFile ${packageName} ${version} ${sourcePath}
|
||||||
|
#cd ${oriInstallPath} && wgetFile ${originPackageName} ${originversion} ${sourcePath}
|
||||||
|
|
||||||
|
|
||||||
|
cd ${installPath}
|
||||||
|
cp -r ${scriptDir}/debRpmAutoInstall.sh .
|
||||||
|
|
||||||
|
packageSuffix=$(echo ${packageName} | awk -F '.' '{print $NF}')
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f debRpmAutoInstall.sh ];then
|
||||||
|
echo '#!/usr/bin/expect ' > debRpmAutoInstall.sh
|
||||||
|
echo 'set packageName [lindex $argv 0]' >> debRpmAutoInstall.sh
|
||||||
|
echo 'set packageSuffix [lindex $argv 1]' >> debRpmAutoInstall.sh
|
||||||
|
echo 'set timeout 30 ' >> debRpmAutoInstall.sh
|
||||||
|
echo 'if { ${packageSuffix} == "deb" } {' >> debRpmAutoInstall.sh
|
||||||
|
echo ' spawn dpkg -i ${packageName} ' >> debRpmAutoInstall.sh
|
||||||
|
echo '} elseif { ${packageSuffix} == "rpm"} {' >> debRpmAutoInstall.sh
|
||||||
|
echo ' spawn rpm -ivh ${packageName}' >> debRpmAutoInstall.sh
|
||||||
|
echo '}' >> debRpmAutoInstall.sh
|
||||||
|
echo 'expect "*one:"' >> debRpmAutoInstall.sh
|
||||||
|
echo 'send "\r"' >> debRpmAutoInstall.sh
|
||||||
|
echo 'expect "*skip:"' >> debRpmAutoInstall.sh
|
||||||
|
echo 'send "\r" ' >> debRpmAutoInstall.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echoColor G "===== install Package ====="
|
||||||
|
|
||||||
|
if [[ ${packageName} =~ "deb" ]];then
|
||||||
|
cd ${installPath}
|
||||||
|
dpkg -r taostools
|
||||||
|
dpkg -r tdengine
|
||||||
|
if [[ ${packageName} =~ "TDengine" ]];then
|
||||||
|
echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix}
|
||||||
|
else
|
||||||
|
echoColor BD "dpkg -i ${packageName}" && dpkg -i ${packageName}
|
||||||
|
fi
|
||||||
|
elif [[ ${packageName} =~ "rpm" ]];then
|
||||||
|
cd ${installPath}
|
||||||
|
sudo rpm -e tdengine
|
||||||
|
sudo rpm -e taostools
|
||||||
|
if [[ ${packageName} =~ "TDengine" ]];then
|
||||||
|
echoColor BD "./debRpmAutoInstall.sh ${packageName} ${packageSuffix}" && chmod 755 debRpmAutoInstall.sh && ./debRpmAutoInstall.sh ${packageName} ${packageSuffix}
|
||||||
|
else
|
||||||
|
echoColor BD "rpm -ivh ${packageName}" && rpm -ivh ${packageName}
|
||||||
|
fi
|
||||||
|
elif [[ ${packageName} =~ "tar" ]];then
|
||||||
|
echoColor G "===== check installPackage File of tar ====="
|
||||||
|
|
||||||
|
cd ${installPath}
|
||||||
|
echoColor YD "unzip the new installation package"
|
||||||
|
echoColor BD "tar -xf ${packageName}" && tar -xf ${packageName}
|
||||||
|
|
||||||
|
cd ${installPath}/${tdPath} && tree -I "driver" > ${installPath}/now_${version}_checkfile
|
||||||
|
|
||||||
|
cd ${installPath}
|
||||||
|
diff ${installPath}/base_${originversion}_checkfile ${installPath}/now_${version}_checkfile > ${installPath}/diffFile.log
|
||||||
|
diffNumbers=`cat ${installPath}/diffFile.log |wc -l `
|
||||||
|
|
||||||
|
if [ ${diffNumbers} != 0 ];then
|
||||||
|
echoColor R "The number and names of files is different from the previous installation package"
|
||||||
|
diffLog=`cat ${installPath}/diffFile.log`
|
||||||
|
echoColor Y "${diffLog}"
|
||||||
|
exit -1
|
||||||
|
else
|
||||||
|
echoColor G "The number and names of files are the same as previous installation packages"
|
||||||
|
rm -rf ${installPath}/diffFile.log
|
||||||
|
fi
|
||||||
|
echoColor YD "===== install Package of tar ====="
|
||||||
|
cd ${installPath}/${tdPath}
|
||||||
|
if [ ${testFile} = "server" ];then
|
||||||
|
echoColor BD "bash ${installCmd} -e no "
|
||||||
|
bash ${installCmd} -e no
|
||||||
|
else
|
||||||
|
echoColor BD "bash ${installCmd} "
|
||||||
|
bash ${installCmd}
|
||||||
|
fi
|
||||||
|
elif [[ ${packageName} =~ "pkg" ]];then
|
||||||
|
cd ${installPath}
|
||||||
|
sudo installer -pkg ${packageName} -target /
|
||||||
|
echoColor YD "===== install Package successfully! ====="
|
||||||
|
fi
|
||||||
|
|
||||||
|
#cd ${installPath}
|
||||||
|
#
|
||||||
|
#rm -rf ${installPath}/${packageName}
|
||||||
|
#if [ ${platform} == "Linux" ]; then
|
||||||
|
# rm -rf ${installPath}/${tdPath}/
|
||||||
|
#fi
|
||||||
|
echoColor YD "===== end of shell file ====="
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def run_cmd(command):
|
||||||
|
print("CMD:", command)
|
||||||
|
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
||||||
|
print("STDOUT:", result.stdout)
|
||||||
|
print("STDERR:", result.stderr)
|
||||||
|
print("Return Code:", result.returncode)
|
||||||
|
#assert result.returncode == 0
|
||||||
|
return result
|
|
@ -0,0 +1,21 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
# python3 -m pytest test_server.py -v --html=/var/www/html/report.html --json-report --json-report-file="/var/www/html/report.json" --timeout=60
|
||||||
|
|
||||||
|
# pytest.main(["-s", "-v"])
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
# define cmd function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pytest.main(['--html=report.html'])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -0,0 +1,17 @@
|
||||||
|
pytest-html
|
||||||
|
pytest-json-report
|
||||||
|
pytest-timeout
|
||||||
|
taospy
|
||||||
|
numpy
|
||||||
|
fabric2
|
||||||
|
psutil
|
||||||
|
pandas
|
||||||
|
toml
|
||||||
|
distro
|
||||||
|
requests
|
||||||
|
pexpect
|
||||||
|
faker
|
||||||
|
pyopenssl
|
||||||
|
taos-ws-py
|
||||||
|
taospy
|
||||||
|
tzlocal
|
|
@ -0,0 +1,11 @@
|
||||||
|
rm -rf %WIN_TDENGINE_ROOT_DIR%\debug
|
||||||
|
mkdir %WIN_TDENGINE_ROOT_DIR%\debug
|
||||||
|
mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build
|
||||||
|
mkdir %WIN_TDENGINE_ROOT_DIR%\debug\build\bin
|
||||||
|
xcopy C:\TDengine\taos*.exe %WIN_TDENGINE_ROOT_DIR%\debug\build\bin
|
||||||
|
|
||||||
|
set case_out_file=%cd%\case.out
|
||||||
|
|
||||||
|
cd %WIN_TDENGINE_ROOT_DIR%\tests\system-test
|
||||||
|
python3 .\test.py -f 0-others\taosShell.py
|
||||||
|
python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
ulimit -c unlimited
|
||||||
|
|
||||||
|
rm -rf ${TDENGINE_ROOT_DIR}/debug
|
||||||
|
mkdir ${TDENGINE_ROOT_DIR}/debug
|
||||||
|
mkdir ${TDENGINE_ROOT_DIR}/debug/build
|
||||||
|
mkdir ${TDENGINE_ROOT_DIR}/debug/build/bin
|
||||||
|
|
||||||
|
systemType=`uname`
|
||||||
|
if [ ${systemType} == "Darwin" ]; then
|
||||||
|
cp /usr/local/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/
|
||||||
|
else
|
||||||
|
cp /usr/bin/taos* ${TDENGINE_ROOT_DIR}/debug/build/bin/
|
||||||
|
fi
|
||||||
|
|
||||||
|
case_out_file=`pwd`/case.out
|
||||||
|
python3 -m pip install -r ${TDENGINE_ROOT_DIR}/tests/requirements.txt >> $case_out_file
|
||||||
|
python3 -m pip install taos-ws-py taospy >> $case_out_file
|
||||||
|
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/tests/army
|
||||||
|
python3 ./test.py -f query/query_basic.py -N 3 >> $case_out_file
|
||||||
|
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/tests/system-test
|
||||||
|
python3 ./test.py -f 1-insert/insert_column_value.py >> $case_out_file
|
||||||
|
python3 ./test.py -f 2-query/primary_ts_base_5.py >> $case_out_file
|
||||||
|
python3 ./test.py -f 2-query/case_when.py >> $case_out_file
|
||||||
|
python3 ./test.py -f 2-query/partition_limit_interval.py >> $case_out_file
|
||||||
|
python3 ./test.py -f 2-query/join.py >> $case_out_file
|
||||||
|
python3 ./test.py -f 2-query/fill.py >> $case_out_file
|
|
@ -0,0 +1,251 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
# install pip
|
||||||
|
# pip install src/connector/python/
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, os
|
||||||
|
import re
|
||||||
|
import platform
|
||||||
|
import getopt
|
||||||
|
import subprocess
|
||||||
|
# from this import d
|
||||||
|
import time
|
||||||
|
|
||||||
|
# input for server
|
||||||
|
|
||||||
|
opts, args = getopt.gnu_getopt(sys.argv[1:], 'h:P:v:u', [
|
||||||
|
'host=', 'Port=', 'version='])
|
||||||
|
serverHost = ""
|
||||||
|
serverPort = 0
|
||||||
|
version = ""
|
||||||
|
uninstall = False
|
||||||
|
for key, value in opts:
|
||||||
|
if key in ['--help']:
|
||||||
|
print('A collection of test cases written using Python')
|
||||||
|
print('-h serverHost')
|
||||||
|
print('-P serverPort')
|
||||||
|
print('-v test client version')
|
||||||
|
print('-u test uninstall process, will uninstall TDengine')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
if key in ['-h']:
|
||||||
|
serverHost = value
|
||||||
|
if key in ['-P']:
|
||||||
|
serverPort = int(value)
|
||||||
|
if key in ['-v']:
|
||||||
|
version = value
|
||||||
|
if key in ['-u']:
|
||||||
|
uninstall = True
|
||||||
|
if not serverHost:
|
||||||
|
print("Please input use -h to specify your server host.")
|
||||||
|
sys.exit(0)
|
||||||
|
if not version:
|
||||||
|
print("No version specified, will not run version check.")
|
||||||
|
if serverPort == 0:
|
||||||
|
serverPort = 6030
|
||||||
|
print("No server port specified, use default 6030.")
|
||||||
|
|
||||||
|
|
||||||
|
system = platform.system()
|
||||||
|
|
||||||
|
arch = platform.machine()
|
||||||
|
|
||||||
|
databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
|
||||||
|
# install taospy
|
||||||
|
taospy_version = ""
|
||||||
|
if system == 'Windows':
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
|
||||||
|
else:
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
|
||||||
|
|
||||||
|
print("taospy version %s " % taospy_version)
|
||||||
|
if taospy_version == "":
|
||||||
|
subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
|
||||||
|
print("install taos python connector")
|
||||||
|
else:
|
||||||
|
subprocess.getoutput("pip3 install taospy")
|
||||||
|
|
||||||
|
# prepare data by taosBenchmark
|
||||||
|
cmd = "taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d &" % (databaseName, serverHost, serverPort)
|
||||||
|
process_out = subprocess.getoutput(cmd)
|
||||||
|
print(cmd)
|
||||||
|
#os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort))
|
||||||
|
taosBenchmark_test_result = True
|
||||||
|
time.sleep(10)
|
||||||
|
import taos
|
||||||
|
|
||||||
|
conn = taos.connect(host=serverHost,
|
||||||
|
user="root",
|
||||||
|
password="taosdata",
|
||||||
|
database=databaseName,
|
||||||
|
port=serverPort,
|
||||||
|
timezone="Asia/Shanghai") # default your host's timezone
|
||||||
|
|
||||||
|
server_version = conn.server_info
|
||||||
|
print("server_version", server_version)
|
||||||
|
client_version = conn.client_info
|
||||||
|
print("client_version", client_version) # 3.0.0.0
|
||||||
|
|
||||||
|
# Execute a sql and get its result set. It's useful for SELECT statement
|
||||||
|
result: taos.TaosResult = conn.query("SELECT count(*) from meters")
|
||||||
|
|
||||||
|
data = result.fetch_all()
|
||||||
|
print(data)
|
||||||
|
if data[0][0] !=10000:
|
||||||
|
print(" taosBenchmark work not as expected ")
|
||||||
|
print("!!!!!!!!!!!Test Result: taosBenchmark test failed! !!!!!!!!!!")
|
||||||
|
sys.exit(1)
|
||||||
|
#else:
|
||||||
|
# print("**********Test Result: taosBenchmark test passed **********")
|
||||||
|
|
||||||
|
|
||||||
|
# drop database of test
|
||||||
|
taos_test_result = False
|
||||||
|
print("drop database test")
|
||||||
|
print("run taos -s 'drop database %s;' -h %s -P %d" % (databaseName, serverHost, serverPort))
|
||||||
|
taos_cmd_outpur = subprocess.getoutput('taos -s "drop database %s;" -h %s -P %d' % (databaseName, serverHost, serverPort))
|
||||||
|
print(taos_cmd_outpur)
|
||||||
|
if ("Drop OK" in taos_cmd_outpur):
|
||||||
|
taos_test_result = True
|
||||||
|
#print("*******Test Result: taos test passed ************")
|
||||||
|
|
||||||
|
version_test_result = False
|
||||||
|
if version:
|
||||||
|
print("Client info is: %s"%conn.client_info)
|
||||||
|
taos_V_output = ""
|
||||||
|
if system == "Windows":
|
||||||
|
taos_V_output = subprocess.getoutput("taos -V | findstr version")
|
||||||
|
else:
|
||||||
|
taos_V_output = subprocess.getoutput("taos -V | grep version")
|
||||||
|
|
||||||
|
print("taos -V output is: %s" % taos_V_output)
|
||||||
|
if version in taos_V_output and version in conn.client_info:
|
||||||
|
version_test_result = True
|
||||||
|
#print("*******Test Result: Version check passed ************")
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
if uninstall:
|
||||||
|
print("Start to run rmtaos")
|
||||||
|
leftFile = False
|
||||||
|
print("Platform: ", system)
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
# 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
|
||||||
|
process = subprocess.Popen(['rmtaos'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
# 向子进程发送输入
|
||||||
|
process.stdin.write("y\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
# 关闭子进程的stdin,防止它无限期等待更多输入
|
||||||
|
process.stdin.close()
|
||||||
|
# 等待子进程结束
|
||||||
|
process.wait()
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /etc/systemd/system/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib64/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/include/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/taos")
|
||||||
|
#print(out)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files in /usr/local/taos:%s" % out)
|
||||||
|
leftFile = True
|
||||||
|
if not leftFile:
|
||||||
|
print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Darwin":
|
||||||
|
# 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
|
||||||
|
process = subprocess.Popen(['sudo', 'rmtaos'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
# 向子进程发送输入
|
||||||
|
process.stdin.write("y\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
# 关闭子进程的stdin,防止它无限期等待更多输入
|
||||||
|
process.stdin.close()
|
||||||
|
# 等待子进程结束
|
||||||
|
process.wait()
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/lib/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/include/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
#out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
|
||||||
|
#print(out)
|
||||||
|
#if out:
|
||||||
|
# print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
|
||||||
|
# leftFile = True
|
||||||
|
#if not leftFile:
|
||||||
|
# print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Windows":
|
||||||
|
process = subprocess.Popen(['unins000','/silent'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
process.wait()
|
||||||
|
time.sleep(10)
|
||||||
|
out = subprocess.getoutput("ls C:\TDengine")
|
||||||
|
print(out)
|
||||||
|
if len(out.split("\n")) > 3:
|
||||||
|
leftFile = True
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
|
||||||
|
if taosBenchmark_test_result:
|
||||||
|
print("**********Test Result: taosBenchmark test passed! **********")
|
||||||
|
if taos_test_result:
|
||||||
|
print("**********Test Result: taos test passed! **********")
|
||||||
|
else:
|
||||||
|
print("!!!!!!!!!!!Test Result: taos test failed! !!!!!!!!!!")
|
||||||
|
if version_test_result:
|
||||||
|
print("**********Test Result: version test passed! **********")
|
||||||
|
else:
|
||||||
|
print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!")
|
||||||
|
if not leftFile:
|
||||||
|
print("**********Test Result: uninstall test passed! **********")
|
||||||
|
else:
|
||||||
|
print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!")
|
||||||
|
if taosBenchmark_test_result and taos_test_result and version_test_result and not leftFile:
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
|
@ -0,0 +1,380 @@
|
||||||
|
def sync_source(branch_name) {
|
||||||
|
sh '''
|
||||||
|
hostname
|
||||||
|
ip addr|grep 192|awk '{print $2}'|sed "s/\\/.*//"
|
||||||
|
echo ''' + branch_name + '''
|
||||||
|
'''
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}
|
||||||
|
set +e
|
||||||
|
git reset --hard
|
||||||
|
git fetch || git fetch
|
||||||
|
git checkout -f '''+branch_name+'''
|
||||||
|
git reset --hard origin/'''+branch_name+'''
|
||||||
|
git log | head -n 20
|
||||||
|
git clean -fxd
|
||||||
|
set -e
|
||||||
|
'''
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
def sync_source_win() {
|
||||||
|
bat '''
|
||||||
|
hostname
|
||||||
|
taskkill /f /t /im taosd.exe
|
||||||
|
ipconfig
|
||||||
|
set
|
||||||
|
date /t
|
||||||
|
time /t
|
||||||
|
'''
|
||||||
|
bat '''
|
||||||
|
echo %branch_name%
|
||||||
|
cd %WIN_TDENGINE_ROOT_DIR%
|
||||||
|
git reset --hard
|
||||||
|
git fetch || git fetch
|
||||||
|
git checkout -f ''' + env.BRANCH_NAME + '''
|
||||||
|
git reset --hard origin/''' + env.BRANCH_NAME + '''
|
||||||
|
git branch
|
||||||
|
git restore .
|
||||||
|
git remote prune origin
|
||||||
|
git pull || git pull
|
||||||
|
git log | head -n 20
|
||||||
|
git clean -fxd
|
||||||
|
'''
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
pipeline {
|
||||||
|
agent none
|
||||||
|
parameters {
|
||||||
|
choice(
|
||||||
|
name: 'sourcePath',
|
||||||
|
choices: ['nas','web'],
|
||||||
|
description: 'Choice which way to download the installation pacakge;web is Office Web and nas means taos nas server '
|
||||||
|
)
|
||||||
|
choice(
|
||||||
|
name: 'verMode',
|
||||||
|
choices: ['enterprise','community'],
|
||||||
|
description: 'Choice which types of package you want do check '
|
||||||
|
)
|
||||||
|
string (
|
||||||
|
name:'version',
|
||||||
|
defaultValue:'3.3.2.0',
|
||||||
|
description: 'Release version number,eg: 3.0.0.1'
|
||||||
|
)
|
||||||
|
string (
|
||||||
|
name:'baseVersion',
|
||||||
|
defaultValue:'smoking',
|
||||||
|
description: 'Tnas root path. eg:smoking, 3.3'
|
||||||
|
)
|
||||||
|
choice (
|
||||||
|
name:'mode',
|
||||||
|
choices: ['server','client'],
|
||||||
|
description: 'Choose which mode of package you want do run '
|
||||||
|
)
|
||||||
|
choice (
|
||||||
|
name:'smoke_branch',
|
||||||
|
choices: ['test/3.0/smokeTest','test/main/smokeTest','test/3.1/smokeTest'],
|
||||||
|
description: 'Choose which mode of package you want do run '
|
||||||
|
)
|
||||||
|
string (
|
||||||
|
name:'runPlatforms',
|
||||||
|
defaultValue:'server_Linux_x64, server_Linux_arm64, server_Windows_x64, server_Mac_x64',
|
||||||
|
description: 'run package list hotfix usually run: server: server_Linux_x64, server_Linux_arm64 client: client_Linux_x64, client_Linux_arm64 release usually run: enterprise server: server_Linux_x64, server_Linux_arm64, server_Windows_x64 enterprise client: client_Linux_x64, client_Linux_arm64, client_Windows_x64 community server: server_Linux_x64, server_Linux_arm64, server_Mac_x64, server_Mac_arm64(not supported), server_Linux_x64_lite(not supported) community client: client_Linux_x64, client_Linux_arm64, client_Windows_x64, client_Mac_x64, client_Mac_arm64(not supported), client_Linux_x64_lite(not supported)'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
environment{
|
||||||
|
WORK_DIR = "/var/lib/jenkins/workspace"
|
||||||
|
TDINTERNAL_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal'
|
||||||
|
TDENGINE_ROOT_DIR = '/var/lib/jenkins/workspace/TDinternal/community'
|
||||||
|
BRANCH_NAME = "${smoke_branch}"
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage ('Start Server for Client Test') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
expression { mode == 'client' }
|
||||||
|
}
|
||||||
|
agent{label " ubuntu18 "}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
withEnv(['JENKINS_NODE_COOKIE=dontkillme']) {
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
bash start3NodesServer.sh
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('Run SmokeTest') {
|
||||||
|
parallel {
|
||||||
|
stage('server_Linux_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'server' }
|
||||||
|
expression { runPlatforms.contains('server_Linux_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " ubuntu16 "}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
python3 -m pytest test_server.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('server_Linux_arm64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'server' }
|
||||||
|
expression { runPlatforms.contains('server_Linux_arm64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label "worker06_arm64"}
|
||||||
|
steps {
|
||||||
|
timeout(time: 60, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
python3 -m pytest test_server.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=600 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=linux_arm64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('server_Mac_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'server' }
|
||||||
|
expression { runPlatforms.contains('server_Mac_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " release_Darwin_x64 "}
|
||||||
|
environment{
|
||||||
|
WORK_DIR = "/Users/zwen/jenkins/workspace"
|
||||||
|
TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
|
||||||
|
TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
|
||||||
|
python3 -m pytest -v -k linux --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('server_Mac_arm64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'server' }
|
||||||
|
expression { runPlatforms.contains('server_Mac_arm64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " release_Darwin_arm64 "}
|
||||||
|
environment{
|
||||||
|
WORK_DIR = "/Users/zwen/jenkins/workspace"
|
||||||
|
TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
|
||||||
|
TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
|
||||||
|
python3 -m pytest -v -k linux --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=server&build=Mac_arm64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('server_Windows_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'server' }
|
||||||
|
expression { runPlatforms.contains('server_Windows_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " windows11 "}
|
||||||
|
environment{
|
||||||
|
WIN_WORK_DIR="C:\\workspace"
|
||||||
|
WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal"
|
||||||
|
WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community"
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source_win()
|
||||||
|
bat '''
|
||||||
|
cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
|
||||||
|
call getAndRunInstaller.bat %baseVersion% %version% %verMode% server
|
||||||
|
cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
|
||||||
|
pip3 install -r pytest_require.txt
|
||||||
|
python3 -m pytest test_server.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath%
|
||||||
|
scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=server&build=Windows_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('client_Linux_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'client' }
|
||||||
|
expression { runPlatforms.contains('client_Linux_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " ubuntu16 "}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
mkdir -p /var/www/html/${baseVersion}/${version}/${verMode}/json
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
python3 -m pytest test_client.py -v --html=/var/www/html/${baseVersion}/${version}/${verMode}/${mode}_linux_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
cp report.json /var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('client_Linux_arm64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'client' }
|
||||||
|
expression { runPlatforms.contains('client_Linux_arm64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " worker06_arm64 "}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
python3 -m pytest test_client.py -v --html=${mode}_linux_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_linux_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_linux_arm64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=linux_arm64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('client_Mac_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'client' }
|
||||||
|
expression { runPlatforms.contains('client_Mac_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " release_Darwin_x64 "}
|
||||||
|
environment{
|
||||||
|
WORK_DIR = "/Users/zwen/jenkins/workspace"
|
||||||
|
TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
|
||||||
|
TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
|
||||||
|
rm -rf /opt/taos/main/TDinternal/debug/* || true
|
||||||
|
python3 -m pytest test_client.py -v --html=${mode}_Mac_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_Mac_x64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('client_Mac_arm64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'client' }
|
||||||
|
expression { runPlatforms.contains('client_Mac_arm64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " release_Darwin_arm64 "}
|
||||||
|
environment{
|
||||||
|
WORK_DIR = "/Users/zwen/jenkins/workspace"
|
||||||
|
TDINTERNAL_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal'
|
||||||
|
TDENGINE_ROOT_DIR = '/Users/zwen/jenkins/workspace/TDinternal/community'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source("${BRANCH_NAME}")
|
||||||
|
sh '''
|
||||||
|
cd ${TDENGINE_ROOT_DIR}/packaging/smokeTest
|
||||||
|
bash getAndRunInstaller.sh -m ${verMode} -f client -l false -c arm64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t pkg
|
||||||
|
rm -rf /opt/taos/main/TDinternal/debug/* || true
|
||||||
|
python3 -m pytest test_client.py -v --html=${mode}_Mac_arm64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=${verMode} --tVersion=${version} --baseVersion=${baseVersion} --sourcePath=${sourcePath} || true
|
||||||
|
scp ${mode}_Mac_arm64_report.html root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/${baseVersion}/${version}/${verMode}/json/${mode}_Mac_arm64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=${version}&tag=${baseVersion}&type=${verMode}&role=client&build=Mac_arm64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('client_Windows_x64') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
allOf {
|
||||||
|
expression { mode == 'client' }
|
||||||
|
expression { runPlatforms.contains('client_Windows_x64') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
agent{label " windows71 "}
|
||||||
|
environment{
|
||||||
|
WIN_WORK_DIR="C:\\workspace"
|
||||||
|
WIN_TDINTERNAL_ROOT_DIR="C:\\workspace\\TDinternal"
|
||||||
|
WIN_TDENGINE_ROOT_DIR="C:\\workspace\\TDinternal\\community"
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
timeout(time: 30, unit: 'MINUTES'){
|
||||||
|
sync_source_win()
|
||||||
|
bat '''
|
||||||
|
cd %WIN_TDENGINE_ROOT_DIR%\\packaging\\smokeTest
|
||||||
|
call getAndRunInstaller.bat %baseVersion% %version% %verMode% client
|
||||||
|
pip3 install -r pytest_require.txt
|
||||||
|
python3 -m pytest test_client.py -v --html=%mode%_Windows_x64_report.html --json-report --json-report-file=report.json --timeout=300 --verMode=%verMode% --tVersion=%version% --baseVersion=%baseVersion% --sourcePath=%sourcePath%
|
||||||
|
scp %mode%_Windows_x64_report.html root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/
|
||||||
|
scp report.json root@192.168.0.21:/var/www/html/%baseVersion%/%version%/%verMode%/json/%mode%_Windows_x64_report.json
|
||||||
|
curl "http://192.168.0.176/api/addSmoke?version=%version%&tag=%baseVersion%&type=%verMode%&role=client&build=Windows_x64"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
BUILD_ID=dontKillMe
|
||||||
|
|
||||||
|
#******This script setup 3 nodes env for remote client installer test. Only for Linux *********
|
||||||
|
|
||||||
|
pwd=`pwd`
|
||||||
|
hostname=`hostname`
|
||||||
|
if [ -z $JENKINS_HOME ]; then
|
||||||
|
workdir="${pwd}/cluster"
|
||||||
|
echo $workdir
|
||||||
|
else
|
||||||
|
workdir="${JENKINS_HOME}/workspace/cluster"
|
||||||
|
echo $workdir
|
||||||
|
fi
|
||||||
|
|
||||||
|
name="taos"
|
||||||
|
if command -v prodb ;then
|
||||||
|
name="prodb"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop all taosd processes
|
||||||
|
for(( i=0; i<3; i++))
|
||||||
|
do
|
||||||
|
pid=$(ps -ef | grep ${name}d | grep -v grep | awk '{print $2}')
|
||||||
|
if [ -n "$pid" ]; then
|
||||||
|
${csudo}kill -9 $pid || :
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Init 3 dnodes workdir and config file
|
||||||
|
rm -rf ${workdir}
|
||||||
|
mkdir ${workdir}
|
||||||
|
mkdir ${workdir}/output
|
||||||
|
mkdir ${workdir}/dnode1
|
||||||
|
mkdir ${workdir}/dnode1/data
|
||||||
|
mkdir ${workdir}/dnode1/log
|
||||||
|
mkdir ${workdir}/dnode1/cfg
|
||||||
|
touch ${workdir}/dnode1/cfg/${name}.cfg
|
||||||
|
echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6031\nlogDir ${workdir}/dnode1/log\ndataDir ${workdir}/dnode1/data\n" >> ${workdir}/dnode1/cfg/${name}.cfg
|
||||||
|
|
||||||
|
# Start first node
|
||||||
|
nohup ${name}d -c ${workdir}/dnode1/cfg/${name}.cfg & > /dev/null
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
${name} -P 6031 -s "CREATE DNODE \`${hostname}:6032\`;CREATE DNODE \`${hostname}:6033\`"
|
||||||
|
|
||||||
|
mkdir ${workdir}/dnode2
|
||||||
|
mkdir ${workdir}/dnode2/data
|
||||||
|
mkdir ${workdir}/dnode2/log
|
||||||
|
mkdir ${workdir}/dnode2/cfg
|
||||||
|
touch ${workdir}/dnode2/cfg/${name}.cfg
|
||||||
|
echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6032\nlogDir ${workdir}/dnode2/log\ndataDir ${workdir}/dnode2/data\n" >> ${workdir}/dnode2/cfg/${name}.cfg
|
||||||
|
|
||||||
|
nohup ${name}d -c ${workdir}/dnode2/cfg/${name}.cfg & > /dev/null
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
mkdir ${workdir}/dnode3
|
||||||
|
mkdir ${workdir}/dnode3/data
|
||||||
|
mkdir ${workdir}/dnode3/log
|
||||||
|
mkdir ${workdir}/dnode3/cfg
|
||||||
|
touch ${workdir}/dnode3/cfg/${name}.cfg
|
||||||
|
echo -e "firstEp ${hostname}:6031\nsecondEp ${hostname}:6032\nfqdn ${hostname}\nserverPort 6033\nlogDir ${workdir}/dnode3/log\ndataDir ${workdir}/dnode3/data\n" >> ${workdir}/dnode3/cfg/${name}.cfg
|
||||||
|
|
||||||
|
nohup ${name}d -c ${workdir}/dnode3/cfg/${name}.cfg & > /dev/null
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
${name} -P 6031 -s "CREATE MNODE ON DNODE 2;CREATE MNODE ON DNODE 3;"
|
|
@ -0,0 +1,137 @@
|
||||||
|
import pytest
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import platform
|
||||||
|
import getopt
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import taos
|
||||||
|
from versionCheckAndUninstallforPytest import UninstallTaos
|
||||||
|
|
||||||
|
# python3 smokeTestClient.py -h 192.168.0.22 -P 6031 -v ${version} -u
|
||||||
|
|
||||||
|
OEM = ["ProDB"]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def get_config(request):
|
||||||
|
verMode = request.config.getoption("--verMode")
|
||||||
|
taosVersion = request.config.getoption("--tVersion")
|
||||||
|
baseVersion = request.config.getoption("--baseVersion")
|
||||||
|
sourcePath = request.config.getoption("--sourcePath")
|
||||||
|
config = {
|
||||||
|
"verMode": verMode,
|
||||||
|
"taosVersion": taosVersion,
|
||||||
|
"baseVersion": baseVersion,
|
||||||
|
"sourcePath": sourcePath,
|
||||||
|
"system": platform.system(),
|
||||||
|
"arch": platform.machine(),
|
||||||
|
"serverHost": "192.168.0.22",
|
||||||
|
"serverPort": 6031,
|
||||||
|
"databaseName": re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def setup_module(get_config):
|
||||||
|
config = get_config
|
||||||
|
# install taospy
|
||||||
|
if config["system"] == 'Windows':
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
|
||||||
|
else:
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
|
||||||
|
|
||||||
|
print("taospy version %s " % taospy_version)
|
||||||
|
if taospy_version == "":
|
||||||
|
subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
|
||||||
|
print("install taos python connector")
|
||||||
|
else:
|
||||||
|
subprocess.getoutput("pip3 install taospy")
|
||||||
|
|
||||||
|
|
||||||
|
def get_connect(host, port, database=None):
|
||||||
|
conn = taos.connect(host=host,
|
||||||
|
user="root",
|
||||||
|
password="taosdata",
|
||||||
|
database=database,
|
||||||
|
port=port,
|
||||||
|
timezone="Asia/Shanghai") # default your host's timezone
|
||||||
|
return conn
|
||||||
|
|
||||||
|
|
||||||
|
def run_cmd(command):
|
||||||
|
print("CMD: %s" % command)
|
||||||
|
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
||||||
|
print("STDOUT:", result.stdout)
|
||||||
|
print("STDERR:", result.stderr)
|
||||||
|
print("Return Code:", result.returncode)
|
||||||
|
assert result.returncode == 0
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class TestClient:
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_basic(self, get_config, setup_module):
|
||||||
|
config = get_config
|
||||||
|
name = "taos"
|
||||||
|
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
name = config["baseVersion"].lower()
|
||||||
|
if config["baseVersion"] in OEM and config["system"] == 'Windows':
|
||||||
|
cmd = f'{name} -s "create database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}'
|
||||||
|
run_cmd(cmd)
|
||||||
|
cmd = f'{name} -s "CREATE STABLE {config["databaseName"]}.meters (`ts` TIMESTAMP,`current` FLOAT, `phase` FLOAT) TAGS (`groupid` INT, `location` VARCHAR(24));" -h {config["serverHost"]} -P {config["serverPort"]}'
|
||||||
|
run_cmd(cmd)
|
||||||
|
else:
|
||||||
|
cmd = f'{name}Benchmark -y -a 3 -n 100 -t 100 -d {config["databaseName"]} -h {config["serverHost"]} -P {config["serverPort"]} &'
|
||||||
|
run_cmd(cmd)
|
||||||
|
# os.system("taosBenchmark -y -a 3 -n 100 -t 100 -d %s -h %s -P %d" % (databaseName, serverHost, serverPort))
|
||||||
|
time.sleep(5)
|
||||||
|
conn = get_connect(config["serverHost"], config["serverPort"], config["databaseName"])
|
||||||
|
sql = "SELECT count(*) from meters"
|
||||||
|
result: taos.TaosResult = conn.query(sql)
|
||||||
|
data = result.fetch_all()
|
||||||
|
print("SQL: %s" % sql)
|
||||||
|
print("Result: %s" % data)
|
||||||
|
if config["system"] == 'Windows' and config["baseVersion"] in OEM:
|
||||||
|
pass
|
||||||
|
elif data[0][0] != 10000:
|
||||||
|
raise f"{name}Benchmark work not as expected "
|
||||||
|
# drop database of test
|
||||||
|
cmd = f'{name} -s "drop database {config["databaseName"]};" -h {config["serverHost"]} -P {config["serverPort"]}'
|
||||||
|
result = run_cmd(cmd)
|
||||||
|
assert "Drop OK" in result.stdout
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_version(self, get_config, setup_module):
|
||||||
|
config = get_config
|
||||||
|
conn = get_connect(config["serverHost"], config["serverPort"])
|
||||||
|
server_version = conn.server_info
|
||||||
|
print("server_version: ", server_version)
|
||||||
|
client_version = conn.client_info
|
||||||
|
print("client_version: ", client_version)
|
||||||
|
name = "taos"
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
name = config["baseVersion"].lower()
|
||||||
|
if config["system"] == "Windows":
|
||||||
|
taos_V_output = subprocess.getoutput(f"{name} -V | findstr version")
|
||||||
|
else:
|
||||||
|
taos_V_output = subprocess.getoutput(f"{name} -V | grep version")
|
||||||
|
assert config["taosVersion"] in taos_V_output
|
||||||
|
assert config["taosVersion"] in client_version
|
||||||
|
if config["taosVersion"] not in server_version:
|
||||||
|
print("warning: client version is not same as server version")
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_uninstall(self, get_config, setup_module):
|
||||||
|
config = get_config
|
||||||
|
name = "taos"
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
name = config["baseVersion"].lower()
|
||||||
|
subprocess.getoutput("rm /usr/local/bin/taos")
|
||||||
|
subprocess.getoutput("pkill taosd")
|
||||||
|
UninstallTaos(config["taosVersion"], config["verMode"], True, name)
|
|
@ -0,0 +1,238 @@
|
||||||
|
import pytest
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
from versionCheckAndUninstallforPytest import UninstallTaos
|
||||||
|
import platform
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import signal
|
||||||
|
|
||||||
|
system = platform.system()
|
||||||
|
current_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
if system == 'Windows':
|
||||||
|
with open(r"%s\test_server_windows_case" % current_path) as f:
|
||||||
|
cases = f.read().splitlines()
|
||||||
|
else:
|
||||||
|
with open("%s/test_server_unix_case" % current_path) as f:
|
||||||
|
cases = f.read().splitlines()
|
||||||
|
|
||||||
|
OEM = ["ProDB"]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def get_config(request):
|
||||||
|
verMode = request.config.getoption("--verMode")
|
||||||
|
taosVersion = request.config.getoption("--tVersion")
|
||||||
|
baseVersion = request.config.getoption("--baseVersion")
|
||||||
|
sourcePath = request.config.getoption("--sourcePath")
|
||||||
|
config = {
|
||||||
|
"verMode": verMode,
|
||||||
|
"taosVersion": taosVersion,
|
||||||
|
"baseVersion": baseVersion,
|
||||||
|
"sourcePath": sourcePath,
|
||||||
|
"system": platform.system(),
|
||||||
|
"arch": platform.machine()
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def setup_module(get_config):
|
||||||
|
def run_cmd(command):
|
||||||
|
print("CMD:", command)
|
||||||
|
result = subprocess.run(command, capture_output=True, text=True, shell=True)
|
||||||
|
print("STDOUT:", result.stdout)
|
||||||
|
print("STDERR:", result.stderr)
|
||||||
|
print("Return Code:", result.returncode)
|
||||||
|
assert result.returncode == 0
|
||||||
|
return result
|
||||||
|
|
||||||
|
# setup before module tests
|
||||||
|
config = get_config
|
||||||
|
# bash getAndRunInstaller.sh -m ${verMode} -f server -l false -c x64 -v ${version} -o ${baseVersion} -s ${sourcePath} -t tar
|
||||||
|
# t = "tar"
|
||||||
|
# if config["system"] == "Darwin":
|
||||||
|
# t = "pkg"
|
||||||
|
# cmd = "bash getAndRunInstaller.sh -m %s -f server -l false -c x64 -v %s -o %s -s %s -t %s" % (
|
||||||
|
# config["verMode"], config["taosVersion"], config["baseVersion"], config["sourcePath"], t)
|
||||||
|
# run_cmd(cmd)
|
||||||
|
if config["system"] == "Windows":
|
||||||
|
cmd = r"mkdir ..\..\debug\build\bin"
|
||||||
|
else:
|
||||||
|
cmd = "mkdir -p ../../debug/build/bin/"
|
||||||
|
subprocess.getoutput(cmd)
|
||||||
|
if config["system"] == "Linux": # add tmq_sim
|
||||||
|
cmd = "cp -rf ../../../debug/build/bin/tmq_sim ../../debug/build/bin/."
|
||||||
|
subprocess.getoutput(cmd)
|
||||||
|
if config["system"] == "Darwin":
|
||||||
|
cmd = "sudo cp -rf /usr/local/bin/taos* ../../debug/build/bin/"
|
||||||
|
elif config["system"] == "Windows":
|
||||||
|
cmd = r"xcopy C:\TDengine\taos*.exe ..\..\debug\build\bin /Y"
|
||||||
|
else:
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
cmd = '''sudo find /usr/bin -name 'prodb*' -exec sh -c 'for file; do cp "$file" "../../debug/build/bin/taos${file##/usr/bin/%s}"; done' sh {} +''' % (
|
||||||
|
config["baseVersion"].lower())
|
||||||
|
else:
|
||||||
|
cmd = "sudo cp /usr/bin/taos* ../../debug/build/bin/"
|
||||||
|
run_cmd(cmd)
|
||||||
|
if config["baseVersion"] in OEM: # mock OEM
|
||||||
|
cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower()
|
||||||
|
run_cmd(cmd)
|
||||||
|
cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/pytest/util/dnodes.py" % config["baseVersion"].lower()
|
||||||
|
run_cmd(cmd)
|
||||||
|
cmd = "sed -i 's/taos.cfg/%s.cfg/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower()
|
||||||
|
run_cmd(cmd)
|
||||||
|
cmd = "sed -i 's/taosdlog.0/%sdlog.0/g' ../../tests/army/frame/server/dnode.py" % config["baseVersion"].lower()
|
||||||
|
run_cmd(cmd)
|
||||||
|
cmd = "ln -s /usr/bin/prodb /usr/local/bin/taos"
|
||||||
|
subprocess.getoutput(cmd)
|
||||||
|
|
||||||
|
# yield
|
||||||
|
#
|
||||||
|
# name = "taos"
|
||||||
|
# if config["baseVersion"] in OEM:
|
||||||
|
# name = config["baseVersion"].lower()
|
||||||
|
# subprocess.getoutput("rm /usr/local/bin/taos")
|
||||||
|
# subprocess.getoutput("pkill taosd")
|
||||||
|
# UninstallTaos(config["taosVersion"], config["verMode"], True, name)
|
||||||
|
|
||||||
|
|
||||||
|
# use pytest fixture to exec case
|
||||||
|
@pytest.fixture(params=cases)
|
||||||
|
def run_command(request):
|
||||||
|
commands = request.param
|
||||||
|
if commands.strip().startswith("#"):
|
||||||
|
pytest.skip("This case has been marked as skipped")
|
||||||
|
d, command = commands.strip().split(",")
|
||||||
|
if system == "Windows":
|
||||||
|
cmd = r"cd %s\..\..\tests\%s && %s" % (current_path, d, command)
|
||||||
|
else:
|
||||||
|
cmd = "cd %s/../../tests/%s&&sudo %s" % (current_path, d, command)
|
||||||
|
print(cmd)
|
||||||
|
result = subprocess.run(cmd, capture_output=True, text=True, shell=True)
|
||||||
|
return {
|
||||||
|
"command": command,
|
||||||
|
"stdout": result.stdout,
|
||||||
|
"stderr": result.stderr,
|
||||||
|
"returncode": result.returncode
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestServer:
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_taosd_up(self, setup_module):
|
||||||
|
# start process
|
||||||
|
if system == 'Windows':
|
||||||
|
subprocess.getoutput("taskkill /IM taosd.exe /F")
|
||||||
|
cmd = "..\\..\\debug\\build\\bin\\taosd.exe"
|
||||||
|
else:
|
||||||
|
subprocess.getoutput("pkill taosd")
|
||||||
|
cmd = "../../debug/build/bin/taosd"
|
||||||
|
process = subprocess.Popen(
|
||||||
|
[cmd],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
text=True
|
||||||
|
)
|
||||||
|
# monitor output
|
||||||
|
while True:
|
||||||
|
line = process.stdout.readline()
|
||||||
|
if line:
|
||||||
|
print(line.strip())
|
||||||
|
if "succeed to write dnode" in line:
|
||||||
|
time.sleep(15)
|
||||||
|
# 发送终止信号
|
||||||
|
os.kill(process.pid, signal.SIGTERM)
|
||||||
|
break
|
||||||
|
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_execute_cases(self, setup_module, run_command):
|
||||||
|
# assert the result
|
||||||
|
if run_command['returncode'] != 0:
|
||||||
|
print(f"Running command: {run_command['command']}")
|
||||||
|
print("STDOUT:", run_command['stdout'])
|
||||||
|
print("STDERR:", run_command['stderr'])
|
||||||
|
print("Return Code:", run_command['returncode'])
|
||||||
|
else:
|
||||||
|
print(f"Running command: {run_command['command']}")
|
||||||
|
if len(run_command['stdout']) > 1000:
|
||||||
|
print("STDOUT:", run_command['stdout'][:1000] + "...")
|
||||||
|
else:
|
||||||
|
print("STDOUT:", run_command['stdout'])
|
||||||
|
print("STDERR:", run_command['stderr'])
|
||||||
|
print("Return Code:", run_command['returncode'])
|
||||||
|
|
||||||
|
assert run_command[
|
||||||
|
'returncode'] == 0, f"Command '{run_command['command']}' failed with return code {run_command['returncode']}"
|
||||||
|
|
||||||
|
@pytest.mark.all
|
||||||
|
@pytest.mark.check_version
|
||||||
|
def test_check_version(self, get_config, setup_module):
|
||||||
|
config = get_config
|
||||||
|
databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
|
||||||
|
# install taospy
|
||||||
|
taospy_version = ""
|
||||||
|
system = config["system"]
|
||||||
|
version = config["taosVersion"]
|
||||||
|
verMode = config["verMode"]
|
||||||
|
if system == 'Windows':
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
|
||||||
|
else:
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
|
||||||
|
|
||||||
|
print("taospy version %s " % taospy_version)
|
||||||
|
if taospy_version == "":
|
||||||
|
subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
|
||||||
|
print("install taos python connector")
|
||||||
|
else:
|
||||||
|
subprocess.getoutput("pip3 install taospy")
|
||||||
|
|
||||||
|
# start taosd server
|
||||||
|
if system == 'Windows':
|
||||||
|
cmd = ["C:\\TDengine\\start-all.bat"]
|
||||||
|
# elif system == 'Linux':
|
||||||
|
# cmd = "systemctl start taosd".split(' ')
|
||||||
|
else:
|
||||||
|
# cmd = "sudo launchctl start com.tdengine.taosd".split(' ')
|
||||||
|
cmd = "start-all.sh"
|
||||||
|
process_out = subprocess.Popen(cmd,
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
print(cmd)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
import taos
|
||||||
|
conn = taos.connect()
|
||||||
|
check_list = {}
|
||||||
|
check_list["server_version"] = conn.server_info
|
||||||
|
check_list["client_version"] = conn.client_info
|
||||||
|
# Execute sql get version info
|
||||||
|
result: taos.TaosResult = conn.query("SELECT server_version()")
|
||||||
|
check_list["select_server"] = result.fetch_all()[0][0]
|
||||||
|
result: taos.TaosResult = conn.query("SELECT client_version()")
|
||||||
|
check_list["select_client"] = result.fetch_all()[0][0]
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
binary_files = ["taos", "taosd", "taosadapter", "taoskeeper", "taosBenchmark"]
|
||||||
|
if verMode.lower() == "enterprise":
|
||||||
|
binary_files.append("taosx")
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
binary_files = [i.replace("taos", config["baseVersion"].lower()) for i in binary_files]
|
||||||
|
if system == "Windows":
|
||||||
|
for i in binary_files:
|
||||||
|
check_list[i] = subprocess.getoutput("%s -V | findstr version" % i)
|
||||||
|
else:
|
||||||
|
for i in binary_files:
|
||||||
|
check_list[i] = subprocess.getoutput("%s -V | grep version | awk -F ' ' '{print $3}'" % i)
|
||||||
|
for i in check_list:
|
||||||
|
print("%s version is: %s" % (i, check_list[i]))
|
||||||
|
assert version in check_list[i]
|
||||||
|
|
||||||
|
@pytest.mark.all
|
||||||
|
def test_uninstall(self, get_config, setup_module):
|
||||||
|
config = get_config
|
||||||
|
name = "taos"
|
||||||
|
if config["baseVersion"] in OEM:
|
||||||
|
name = config["baseVersion"].lower()
|
||||||
|
subprocess.getoutput("rm /usr/local/bin/taos")
|
||||||
|
subprocess.getoutput("pkill taosd")
|
||||||
|
UninstallTaos(config["taosVersion"], config["verMode"], True, name)
|
|
@ -0,0 +1,10 @@
|
||||||
|
system-test,python3 ./test.py -f 2-query/join.py
|
||||||
|
system-test,python3 ./test.py -f 1-insert/insert_column_value.py
|
||||||
|
system-test,python3 ./test.py -f 2-query/primary_ts_base_5.py
|
||||||
|
system-test,python3 ./test.py -f 2-query/case_when.py
|
||||||
|
system-test,python3 ./test.py -f 2-query/partition_limit_interval.py
|
||||||
|
system-test,python3 ./test.py -f 2-query/fill.py
|
||||||
|
army,python3 ./test.py -f query/query_basic.py -N 3
|
||||||
|
system-test,python3 ./test.py -f 7-tmq/basic5.py
|
||||||
|
system-test,python3 ./test.py -f 8-stream/stream_basic.py
|
||||||
|
system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
|
|
@ -0,0 +1,2 @@
|
||||||
|
system-test,python3 .\test.py -f 0-others\taosShell.py
|
||||||
|
system-test,python3 .\test.py -f 6-cluster\5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -N 6 -M 3
|
|
@ -0,0 +1,260 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
# install pip
|
||||||
|
# pip install src/connector/python/
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, os
|
||||||
|
import re
|
||||||
|
import platform
|
||||||
|
import getopt
|
||||||
|
import subprocess
|
||||||
|
# from this import d
|
||||||
|
import time
|
||||||
|
|
||||||
|
# input for server
|
||||||
|
|
||||||
|
opts, args = getopt.gnu_getopt(sys.argv[1:], 'v:m:u', ['version=', 'verMode='])
|
||||||
|
serverHost = ""
|
||||||
|
serverPort = 0
|
||||||
|
version = ""
|
||||||
|
uninstall = False
|
||||||
|
verMode = ""
|
||||||
|
for key, value in opts:
|
||||||
|
if key in ['--help']:
|
||||||
|
print('A collection of test cases written using Python')
|
||||||
|
print('-v test client version')
|
||||||
|
print('-u test uninstall process, will uninstall TDengine')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
if key in ['-v']:
|
||||||
|
version = value
|
||||||
|
if key in ['-u']:
|
||||||
|
uninstall = True
|
||||||
|
if key in ['-m']:
|
||||||
|
verMode = value
|
||||||
|
if not version:
|
||||||
|
print("No version specified, will not run version check.")
|
||||||
|
|
||||||
|
|
||||||
|
system = platform.system()
|
||||||
|
arch = platform.machine()
|
||||||
|
|
||||||
|
databaseName = re.sub(r'[^a-zA-Z0-9]', '', subprocess.getoutput("hostname")).lower()
|
||||||
|
# install taospy
|
||||||
|
taospy_version = ""
|
||||||
|
if system == 'Windows':
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|findstr Version")
|
||||||
|
else:
|
||||||
|
taospy_version = subprocess.getoutput("pip3 show taospy|grep Version| awk -F ':' '{print $2}' ")
|
||||||
|
|
||||||
|
print("taospy version %s " % taospy_version)
|
||||||
|
if taospy_version == "":
|
||||||
|
subprocess.getoutput("pip3 install git+https://github.com/taosdata/taos-connector-python.git")
|
||||||
|
print("install taos python connector")
|
||||||
|
else:
|
||||||
|
subprocess.getoutput("pip3 install taospy")
|
||||||
|
|
||||||
|
# start taosd server
|
||||||
|
if system == 'Windows':
|
||||||
|
cmd = ["C:\\TDengine\\start-all.bat"]
|
||||||
|
elif system == 'Linux':
|
||||||
|
cmd = "systemctl start taosd".split(' ')
|
||||||
|
else:
|
||||||
|
cmd = "sudo launchctl start com.tdengine.taosd".split(' ')
|
||||||
|
process_out = subprocess.Popen(cmd,
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
print(cmd)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
#get taosc version info
|
||||||
|
version_test_result = False
|
||||||
|
if version:
|
||||||
|
import taos
|
||||||
|
conn = taos.connect()
|
||||||
|
server_version = conn.server_info
|
||||||
|
print("server_version", server_version)
|
||||||
|
client_version = conn.client_info
|
||||||
|
print("client_version", client_version)
|
||||||
|
# Execute sql get version info
|
||||||
|
result: taos.TaosResult = conn.query("SELECT server_version()")
|
||||||
|
select_server = result.fetch_all()[0][0]
|
||||||
|
print("SELECT server_version():" + select_server)
|
||||||
|
result: taos.TaosResult = conn.query("SELECT client_version()")
|
||||||
|
select_client = result.fetch_all()[0][0]
|
||||||
|
print("SELECT client_version():" + select_client)
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
taos_V_output = ""
|
||||||
|
taosd_V_output = ""
|
||||||
|
taosadapter_V_output = ""
|
||||||
|
taoskeeper_V_output = ""
|
||||||
|
taosx_V_output = ""
|
||||||
|
taosB_V_output = ""
|
||||||
|
taosxVersion = False
|
||||||
|
if system == "Windows":
|
||||||
|
taos_V_output = subprocess.getoutput("taos -V | findstr version")
|
||||||
|
taosd_V_output = subprocess.getoutput("taosd -V | findstr version")
|
||||||
|
taosadapter_V_output = subprocess.getoutput("taosadapter -V | findstr version")
|
||||||
|
taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | findstr version")
|
||||||
|
taosB_V_output = subprocess.getoutput("taosBenchmark -V | findstr version")
|
||||||
|
if verMode == "Enterprise":
|
||||||
|
taosx_V_output = subprocess.getoutput("taosx -V | findstr version")
|
||||||
|
else:
|
||||||
|
taos_V_output = subprocess.getoutput("taos -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
taosd_V_output = subprocess.getoutput("taosd -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
taosadapter_V_output = subprocess.getoutput("taosadapter -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
taoskeeper_V_output = subprocess.getoutput("taoskeeper -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
taosB_V_output = subprocess.getoutput("taosBenchmark -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
if verMode == "Enterprise":
|
||||||
|
taosx_V_output = subprocess.getoutput("taosx -V | grep version | awk -F ' ' '{print $3}'")
|
||||||
|
|
||||||
|
print("taos -V output is: %s" % taos_V_output)
|
||||||
|
print("taosd -V output is: %s" % taosd_V_output)
|
||||||
|
print("taosadapter -V output is: %s" % taosadapter_V_output)
|
||||||
|
print("taoskeeper -V output is: %s" % taoskeeper_V_output)
|
||||||
|
print("taosBenchmark -V output is: %s" % taosB_V_output)
|
||||||
|
if verMode == "Enterprise":
|
||||||
|
print("taosx -V output is: %s" % taosx_V_output)
|
||||||
|
taosxVersion = version in taosx_V_output
|
||||||
|
else:
|
||||||
|
taosxVersion = True
|
||||||
|
if (version in client_version
|
||||||
|
and version in server_version
|
||||||
|
and version in select_server
|
||||||
|
and version in select_client
|
||||||
|
and version in taos_V_output
|
||||||
|
and version in taosd_V_output
|
||||||
|
and version in taosadapter_V_output
|
||||||
|
and version in taoskeeper_V_output
|
||||||
|
and version in taosB_V_output
|
||||||
|
and taosxVersion
|
||||||
|
):
|
||||||
|
version_test_result = True
|
||||||
|
leftFile = False
|
||||||
|
if uninstall:
|
||||||
|
print("Start to run rmtaos")
|
||||||
|
print("Platform: ", system)
|
||||||
|
# stop taosd server
|
||||||
|
if system == 'Windows':
|
||||||
|
cmd = "C:\\TDengine\\stop_all.bat"
|
||||||
|
elif system == 'Linux':
|
||||||
|
cmd = "systemctl stop taosd"
|
||||||
|
else:
|
||||||
|
cmd = "sudo launchctl stop com.tdengine.taosd"
|
||||||
|
process_out = subprocess.getoutput(cmd)
|
||||||
|
print(cmd)
|
||||||
|
time.sleep(10)
|
||||||
|
if system == "Linux":
|
||||||
|
# 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
|
||||||
|
process = subprocess.Popen(['rmtaos'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
# 向子进程发送输入
|
||||||
|
process.stdin.write("y\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
# 关闭子进程的stdin,防止它无限期等待更多输入
|
||||||
|
process.stdin.close()
|
||||||
|
# 等待子进程结束
|
||||||
|
process.wait()
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /etc/systemd/system/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib64/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/include/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/taos")
|
||||||
|
#print(out)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files in /usr/local/taos:%s" % out)
|
||||||
|
leftFile = True
|
||||||
|
if not leftFile:
|
||||||
|
print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Darwin":
|
||||||
|
# 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
|
||||||
|
process = subprocess.Popen(['sudo', 'rmtaos'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
# 向子进程发送输入
|
||||||
|
process.stdin.write("y\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
# 关闭子进程的stdin,防止它无限期等待更多输入
|
||||||
|
process.stdin.close()
|
||||||
|
# 等待子进程结束
|
||||||
|
process.wait()
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/lib/libtaos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/include/taos*")
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
#out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
|
||||||
|
#print(out)
|
||||||
|
#if out:
|
||||||
|
# print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
|
||||||
|
# leftFile = True
|
||||||
|
#if not leftFile:
|
||||||
|
# print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Windows":
|
||||||
|
process = subprocess.Popen(['unins000','/silent'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
process.wait()
|
||||||
|
time.sleep(10)
|
||||||
|
out = subprocess.getoutput("ls C:\TDengine")
|
||||||
|
print(out)
|
||||||
|
if len(out.split("\n")) > 3:
|
||||||
|
leftFile = True
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
|
||||||
|
if version_test_result:
|
||||||
|
print("**********Test Result: version test passed! **********")
|
||||||
|
else:
|
||||||
|
print("!!!!!!!!!!!Test Result: version test failed! !!!!!!!!!!")
|
||||||
|
if not leftFile:
|
||||||
|
print("**********Test Result: uninstall test passed! **********")
|
||||||
|
else:
|
||||||
|
print("!!!!!!!!!!!Test Result: uninstall test failed! !!!!!!!!!!")
|
||||||
|
if version_test_result and not leftFile:
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
# install pip
|
||||||
|
# pip install src/connector/python/
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys, os
|
||||||
|
import re
|
||||||
|
import platform
|
||||||
|
import getopt
|
||||||
|
import subprocess
|
||||||
|
# from this import d
|
||||||
|
import time
|
||||||
|
from lib import run_cmd
|
||||||
|
|
||||||
|
|
||||||
|
# input for server
|
||||||
|
def UninstallTaos(version, verMode, uninstall, name):
|
||||||
|
if not version:
|
||||||
|
raise "No version specified, will not run version check."
|
||||||
|
|
||||||
|
system = platform.system()
|
||||||
|
arch = platform.machine()
|
||||||
|
leftFile = False
|
||||||
|
if uninstall:
|
||||||
|
print("Start to run rm%s" % name)
|
||||||
|
print("Platform: ", system)
|
||||||
|
# stop taosd server
|
||||||
|
if system == 'Windows':
|
||||||
|
cmd = "C:\\TDengine\\stop_all.bat"
|
||||||
|
else:
|
||||||
|
cmd = "stop_all.sh"
|
||||||
|
process_out = subprocess.getoutput(cmd)
|
||||||
|
print(cmd)
|
||||||
|
time.sleep(5)
|
||||||
|
print("start to rm%s" % name)
|
||||||
|
if system == "Linux":
|
||||||
|
# 启动命令
|
||||||
|
process = subprocess.Popen(['rm%s' % name], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE, text=True)
|
||||||
|
|
||||||
|
# 发送交互输入
|
||||||
|
stdout, stderr = process.communicate(
|
||||||
|
input="y\nI confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
|
||||||
|
# 打印输出(可选)
|
||||||
|
print(stdout)
|
||||||
|
print(stderr)
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /etc/systemd/system/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/bin/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib/lib%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/lib64/lib%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/include/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/%s" % name)
|
||||||
|
# print(out)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files in /usr/local/%s:%s" % (name, out))
|
||||||
|
leftFile = True
|
||||||
|
if not leftFile:
|
||||||
|
print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Darwin":
|
||||||
|
# 创建一个subprocess.Popen对象,并使用stdin和stdout进行交互
|
||||||
|
process = subprocess.Popen(['sudo', 'rm%s' % name],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
# 向子进程发送输入
|
||||||
|
process.stdin.write("y\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
process.stdin.write("I confirm that I would like to delete all data, log and configuration files\n")
|
||||||
|
process.stdin.flush() # 确保输入被发送到子进程
|
||||||
|
# 关闭子进程的stdin,防止它无限期等待更多输入
|
||||||
|
process.stdin.close()
|
||||||
|
# 等待子进程结束
|
||||||
|
process.wait()
|
||||||
|
# 检查目录清除情况
|
||||||
|
out = subprocess.getoutput("ls /usr/local/bin/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/lib/lib%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
out = subprocess.getoutput("ls /usr/local/include/%s*" % name)
|
||||||
|
if "No such file or directory" not in out:
|
||||||
|
print("Uninstall left some files: %s" % out)
|
||||||
|
leftFile = True
|
||||||
|
# out = subprocess.getoutput("ls /usr/local/Cellar/tdengine/")
|
||||||
|
# print(out)
|
||||||
|
# if out:
|
||||||
|
# print("Uninstall left some files: /usr/local/Cellar/tdengine/%s" % out)
|
||||||
|
# leftFile = True
|
||||||
|
# if not leftFile:
|
||||||
|
# print("*******Test Result: uninstall test passed ************")
|
||||||
|
|
||||||
|
elif system == "Windows":
|
||||||
|
process = subprocess.Popen(['unins000', '/silent'],
|
||||||
|
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
|
||||||
|
process.wait()
|
||||||
|
time.sleep(10)
|
||||||
|
for file in ["C:\TDengine\\taos.exe", "C:\TDengine\\unins000.exe", "C:\ProDB\prodb.exe",
|
||||||
|
"C:\ProDB\\unins000.exe"]:
|
||||||
|
if os.path.exists(file):
|
||||||
|
leftFile = True
|
||||||
|
if leftFile:
|
||||||
|
raise "uninstall %s fail, please check" % name
|
||||||
|
else:
|
||||||
|
print("**********Test Result: uninstall test passed! **********")
|
|
@ -145,7 +145,14 @@ function kill_taosd() {
|
||||||
|
|
||||||
function install_main_path() {
|
function install_main_path() {
|
||||||
#create install main dir and all sub dir
|
#create install main dir and all sub dir
|
||||||
${csudo}rm -rf ${install_main_dir} || :
|
${csudo}rm -rf ${install_main_dir}/cfg || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/bin || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/driver || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/examples || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/include || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/share || :
|
||||||
|
${csudo}rm -rf ${install_main_dir}/log || :
|
||||||
|
|
||||||
${csudo}mkdir -p ${install_main_dir}
|
${csudo}mkdir -p ${install_main_dir}
|
||||||
${csudo}mkdir -p ${install_main_dir}/cfg
|
${csudo}mkdir -p ${install_main_dir}/cfg
|
||||||
${csudo}mkdir -p ${install_main_dir}/bin
|
${csudo}mkdir -p ${install_main_dir}/bin
|
||||||
|
|
|
@ -29,6 +29,12 @@ TARGET_LINK_LIBRARIES(
|
||||||
# PUBLIC os util common transport monitor parser catalog scheduler function gtest taos_static qcom executor
|
# PUBLIC os util common transport monitor parser catalog scheduler function gtest taos_static qcom executor
|
||||||
#)
|
#)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(userOperTest ../../../tests/script/api/passwdTest.c)
|
||||||
|
TARGET_LINK_LIBRARIES(
|
||||||
|
userOperTest
|
||||||
|
PUBLIC taos
|
||||||
|
)
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(
|
TARGET_INCLUDE_DIRECTORIES(
|
||||||
clientTest
|
clientTest
|
||||||
PUBLIC "${TD_SOURCE_DIR}/include/client/"
|
PUBLIC "${TD_SOURCE_DIR}/include/client/"
|
||||||
|
@ -69,3 +75,8 @@ add_test(
|
||||||
# NAME clientMonitorTest
|
# NAME clientMonitorTest
|
||||||
# COMMAND clientMonitorTest
|
# COMMAND clientMonitorTest
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME userOperTest
|
||||||
|
COMMAND userOperTest
|
||||||
|
)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#define TD_MSG_RANGE_CODE_
|
#define TD_MSG_RANGE_CODE_
|
||||||
#include "tmsgdef.h"
|
#include "tmsgdef.h"
|
||||||
|
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tcol.h"
|
#include "tcol.h"
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
|
|
||||||
|
@ -2166,7 +2166,7 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
|
||||||
int32_t numOfAlgos = 0;
|
int32_t numOfAlgos = 0;
|
||||||
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalUrl *pUrl = pIter;
|
SAnalyticsUrl *pUrl = pIter;
|
||||||
size_t nameLen = 0;
|
size_t nameLen = 0;
|
||||||
const char *name = taosHashGetKey(pIter, &nameLen);
|
const char *name = taosHashGetKey(pIter, &nameLen);
|
||||||
if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_KEY_LEN && pUrl->urlLen > 0) {
|
if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_KEY_LEN && pUrl->urlLen > 0) {
|
||||||
|
@ -2181,7 +2181,7 @@ int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAl
|
||||||
|
|
||||||
pIter = taosHashIterate(pRsp->hash, NULL);
|
pIter = taosHashIterate(pRsp->hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalUrl *pUrl = pIter;
|
SAnalyticsUrl *pUrl = pIter;
|
||||||
size_t nameLen = 0;
|
size_t nameLen = 0;
|
||||||
const char *name = taosHashGetKey(pIter, &nameLen);
|
const char *name = taosHashGetKey(pIter, &nameLen);
|
||||||
if (nameLen > 0 && pUrl->urlLen > 0) {
|
if (nameLen > 0 && pUrl->urlLen > 0) {
|
||||||
|
@ -2225,7 +2225,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
|
||||||
int32_t nameLen;
|
int32_t nameLen;
|
||||||
int32_t type;
|
int32_t type;
|
||||||
char name[TSDB_ANAL_ALGO_KEY_LEN];
|
char name[TSDB_ANAL_ALGO_KEY_LEN];
|
||||||
SAnalUrl url = {0};
|
SAnalyticsUrl url = {0};
|
||||||
|
|
||||||
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
TAOS_CHECK_EXIT(tStartDecode(&decoder));
|
||||||
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ver));
|
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ver));
|
||||||
|
@ -2245,7 +2245,7 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
|
||||||
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&url.url, NULL) < 0);
|
TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&url.url, NULL) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalUrl)));
|
TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalyticsUrl)));
|
||||||
}
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
@ -2258,7 +2258,7 @@ _exit:
|
||||||
void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp *pRsp) {
|
void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp *pRsp) {
|
||||||
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
void *pIter = taosHashIterate(pRsp->hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalUrl *pUrl = (SAnalUrl *)pIter;
|
SAnalyticsUrl *pUrl = (SAnalyticsUrl *)pIter;
|
||||||
taosMemoryFree(pUrl->url);
|
taosMemoryFree(pUrl->url);
|
||||||
pIter = taosHashIterate(pRsp->hash, pIter);
|
pIter = taosHashIterate(pRsp->hash, pIter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "dmInt.h"
|
#include "dmInt.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tchecksum.h"
|
#include "tchecksum.h"
|
||||||
|
|
||||||
extern SConfig *tsCfg;
|
extern SConfig *tsCfg;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dmInt.h"
|
#include "dmInt.h"
|
||||||
#include "libs/function/tudf.h"
|
#include "libs/function/tudf.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
|
|
||||||
static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
|
static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -85,7 +85,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
||||||
dError("failed to start udfd since %s", tstrerror(code));
|
dError("failed to start udfd since %s", tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((code = taosAnalInit()) != 0) {
|
if ((code = taosAnalyticsInit()) != 0) {
|
||||||
dError("failed to init analysis env since %s", tstrerror(code));
|
dError("failed to init analysis env since %s", tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "tgrant.h"
|
#include "tgrant.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "tcs.h"
|
#include "tcs.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define DM_INIT_AUDIT() \
|
#define DM_INIT_AUDIT() \
|
||||||
|
@ -209,7 +209,7 @@ void dmCleanup() {
|
||||||
dError("failed to close udfc");
|
dError("failed to close udfc");
|
||||||
}
|
}
|
||||||
udfStopUdfd();
|
udfStopUdfd();
|
||||||
taosAnalCleanup();
|
taosAnalyticsCleanup();
|
||||||
taosStopCacheRefreshWorker();
|
taosStopCacheRefreshWorker();
|
||||||
(void)dmDiskClose();
|
(void)dmDiskClose();
|
||||||
DestroyRegexCache();
|
DestroyRegexCache();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dmMgmt.h"
|
#include "dmMgmt.h"
|
||||||
#include "qworker.h"
|
#include "qworker.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tversion.h"
|
#include "tversion.h"
|
||||||
|
|
||||||
static inline void dmSendRsp(SRpcMsg *pMsg) {
|
static inline void dmSendRsp(SRpcMsg *pMsg) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ if(TD_ENTERPRISE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${BUILD_WITH_ANALYSIS})
|
if(${BUILD_WITH_ANALYSIS})
|
||||||
add_definitions(-DUSE_ANAL)
|
add_definitions(-DUSE_ANALYTICS)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tjson.h"
|
#include "tjson.h"
|
||||||
|
|
||||||
#ifdef USE_ANAL
|
#ifdef USE_ANALYTICS
|
||||||
|
|
||||||
#define TSDB_ANODE_VER_NUMBER 1
|
#define TSDB_ANODE_VER_NUMBER 1
|
||||||
#define TSDB_ANODE_RESERVE_SIZE 64
|
#define TSDB_ANODE_RESERVE_SIZE 64
|
||||||
|
@ -806,7 +806,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SAnodeObj *pObj = NULL;
|
SAnodeObj *pObj = NULL;
|
||||||
SAnalUrl url;
|
SAnalyticsUrl url;
|
||||||
int32_t nameLen;
|
int32_t nameLen;
|
||||||
char name[TSDB_ANAL_ALGO_KEY_LEN];
|
char name[TSDB_ANAL_ALGO_KEY_LEN];
|
||||||
SRetrieveAnalAlgoReq req = {0};
|
SRetrieveAnalAlgoReq req = {0};
|
||||||
|
@ -838,7 +838,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
|
||||||
SAnodeAlgo *algo = taosArrayGet(algos, a);
|
SAnodeAlgo *algo = taosArrayGet(algos, a);
|
||||||
nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", url.type, algo->name);
|
nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", url.type, algo->name);
|
||||||
|
|
||||||
SAnalUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen);
|
SAnalyticsUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen);
|
||||||
if (pOldUrl == NULL || (pOldUrl != NULL && pOldUrl->anode < url.anode)) {
|
if (pOldUrl == NULL || (pOldUrl != NULL && pOldUrl->anode < url.anode)) {
|
||||||
if (pOldUrl != NULL) {
|
if (pOldUrl != NULL) {
|
||||||
taosMemoryFreeClear(pOldUrl->url);
|
taosMemoryFreeClear(pOldUrl->url);
|
||||||
|
@ -855,7 +855,7 @@ static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
url.urlLen = 1 + tsnprintf(url.url, TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN, "%s/%s", pAnode->url,
|
url.urlLen = 1 + tsnprintf(url.url, TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN, "%s/%s", pAnode->url,
|
||||||
taosAnalAlgoUrlStr(url.type));
|
taosAnalAlgoUrlStr(url.type));
|
||||||
if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalUrl)) != 0) {
|
if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalyticsUrl)) != 0) {
|
||||||
taosMemoryFree(url.url);
|
taosMemoryFree(url.url);
|
||||||
sdbRelease(pSdb, pAnode);
|
sdbRelease(pSdb, pAnode);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
|
@ -613,6 +613,16 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
singleTableLastTs = pColVal->rowKey.ts;
|
singleTableLastTs = pColVal->rowKey.ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p->colVal.value.type != pColVal->colVal.value.type) {
|
||||||
|
// check for type/cid mismatch
|
||||||
|
tsdbError("last cache type mismatch, uid:%" PRIu64
|
||||||
|
", schema-type:%d, slotId:%d, cache-type:%d, cache-col:%d",
|
||||||
|
uid, p->colVal.value.type, slotIds[k], pColVal->colVal.value.type, pColVal->colVal.cid);
|
||||||
|
taosArrayClearEx(pRow, tsdbCacheFreeSLastColItem);
|
||||||
|
code = TSDB_CODE_INVALID_PARA;
|
||||||
|
goto _end;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) {
|
if (!IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) {
|
||||||
p->colVal = pColVal->colVal;
|
p->colVal = pColVal->colVal;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,7 +7,7 @@ if(${TD_DARWIN})
|
||||||
endif(${TD_DARWIN})
|
endif(${TD_DARWIN})
|
||||||
|
|
||||||
if(${BUILD_WITH_ANALYSIS})
|
if(${BUILD_WITH_ANALYSIS})
|
||||||
add_definitions(-DUSE_ANAL)
|
add_definitions(-DUSE_ANALYTICS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(executor
|
target_link_libraries(executor
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
#include "functionMgt.h"
|
#include "functionMgt.h"
|
||||||
#include "operator.h"
|
#include "operator.h"
|
||||||
#include "querytask.h"
|
#include "querytask.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tjson.h"
|
#include "tjson.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
|
|
||||||
#ifdef USE_ANAL
|
#ifdef USE_ANALYTICS
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SArray* blocks; // SSDataBlock*
|
SArray* blocks; // SSDataBlock*
|
||||||
|
@ -55,7 +55,7 @@ typedef struct {
|
||||||
|
|
||||||
static void anomalyDestroyOperatorInfo(void* param);
|
static void anomalyDestroyOperatorInfo(void* param);
|
||||||
static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
|
||||||
static void anomalyAggregateBlocks(SOperatorInfo* pOperator);
|
static int32_t anomalyAggregateBlocks(SOperatorInfo* pOperator);
|
||||||
static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
|
||||||
|
|
||||||
int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo,
|
int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo,
|
||||||
|
@ -78,6 +78,7 @@ int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* p
|
||||||
code = TSDB_CODE_ANAL_ALGO_NOT_FOUND;
|
code = TSDB_CODE_ANAL_ALGO_NOT_FOUND;
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosAnalGetAlgoUrl(pInfo->algoName, ANAL_ALGO_TYPE_ANOMALY_DETECT, pInfo->algoUrl, sizeof(pInfo->algoUrl)) != 0) {
|
if (taosAnalGetAlgoUrl(pInfo->algoName, ANAL_ALGO_TYPE_ANOMALY_DETECT, pInfo->algoUrl, sizeof(pInfo->algoUrl)) != 0) {
|
||||||
qError("failed to get anomaly_window algorithm url from %s", pInfo->algoName);
|
qError("failed to get anomaly_window algorithm url from %s", pInfo->algoName);
|
||||||
code = TSDB_CODE_ANAL_ALGO_NOT_LOAD;
|
code = TSDB_CODE_ANAL_ALGO_NOT_LOAD;
|
||||||
|
@ -198,7 +199,9 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
|
||||||
QUERY_CHECK_CODE(code, lino, _end);
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
} else {
|
} else {
|
||||||
qDebug("group:%" PRId64 ", read finish for new group coming, blocks:%d", pSupp->groupId, numOfBlocks);
|
qDebug("group:%" PRId64 ", read finish for new group coming, blocks:%d", pSupp->groupId, numOfBlocks);
|
||||||
anomalyAggregateBlocks(pOperator);
|
code = anomalyAggregateBlocks(pOperator);
|
||||||
|
QUERY_CHECK_CODE(code, lino, _end);
|
||||||
|
|
||||||
pSupp->groupId = pBlock->info.id.groupId;
|
pSupp->groupId = pBlock->info.id.groupId;
|
||||||
numOfBlocks = 1;
|
numOfBlocks = 1;
|
||||||
pSupp->cachedRows = pBlock->info.rows;
|
pSupp->cachedRows = pBlock->info.rows;
|
||||||
|
@ -217,7 +220,7 @@ static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRe
|
||||||
|
|
||||||
if (numOfBlocks > 0) {
|
if (numOfBlocks > 0) {
|
||||||
qDebug("group:%" PRId64 ", read finish, blocks:%d", pInfo->anomalySup.groupId, numOfBlocks);
|
qDebug("group:%" PRId64 ", read finish, blocks:%d", pInfo->anomalySup.groupId, numOfBlocks);
|
||||||
anomalyAggregateBlocks(pOperator);
|
code = anomalyAggregateBlocks(pOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t cost = taosGetTimestampUs() - st;
|
int64_t cost = taosGetTimestampUs() - st;
|
||||||
|
@ -229,6 +232,7 @@ _end:
|
||||||
pTaskInfo->code = code;
|
pTaskInfo->code = code;
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
T_LONG_JMP(pTaskInfo->env, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ppRes) = (pBInfo->pRes->info.rows == 0) ? NULL : pBInfo->pRes;
|
(*ppRes) = (pBInfo->pRes->info.rows == 0) ? NULL : pBInfo->pRes;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -338,8 +342,8 @@ static int32_t anomalyAnalysisWindow(SOperatorInfo* pOperator) {
|
||||||
SAnalBuf analBuf = {.bufType = ANAL_BUF_TYPE_JSON};
|
SAnalBuf analBuf = {.bufType = ANAL_BUF_TYPE_JSON};
|
||||||
char dataBuf[64] = {0};
|
char dataBuf[64] = {0};
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
int64_t ts = 0;
|
||||||
|
|
||||||
int64_t ts = 0;
|
|
||||||
// int64_t ts = taosGetTimestampMs();
|
// int64_t ts = taosGetTimestampMs();
|
||||||
snprintf(analBuf.fileName, sizeof(analBuf.fileName), "%s/tdengine-anomaly-%" PRId64 "-%" PRId64, tsTempDir, ts,
|
snprintf(analBuf.fileName, sizeof(analBuf.fileName), "%s/tdengine-anomaly-%" PRId64 "-%" PRId64, tsTempDir, ts,
|
||||||
pSupp->groupId);
|
pSupp->groupId);
|
||||||
|
@ -431,6 +435,7 @@ _OVER:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
qError("failed to analysis window since %s", tstrerror(code));
|
qError("failed to analysis window since %s", tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
taosAnalBufDestroy(&analBuf);
|
taosAnalBufDestroy(&analBuf);
|
||||||
if (pJson != NULL) tjsonDelete(pJson);
|
if (pJson != NULL) tjsonDelete(pJson);
|
||||||
return code;
|
return code;
|
||||||
|
@ -473,7 +478,7 @@ static int32_t anomalyBuildResult(SOperatorInfo* pOperator) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void anomalyAggregateBlocks(SOperatorInfo* pOperator) {
|
static int32_t anomalyAggregateBlocks(SOperatorInfo* pOperator) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
|
SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
|
||||||
|
@ -623,6 +628,8 @@ _OVER:
|
||||||
pSupp->curWin.ekey = 0;
|
pSupp->curWin.ekey = 0;
|
||||||
pSupp->curWin.skey = 0;
|
pSupp->curWin.skey = 0;
|
||||||
pSupp->curWinIndex = 0;
|
pSupp->curWinIndex = 0;
|
||||||
|
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
#include "operator.h"
|
#include "operator.h"
|
||||||
#include "querytask.h"
|
#include "querytask.h"
|
||||||
#include "storageapi.h"
|
#include "storageapi.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tfill.h"
|
#include "tfill.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
|
|
||||||
#ifdef USE_ANAL
|
#ifdef USE_ANALYTICS
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char algoName[TSDB_ANAL_ALGO_NAME_LEN];
|
char algoName[TSDB_ANAL_ALGO_NAME_LEN];
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "geomFunc.h"
|
#include "geomFunc.h"
|
||||||
#include "querynodes.h"
|
#include "querynodes.h"
|
||||||
#include "scalar.h"
|
#include "scalar.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "taoserror.h"
|
#include "taoserror.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "functionResInfoInt.h"
|
#include "functionResInfoInt.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "querynodes.h"
|
#include "querynodes.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tcompare.h"
|
#include "tcompare.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tdigest.h"
|
#include "tdigest.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "parUtil.h"
|
#include "parUtil.h"
|
||||||
#include "scalar.h"
|
#include "scalar.h"
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tcol.h"
|
#include "tcol.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
|
|
|
@ -620,7 +620,7 @@ int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, ST
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int64_t qId = taosHton64(pHead->qid);
|
int64_t qId = taosHton64(pHead->qid);
|
||||||
if (qId == 0) {
|
if (qId == 0) {
|
||||||
return 0;
|
return TSDB_CODE_RPC_NO_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
STransCtx* pCtx = taosHashGet(conn->pQTable, &qId, sizeof(qId));
|
STransCtx* pCtx = taosHashGet(conn->pQTable, &qId, sizeof(qId));
|
||||||
|
@ -1608,6 +1608,7 @@ static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) {
|
||||||
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret));
|
tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret));
|
||||||
|
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
|
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1699,6 +1700,7 @@ void cliConnCb(uv_connect_t* req, int status) {
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr,
|
tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr,
|
||||||
uv_strerror(status));
|
uv_strerror(status));
|
||||||
|
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr);
|
||||||
TAOS_UNUSED(transUnrefCliHandle(pConn));
|
TAOS_UNUSED(transUnrefCliHandle(pConn));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1850,7 +1852,7 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
|
||||||
size_t len = strlen(fqdn);
|
size_t len = strlen(fqdn);
|
||||||
uint32_t* v = taosHashGet(cache, fqdn, len);
|
uint32_t* v = taosHashGet(cache, fqdn, len);
|
||||||
if (addr != *v) {
|
if (addr != *v) {
|
||||||
char old[TD_IP_LEN] = {0}, new[TD_IP_LEN] = {0};
|
char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0};
|
||||||
tinet_ntoa(old, *v);
|
tinet_ntoa(old, *v);
|
||||||
tinet_ntoa(new, addr);
|
tinet_ntoa(new, addr);
|
||||||
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
|
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
|
||||||
|
@ -1870,7 +1872,7 @@ static void cliMayUpdateFqdnCache(SHashObj* cache, char* dst) {
|
||||||
if (dst[i] == ':') break;
|
if (dst[i] == ':') break;
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
char fqdn[TSDB_FQDN_LEN + 1] = {0};
|
char fqdn[TSDB_FQDN_LEN] = {0};
|
||||||
memcpy(fqdn, dst, i);
|
memcpy(fqdn, dst, i);
|
||||||
TAOS_UNUSED(cliUpdateFqdnCache(cache, fqdn));
|
TAOS_UNUSED(cliUpdateFqdnCache(cache, fqdn));
|
||||||
}
|
}
|
||||||
|
@ -2917,6 +2919,7 @@ bool cliMayRetry(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) {
|
||||||
noDelay = cliResetEpset(pCtx, pResp, false);
|
noDelay = cliResetEpset(pCtx, pResp, false);
|
||||||
transFreeMsg(pResp->pCont);
|
transFreeMsg(pResp->pCont);
|
||||||
}
|
}
|
||||||
|
pResp->pCont = NULL;
|
||||||
if (code != TSDB_CODE_RPC_BROKEN_LINK && code != TSDB_CODE_RPC_NETWORK_UNAVAIL && code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_RPC_BROKEN_LINK && code != TSDB_CODE_RPC_NETWORK_UNAVAIL && code != TSDB_CODE_SUCCESS) {
|
||||||
// save one internal code
|
// save one internal code
|
||||||
pCtx->retryCode = code;
|
pCtx->retryCode = code;
|
||||||
|
|
|
@ -424,6 +424,9 @@ static void printFileSet(int32_t vgId, SArray* fileSet, const char* str) {
|
||||||
|
|
||||||
int32_t walCheckAndRepairMeta(SWal* pWal) {
|
int32_t walCheckAndRepairMeta(SWal* pWal) {
|
||||||
// load log files, get first/snapshot/last version info
|
// load log files, get first/snapshot/last version info
|
||||||
|
if (pWal->cfg.level == TAOS_WAL_SKIP) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
const char* logPattern = "^[0-9]+.log$";
|
const char* logPattern = "^[0-9]+.log$";
|
||||||
const char* idxPattern = "^[0-9]+.idx$";
|
const char* idxPattern = "^[0-9]+.idx$";
|
||||||
|
|
|
@ -294,8 +294,11 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
|
||||||
static int32_t walRollImpl(SWal *pWal) {
|
static int32_t walRollImpl(SWal *pWal) {
|
||||||
int32_t code = 0, lino = 0;
|
int32_t code = 0, lino = 0;
|
||||||
|
|
||||||
|
if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) {
|
||||||
|
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||||
|
}
|
||||||
if (pWal->pIdxFile != NULL) {
|
if (pWal->pIdxFile != NULL) {
|
||||||
if (pWal->cfg.level != TAOS_WAL_SKIP && (code = taosFsyncFile(pWal->pIdxFile)) != 0) {
|
if ((code = taosFsyncFile(pWal->pIdxFile)) != 0) {
|
||||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
code = taosCloseFile(&pWal->pIdxFile);
|
code = taosCloseFile(&pWal->pIdxFile);
|
||||||
|
@ -305,7 +308,7 @@ static int32_t walRollImpl(SWal *pWal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWal->pLogFile != NULL) {
|
if (pWal->pLogFile != NULL) {
|
||||||
if (pWal->cfg.level != TAOS_WAL_SKIP && (code = taosFsyncFile(pWal->pLogFile)) != 0) {
|
if ((code = taosFsyncFile(pWal->pLogFile)) != 0) {
|
||||||
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
code = taosCloseFile(&pWal->pLogFile);
|
code = taosCloseFile(&pWal->pLogFile);
|
||||||
|
|
|
@ -455,3 +455,59 @@ TEST_F(WalRetentionEnv, repairMeta1) {
|
||||||
}
|
}
|
||||||
walCloseReader(pRead);
|
walCloseReader(pRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WalSkipLevel : public ::testing::Test {
|
||||||
|
protected:
|
||||||
|
static void SetUpTestCase() {
|
||||||
|
int code = walInit(NULL);
|
||||||
|
ASSERT(code == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TearDownTestCase() { walCleanUp(); }
|
||||||
|
|
||||||
|
void walResetEnv() {
|
||||||
|
TearDown();
|
||||||
|
taosRemoveDir(pathName);
|
||||||
|
SetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
|
SWalCfg cfg;
|
||||||
|
cfg.rollPeriod = -1;
|
||||||
|
cfg.segSize = -1;
|
||||||
|
cfg.committed =-1;
|
||||||
|
cfg.retentionPeriod = -1;
|
||||||
|
cfg.retentionSize = 0;
|
||||||
|
cfg.rollPeriod = 0;
|
||||||
|
cfg.vgId = 1;
|
||||||
|
cfg.level = TAOS_WAL_SKIP;
|
||||||
|
pWal = walOpen(pathName, &cfg);
|
||||||
|
ASSERT(pWal != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override {
|
||||||
|
walClose(pWal);
|
||||||
|
pWal = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWal* pWal = NULL;
|
||||||
|
const char* pathName = TD_TMP_DIR_PATH "wal_test";
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(WalSkipLevel, restart) {
|
||||||
|
walResetEnv();
|
||||||
|
int code;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 100; i++) {
|
||||||
|
char newStr[100];
|
||||||
|
sprintf(newStr, "%s-%d", ranStr, i);
|
||||||
|
int len = strlen(newStr);
|
||||||
|
code = walAppendLog(pWal, i, 0, syncMeta, newStr, len);
|
||||||
|
ASSERT_EQ(code, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TearDown();
|
||||||
|
|
||||||
|
SetUp();
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ else()
|
||||||
endif(${ASSERT_NOT_CORE})
|
endif(${ASSERT_NOT_CORE})
|
||||||
|
|
||||||
if(${BUILD_WITH_ANALYSIS})
|
if(${BUILD_WITH_ANALYSIS})
|
||||||
add_definitions(-DUSE_ANAL)
|
add_definitions(-DUSE_ANALYTICS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
|
|
|
@ -14,18 +14,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tanal.h"
|
#include "tanalytics.h"
|
||||||
#include "tmsg.h"
|
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
|
|
||||||
#ifdef USE_ANAL
|
#ifdef USE_ANALYTICS
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#define ANAL_ALGO_SPLIT ","
|
#define ANAL_ALGO_SPLIT ","
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t ver;
|
int64_t ver;
|
||||||
SHashObj *hash; // algoname:algotype -> SAnalUrl
|
SHashObj *hash; // algoname:algotype -> SAnalyticsUrl
|
||||||
TdThreadMutex lock;
|
TdThreadMutex lock;
|
||||||
} SAlgoMgmt;
|
} SAlgoMgmt;
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ EAnalAlgoType taosAnalAlgoInt(const char *name) {
|
||||||
return ANAL_ALGO_TYPE_END;
|
return ANAL_ALGO_TYPE_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosAnalInit() {
|
int32_t taosAnalyticsInit() {
|
||||||
if (curl_global_init(CURL_GLOBAL_ALL) != 0) {
|
if (curl_global_init(CURL_GLOBAL_ALL) != 0) {
|
||||||
uError("failed to init curl");
|
uError("failed to init curl");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -94,14 +93,14 @@ int32_t taosAnalInit() {
|
||||||
static void taosAnalFreeHash(SHashObj *hash) {
|
static void taosAnalFreeHash(SHashObj *hash) {
|
||||||
void *pIter = taosHashIterate(hash, NULL);
|
void *pIter = taosHashIterate(hash, NULL);
|
||||||
while (pIter != NULL) {
|
while (pIter != NULL) {
|
||||||
SAnalUrl *pUrl = (SAnalUrl *)pIter;
|
SAnalyticsUrl *pUrl = (SAnalyticsUrl *)pIter;
|
||||||
taosMemoryFree(pUrl->url);
|
taosMemoryFree(pUrl->url);
|
||||||
pIter = taosHashIterate(hash, pIter);
|
pIter = taosHashIterate(hash, pIter);
|
||||||
}
|
}
|
||||||
taosHashCleanup(hash);
|
taosHashCleanup(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosAnalCleanup() {
|
void taosAnalyticsCleanup() {
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
if (taosThreadMutexDestroy(&tsAlgos.lock) != 0) {
|
if (taosThreadMutexDestroy(&tsAlgos.lock) != 0) {
|
||||||
uError("failed to destroy anal lock");
|
uError("failed to destroy anal lock");
|
||||||
|
@ -167,8 +166,10 @@ int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url,
|
||||||
char name[TSDB_ANAL_ALGO_KEY_LEN] = {0};
|
char name[TSDB_ANAL_ALGO_KEY_LEN] = {0};
|
||||||
int32_t nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", type, algoName);
|
int32_t nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", type, algoName);
|
||||||
|
|
||||||
|
char *unused = strntolower(name, name, nameLen);
|
||||||
|
|
||||||
if (taosThreadMutexLock(&tsAlgos.lock) == 0) {
|
if (taosThreadMutexLock(&tsAlgos.lock) == 0) {
|
||||||
SAnalUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen);
|
SAnalyticsUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen);
|
||||||
if (pUrl != NULL) {
|
if (pUrl != NULL) {
|
||||||
tstrncpy(url, pUrl->url, urlLen);
|
tstrncpy(url, pUrl->url, urlLen);
|
||||||
uDebug("algo:%s, type:%s, url:%s", algoName, taosAnalAlgoStr(type), url);
|
uDebug("algo:%s, type:%s, url:%s", algoName, taosAnalAlgoStr(type), url);
|
||||||
|
@ -178,6 +179,7 @@ int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url,
|
||||||
code = terrno;
|
code = terrno;
|
||||||
uError("algo:%s, type:%s, url not found", algoName, taosAnalAlgoStr(type));
|
uError("algo:%s, type:%s, url not found", algoName, taosAnalAlgoStr(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosThreadMutexUnlock(&tsAlgos.lock) != 0) {
|
if (taosThreadMutexUnlock(&tsAlgos.lock) != 0) {
|
||||||
uError("failed to unlock hash");
|
uError("failed to unlock hash");
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -403,7 +405,7 @@ static int32_t tsosAnalJsonBufOpen(SAnalBuf *pBuf, int32_t numOfCols) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pBuf->pCols = taosMemoryCalloc(numOfCols, sizeof(SAnalColBuf));
|
pBuf->pCols = taosMemoryCalloc(numOfCols, sizeof(SAnalyticsColBuf));
|
||||||
if (pBuf->pCols == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (pBuf->pCols == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
pBuf->numOfCols = numOfCols;
|
pBuf->numOfCols = numOfCols;
|
||||||
|
|
||||||
|
@ -412,7 +414,7 @@ static int32_t tsosAnalJsonBufOpen(SAnalBuf *pBuf, int32_t numOfCols) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SAnalColBuf *pCol = &pBuf->pCols[i];
|
SAnalyticsColBuf *pCol = &pBuf->pCols[i];
|
||||||
snprintf(pCol->fileName, sizeof(pCol->fileName), "%s-c%d", pBuf->fileName, i);
|
snprintf(pCol->fileName, sizeof(pCol->fileName), "%s-c%d", pBuf->fileName, i);
|
||||||
pCol->filePtr =
|
pCol->filePtr =
|
||||||
taosOpenFile(pCol->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
taosOpenFile(pCol->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||||
|
@ -546,7 +548,7 @@ static int32_t taosAnalJsonBufWriteDataEnd(SAnalBuf *pBuf) {
|
||||||
|
|
||||||
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
||||||
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
||||||
SAnalColBuf *pCol = &pBuf->pCols[i];
|
SAnalyticsColBuf *pCol = &pBuf->pCols[i];
|
||||||
|
|
||||||
code = taosFsyncFile(pCol->filePtr);
|
code = taosFsyncFile(pCol->filePtr);
|
||||||
if (code != 0) return code;
|
if (code != 0) return code;
|
||||||
|
@ -588,7 +590,7 @@ int32_t taosAnalJsonBufClose(SAnalBuf *pBuf) {
|
||||||
|
|
||||||
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
||||||
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
||||||
SAnalColBuf *pCol = &pBuf->pCols[i];
|
SAnalyticsColBuf *pCol = &pBuf->pCols[i];
|
||||||
if (pCol->filePtr != NULL) {
|
if (pCol->filePtr != NULL) {
|
||||||
code = taosFsyncFile(pCol->filePtr);
|
code = taosFsyncFile(pCol->filePtr);
|
||||||
if (code != 0) return code;
|
if (code != 0) return code;
|
||||||
|
@ -610,7 +612,7 @@ void taosAnalBufDestroy(SAnalBuf *pBuf) {
|
||||||
|
|
||||||
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
|
||||||
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
|
||||||
SAnalColBuf *pCol = &pBuf->pCols[i];
|
SAnalyticsColBuf *pCol = &pBuf->pCols[i];
|
||||||
if (pCol->fileName[0] != 0) {
|
if (pCol->fileName[0] != 0) {
|
||||||
if (pCol->filePtr != NULL) (void)taosCloseFile(&pCol->filePtr);
|
if (pCol->filePtr != NULL) (void)taosCloseFile(&pCol->filePtr);
|
||||||
if (taosRemoveFile(pCol->fileName) != 0) {
|
if (taosRemoveFile(pCol->fileName) != 0) {
|
||||||
|
@ -726,8 +728,8 @@ static int32_t taosAnalBufGetCont(SAnalBuf *pBuf, char **ppCont, int64_t *pContL
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int32_t taosAnalInit() { return 0; }
|
int32_t taosAnalyticsInit() { return 0; }
|
||||||
void taosAnalCleanup() {}
|
void taosAnalyticsCleanup() {}
|
||||||
SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf) { return NULL; }
|
SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf) { return NULL; }
|
||||||
|
|
||||||
int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; }
|
int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; }
|
|
@ -361,8 +361,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO, "Anode too many algori
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME, "Anode too long algorithm name")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME, "Anode too long algorithm name")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO_TYPE, "Anode too many algorithm type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO_TYPE, "Anode too many algorithm type")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_RSP_IS_NULL, "Analysis url response is NULL")
|
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_RSP_IS_NULL, "Analysis service response is NULL")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_CANT_ACCESS, "Analysis url can't access")
|
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_CANT_ACCESS, "Analysis service can't access")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_FOUND, "Analysis algorithm not found")
|
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_FOUND, "Analysis algorithm not found")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_LOAD, "Analysis algorithm not loaded")
|
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_LOAD, "Analysis algorithm not loaded")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_BUF_INVALID_TYPE, "Analysis invalid buffer type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_BUF_INVALID_TYPE, "Analysis invalid buffer type")
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
from frame.log import *
|
||||||
|
from frame.cases import *
|
||||||
|
from frame.sql import *
|
||||||
|
from frame.caseBase import *
|
||||||
|
from frame.epath import *
|
||||||
|
from frame import *
|
||||||
|
|
||||||
|
class TDTestCase(TBase):
|
||||||
|
def apiPath(self):
|
||||||
|
apiPath = None
|
||||||
|
currentFilePath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
if (os.sep.join(["community", "tests"]) in currentFilePath):
|
||||||
|
testFilePath = currentFilePath[:currentFilePath.find(os.sep.join(["community", "tests"]))]
|
||||||
|
else:
|
||||||
|
testFilePath = currentFilePath[:currentFilePath.find(os.sep.join(["TDengine", "tests"]))]
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(testFilePath):
|
||||||
|
if ("passwdTest.c" in files):
|
||||||
|
apiPath = root
|
||||||
|
break
|
||||||
|
return apiPath
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
apiPath = self.apiPath()
|
||||||
|
tdLog.info(f"api path: {apiPath}")
|
||||||
|
if platform.system().lower() == 'linux':
|
||||||
|
p = subprocess.Popen(f"cd {apiPath} && make", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if 0 != p.returncode:
|
||||||
|
tdLog.exit("Test script passwdTest.c make failed")
|
||||||
|
|
||||||
|
p = subprocess.Popen(f"ls {apiPath}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
tdLog.info(f"test files: {out}")
|
||||||
|
if apiPath:
|
||||||
|
test_file_cmd = os.sep.join([apiPath, "passwdTest localhost"])
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen(test_file_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if 0 != p.returncode:
|
||||||
|
tdLog.exit("Failed to run passwd test with output: %s \n error: %s" % (out, err))
|
||||||
|
else:
|
||||||
|
tdLog.info(out)
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.exit(f"Failed to execute {__file__} with error: {e}")
|
||||||
|
else:
|
||||||
|
tdLog.exit("passwdTest.c not found")
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -44,6 +44,7 @@
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f storage/compressBasic.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f storage/compressBasic.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f grant/grantBugs.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f grant/grantBugs.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/queryBugs.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f query/queryBugs.py -N 3
|
||||||
|
,,n,army,python3 ./test.py -f user/test_passwd.py
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f tmq/tmqBugs.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f tmq/tmqBugs.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_compare_asc_desc.py
|
,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_compare_asc_desc.py
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/last/test_last.py
|
,,y,army,./pytest.sh python3 ./test.py -f query/last/test_last.py
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3
|
,,y,army,./pytest.sh python3 ./test.py -f query/sys/tb_perf_queries_exist_test.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py
|
,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py
|
||||||
,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py
|
,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py
|
||||||
|
|
||||||
#
|
#
|
||||||
# system test
|
# system test
|
||||||
#
|
#
|
||||||
|
|
|
@ -13,7 +13,7 @@ all: $(TARGET)
|
||||||
|
|
||||||
exe:
|
exe:
|
||||||
gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS)
|
gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt2-test.c -o $(ROOT)stmt2-test $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt2-test.c -o $(ROOT)stmt2-test $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS)
|
gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS)
|
gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
|
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
|
||||||
|
@ -22,11 +22,11 @@ exe:
|
||||||
gcc $(CFLAGS) ./insert_stb.c -o $(ROOT)insert_stb $(LFLAGS)
|
gcc $(CFLAGS) ./insert_stb.c -o $(ROOT)insert_stb $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./tmqViewTest.c -o $(ROOT)tmqViewTest $(LFLAGS)
|
gcc $(CFLAGS) ./tmqViewTest.c -o $(ROOT)tmqViewTest $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmtQuery.c -o $(ROOT)stmtQuery $(LFLAGS)
|
gcc $(CFLAGS) ./stmtQuery.c -o $(ROOT)stmtQuery $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt.c -o $(ROOT)stmt $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt2.c -o $(ROOT)stmt2 $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt2-example.c -o $(ROOT)stmt2-example $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt2-get-fields.c -o $(ROOT)stmt2-get-fields $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt2-get-fields.c -o $(ROOT)stmt2-get-fields $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS)
|
# gcc $(CFLAGS) ./stmt2-nohole.c -o $(ROOT)stmt2-nohole $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS)
|
gcc $(CFLAGS) ./stmt-crash.c -o $(ROOT)stmt-crash $(LFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Makefile.mak for win64
|
||||||
|
|
||||||
|
TARGET = passwdTest.exe
|
||||||
|
CC = cl
|
||||||
|
CFLAGS = /W4 /EHsc /I"C:\TDengine\include" /DWINDOWS
|
||||||
|
LDFLAGS = /link /LIBPATH:"C:\TDengine\driver" taos.lib
|
||||||
|
|
||||||
|
SRCS = passwdTest.c
|
||||||
|
OBJS = $(SRCS:.c=.obj)
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(OBJS)
|
||||||
|
$(CC) $(OBJS) $(LDFLAGS)
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
$(CC) $(CFLAGS) /c $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del $(OBJS) $(TARGET)
|
|
@ -20,12 +20,27 @@
|
||||||
* passwdTest.c
|
* passwdTest.c
|
||||||
* - Run the test case in clear TDengine environment with default root passwd 'taosdata'
|
* - Run the test case in clear TDengine environment with default root passwd 'taosdata'
|
||||||
*/
|
*/
|
||||||
|
#ifdef WINDOWS
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifndef PRId64
|
||||||
|
#define PRId64 "I64d"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PRIu64
|
||||||
|
#define PRIu64 "I64u"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "taos.h" // TAOS header file
|
#include "taos.h" // TAOS header file
|
||||||
|
|
||||||
#define nDup 1
|
#define nDup 1
|
||||||
|
@ -50,6 +65,16 @@ void sysInfoTest(TAOS *taos, const char *host, char *qstr);
|
||||||
void userDroppedTest(TAOS *taos, const char *host, char *qstr);
|
void userDroppedTest(TAOS *taos, const char *host, char *qstr);
|
||||||
void clearTestEnv(TAOS *taos, const char *host, char *qstr);
|
void clearTestEnv(TAOS *taos, const char *host, char *qstr);
|
||||||
|
|
||||||
|
void taosMsleep(int64_t ms) {
|
||||||
|
if (ms < 0) return;
|
||||||
|
#ifdef WINDOWS
|
||||||
|
Sleep(ms);
|
||||||
|
#else
|
||||||
|
usleep(ms * 1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nPassVerNotified = 0;
|
int nPassVerNotified = 0;
|
||||||
int nUserDropped = 0;
|
int nUserDropped = 0;
|
||||||
TAOS *taosu[nRoot] = {0};
|
TAOS *taosu[nRoot] = {0};
|
||||||
|
@ -59,7 +84,8 @@ void __taos_notify_cb(void *param, void *ext, int type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TAOS_NOTIFY_PASSVER: {
|
case TAOS_NOTIFY_PASSVER: {
|
||||||
++nPassVerNotified;
|
++nPassVerNotified;
|
||||||
printf("%s:%d type:%d user:%s passVer:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL", *(int *)ext);
|
printf("%s:%d type:%d user:%s passVer:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL",
|
||||||
|
*(int *)ext);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TAOS_NOTIFY_USER_DROPPED: {
|
case TAOS_NOTIFY_USER_DROPPED: {
|
||||||
|
@ -191,11 +217,11 @@ static int printResult(TAOS_RES *res, char *output) {
|
||||||
printRow(temp, row, fields, numFields);
|
printRow(temp, row, fields, numFields);
|
||||||
puts(temp);
|
puts(temp);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
char qstr[1024];
|
char qstr[1024];
|
||||||
|
|
||||||
// connect to server
|
// connect to server
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("please input server-ip \n");
|
printf("please input server-ip \n");
|
||||||
|
@ -215,6 +241,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createUsers(TAOS *taos, const char *host, char *qstr) {
|
void createUsers(TAOS *taos, const char *host, char *qstr) {
|
||||||
|
@ -234,6 +261,7 @@ void createUsers(TAOS *taos, const char *host, char *qstr) {
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
fprintf(stderr, "failed to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s since %d\n", users[i], code);
|
fprintf(stderr, "failed to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s since %d\n", users[i], code);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "success to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s\n", users[i]);
|
fprintf(stderr, "success to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s\n", users[i]);
|
||||||
}
|
}
|
||||||
|
@ -260,6 +288,7 @@ void passVerTestMulti(const char *host, char *qstr) {
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
fprintf(stderr, "failed to run: taos_set_notify_cb since %d\n", code);
|
fprintf(stderr, "failed to run: taos_set_notify_cb since %d\n", code);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "success to run: taos_set_notify_cb\n");
|
fprintf(stderr, "success to run: taos_set_notify_cb\n");
|
||||||
}
|
}
|
||||||
|
@ -283,26 +312,25 @@ void passVerTestMulti(const char *host, char *qstr) {
|
||||||
printf("%s:%d [%d] second(s) elasped, passVer notification received:%d, total:%d\n", __func__, __LINE__, i,
|
printf("%s:%d [%d] second(s) elasped, passVer notification received:%d, total:%d\n", __func__, __LINE__, i,
|
||||||
nPassVerNotified, nConn);
|
nPassVerNotified, nConn);
|
||||||
if (nPassVerNotified >= nConn) break;
|
if (nPassVerNotified >= nConn) break;
|
||||||
sleep(1);
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the taos_conn
|
// close the taos_conn
|
||||||
for (int i = 0; i < nRoot; ++i) {
|
for (int i = 0; i < nRoot; ++i) {
|
||||||
taos_close(taos[i]);
|
taos_close(taos[i]);
|
||||||
printf("%s:%d close taos[%d]\n", __func__, __LINE__, i);
|
printf("%s:%d close taos[%d]\n", __func__, __LINE__, i);
|
||||||
// sleep(1);
|
// taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nUser; ++i) {
|
for (int i = 0; i < nUser; ++i) {
|
||||||
taos_close(taosu[i]);
|
taos_close(taosu[i]);
|
||||||
printf("%s:%d close taosu[%d]\n", __func__, __LINE__, i);
|
printf("%s:%d close taosu[%d]\n", __func__, __LINE__, i);
|
||||||
// sleep(1);
|
// taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "######## %s #########\n", __func__);
|
fprintf(stderr, "######## %s #########\n", __func__);
|
||||||
if (nPassVerNotified == nConn) {
|
if (nPassVerNotified == nConn) {
|
||||||
fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d == nConn %d\n", nPassVerNotified,
|
fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d == nConn %d\n", nPassVerNotified, nConn);
|
||||||
nConn);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, ">>> failed to get passVer notification since nNotify %d != nConn %d\n", nPassVerNotified, nConn);
|
fprintf(stderr, ">>> failed to get passVer notification since nNotify %d != nConn %d\n", nPassVerNotified, nConn);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -337,7 +365,7 @@ void sysInfoTest(TAOS *taosRoot, const char *host, char *qstr) {
|
||||||
TAOS_RES *res = NULL;
|
TAOS_RES *res = NULL;
|
||||||
int32_t nRep = 0;
|
int32_t nRep = 0;
|
||||||
|
|
||||||
_REP:
|
_REP:
|
||||||
fprintf(stderr, "######## %s loop:%d #########\n", __func__, nRep);
|
fprintf(stderr, "######## %s loop:%d #########\n", __func__, nRep);
|
||||||
res = taos_query(taos[0], qstr);
|
res = taos_query(taos[0], qstr);
|
||||||
if (taos_errno(res) != 0) {
|
if (taos_errno(res) != 0) {
|
||||||
|
@ -356,7 +384,7 @@ _REP:
|
||||||
|
|
||||||
fprintf(stderr, "%s:%d sleep 2 seconds to wait HB take effect\n", __func__, __LINE__);
|
fprintf(stderr, "%s:%d sleep 2 seconds to wait HB take effect\n", __func__, __LINE__);
|
||||||
for (int i = 1; i <= 2; ++i) {
|
for (int i = 1; i <= 2; ++i) {
|
||||||
sleep(1);
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = taos_query(taos[0], qstr);
|
res = taos_query(taos[0], qstr);
|
||||||
|
@ -372,10 +400,10 @@ _REP:
|
||||||
queryDB(taosRoot, "alter user user0 sysinfo 1");
|
queryDB(taosRoot, "alter user user0 sysinfo 1");
|
||||||
fprintf(stderr, "%s:%d sleep 2 seconds to wait HB take effect\n", __func__, __LINE__);
|
fprintf(stderr, "%s:%d sleep 2 seconds to wait HB take effect\n", __func__, __LINE__);
|
||||||
for (int i = 1; i <= 2; ++i) {
|
for (int i = 1; i <= 2; ++i) {
|
||||||
sleep(1);
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(++nRep < 5) {
|
if (++nRep < 5) {
|
||||||
goto _REP;
|
goto _REP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +418,7 @@ _REP:
|
||||||
fprintf(stderr, "######## %s #########\n", __func__);
|
fprintf(stderr, "######## %s #########\n", __func__);
|
||||||
}
|
}
|
||||||
static bool isDropUser = true;
|
static bool isDropUser = true;
|
||||||
void userDroppedTest(TAOS *taos, const char *host, char *qstr) {
|
void userDroppedTest(TAOS *taos, const char *host, char *qstr) {
|
||||||
// users
|
// users
|
||||||
int nTestUsers = nUser;
|
int nTestUsers = nUser;
|
||||||
int nLoop = 0;
|
int nLoop = 0;
|
||||||
|
@ -408,6 +436,7 @@ _loop:
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
fprintf(stderr, "failed to run: taos_set_notify_cb:%d for user:%s since %d\n", TAOS_NOTIFY_USER_DROPPED, users[i],
|
fprintf(stderr, "failed to run: taos_set_notify_cb:%d for user:%s since %d\n", TAOS_NOTIFY_USER_DROPPED, users[i],
|
||||||
code);
|
code);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "success to run: taos_set_notify_cb:%d for user:%s\n", TAOS_NOTIFY_USER_DROPPED, users[i]);
|
fprintf(stderr, "success to run: taos_set_notify_cb:%d for user:%s\n", TAOS_NOTIFY_USER_DROPPED, users[i]);
|
||||||
}
|
}
|
||||||
|
@ -426,7 +455,7 @@ _loop:
|
||||||
printf("%s:%d [%d] second(s) elasped, user dropped notification received:%d, total:%d\n", __func__, __LINE__, i,
|
printf("%s:%d [%d] second(s) elasped, user dropped notification received:%d, total:%d\n", __func__, __LINE__, i,
|
||||||
nUserDropped, nConn);
|
nUserDropped, nConn);
|
||||||
if (nUserDropped >= nConn) break;
|
if (nUserDropped >= nConn) break;
|
||||||
sleep(1);
|
taosMsleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nTestUsers; ++i) {
|
for (int i = 0; i < nTestUsers; ++i) {
|
||||||
|
|
|
@ -689,6 +689,9 @@ if __name__ == "__main__":
|
||||||
if conn is not None:
|
if conn is not None:
|
||||||
conn.close()
|
conn.close()
|
||||||
if asan:
|
if asan:
|
||||||
#tdDnodes.StopAllSigint()
|
# tdDnodes.StopAllSigint()
|
||||||
tdLog.info("Address sanitizer mode finished")
|
tdLog.info("Address sanitizer mode finished")
|
||||||
|
else:
|
||||||
|
tdDnodes.stopAll()
|
||||||
|
tdLog.info("stop all td process finished")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue