fix:(策略导入)添加策略导入条数限制,先查询已经导入测策略总数,然后加上待导入的策略总数据,超过100万条返回错误
This commit is contained in:
@@ -110,7 +110,15 @@ ImportPolicy
|
|||||||
Directory Should Exist ${path}
|
Directory Should Exist ${path}
|
||||||
File Should Exist ${path}/${filePath}/${fileName}
|
File Should Exist ${path}/${filePath}/${fileName}
|
||||||
File Should Not Be Empty ${path}/${filePath}/${fileName}
|
File Should Not Be Empty ${path}/${filePath}/${fileName}
|
||||||
${size} Get File Size ${path}/${filePath}/${fileName}
|
#获取导入策略总数
|
||||||
|
${file} Get File ${path}/${filePath}/${fileName}
|
||||||
|
${fileJson} json.Loads ${file}
|
||||||
|
#待导入的策略总数
|
||||||
|
${totalNum} Get From Dictionary ${fileJson} totalNum
|
||||||
|
#查询已经导入的非内置策略的数量
|
||||||
|
${totalExists} GetPolicyTotal 2
|
||||||
|
${calTotal} Evaluate ${totalNum} + ${totalExists}
|
||||||
|
Run Keyword If ${calTotal}>1000000 Fail 当前已经存在策略条数${totalExists},待导入条数${totalNum},总数超过100万条!
|
||||||
${binFile} Evaluate (r'import_policy.json',open(r"${path}/${filePath}/${fileName}",'rb'),'application/json')
|
${binFile} Evaluate (r'import_policy.json',open(r"${path}/${filePath}/${fileName}",'rb'),'application/json')
|
||||||
Log ${binFile}
|
Log ${binFile}
|
||||||
${data} Create Dictionary policyType=${policyType}
|
${data} Create Dictionary policyType=${policyType}
|
||||||
@@ -166,3 +174,15 @@ VerifyPolicies
|
|||||||
${rescode} Set Variable ${response['code']}
|
${rescode} Set Variable ${response['code']}
|
||||||
Should Be Equal As Strings ${rescode} 200
|
Should Be Equal As Strings ${rescode} 200
|
||||||
[Return] ${rescode} ${response['data']}
|
[Return] ${rescode} ${response['data']}
|
||||||
|
GetPolicyTotal
|
||||||
|
[Documentation]
|
||||||
|
... 获取已经存在的策略总量
|
||||||
|
... 排除内置策略
|
||||||
|
... initializeNum内置策略数量
|
||||||
|
[Arguments] ${initializeNum}
|
||||||
|
${response} BaseFormRequest ${policyUrl}/statistics ${EMPTY} ${version}
|
||||||
|
${rescode} Set Variable ${response['code']}
|
||||||
|
Should Be Equal As Strings ${rescode} 200
|
||||||
|
${total} Set Variable ${response['data']['policyNum']}
|
||||||
|
${total} Evaluate ${total} - ${initializeNum}
|
||||||
|
[Return] ${total}
|
||||||
Reference in New Issue
Block a user