添加推荐、趋势、时间和计数关键字

This commit is contained in:
姬巍川
2020-05-28 14:14:12 +08:00
parent 912a6c54ae
commit 2d83bc6b24

View File

@@ -232,3 +232,35 @@ SplicingTrafficSql
${where}= Get Substring ${strippedwhere} \ -1
${sql2} catenate select DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(__time)/${timeGranularity})*${timeGranularity}),'%Y-%m-%d %H:%i:%s') as statisticsTime, ${where} from traffic_metrics_log where __time >= '${startTime}' and __time < '${endTime}' group by DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(__time)/${timeGranularity})*${timeGranularity}),'%Y-%m-%d %H:%i:%s') limit ${limit}
[Return] ${sql2}
Recommend
[Arguments] ${url} ${statisticTime}
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Get Request api ${url}?statisticTime=${statisticTime} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
Trend
[Arguments] ${url} ${startTime} ${endTime} ${logType} ${policyId}
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Get Request api ${url}?policyId=${policyId}&logType=${logType}&startTime=${startTime}&endTime=${endTime} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
Should Be Equal As Strings ${remoteResponse.json()}[msg] Success
Timeandcount
[Arguments] ${url} ${logType} ${policyIds}
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token}
Create Session api http://${host}:${port}/${version} headers=${header}
${remoteResponse} Get Request api ${url}?policyIds=${policyIds}&logType=${logType} headers=${header}
${response} to json ${remoteResponse.content}
Should Be Equal As Strings ${remoteResponse.status_code} 200
Should Be Equal As Strings ${remoteResponse.json()}[msg] Success
${data} set variable ${response}[data][list]
FOR ${kk} ${vv} IN ENUMERATE @{data}
log ${vv}[policyId]
${true} Evaluate "${vv}[policyId]" in "${policyIds}"
Should Be Equal As Strings ${true} True
END