Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
6f18dd35
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f18dd35
编写于
6月 27, 2018
作者:
C
Ciju John
提交者:
Kevin Heifner
7月 05, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update MongoDB test and enable same.
上级
0322af9b
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
213 addition
and
280 deletion
+213
-280
tests/CMakeLists.txt
tests/CMakeLists.txt
+3
-3
tests/Cluster.py
tests/Cluster.py
+1
-1
tests/Node.py
tests/Node.py
+174
-197
tests/nodeos_run_test.py
tests/nodeos_run_test.py
+32
-73
tests/testUtils.py
tests/testUtils.py
+3
-6
未找到文件。
tests/CMakeLists.txt
浏览文件 @
6f18dd35
...
...
@@ -46,9 +46,9 @@ add_test(NAME nodeos_sanity_test COMMAND tests/nodeos_run_test.py -v --sanity-te
add_test
(
NAME nodeos_run_test COMMAND tests/nodeos_run_test.py -v --clean-run --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME p2p_dawn515_test COMMAND tests/p2p_tests/dawn_515/test.sh WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
#
if(BUILD_MONGO_DB_PLUGIN)
# add_test(NAME nodeos_run_test-mongodb COMMAND tests/nodeos_run_test.py --mongodb -v
--dump-error-detail WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
#
endif()
if
(
BUILD_MONGO_DB_PLUGIN
)
add_test
(
NAME nodeos_run_test-mongodb COMMAND tests/nodeos_run_test.py --mongodb -v --clean-run
--dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
endif
()
add_test
(
NAME distributed-transactions-test COMMAND tests/distributed-transactions-test.py -d 2 -p 1 -n 4 -v --clean-run --dump-error-detail WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_test
(
NAME restart-scenarios-test-resync COMMAND tests/restart-scenarios-test.py -c resync -p4 -v --clean-run --dump-error-details WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
...
...
tests/Cluster.py
浏览文件 @
6f18dd35
...
...
@@ -133,7 +133,7 @@ class Cluster(object):
if
not
self
.
walletd
:
nodeosArgs
+=
" --plugin eosio::wallet_api_plugin"
if
self
.
enableMongo
:
nodeosArgs
+=
" --plugin eosio::mongo_db_plugin --delete-all-blocks --mongodb-uri %s"
%
self
.
mongoUri
nodeosArgs
+=
" --plugin eosio::mongo_db_plugin --
mongodb-wipe --
delete-all-blocks --mongodb-uri %s"
%
self
.
mongoUri
if
nodeosArgs
:
cmdArr
.
append
(
"--nodeos"
)
...
...
tests/Node.py
浏览文件 @
6f18dd35
此差异已折叠。
点击以展开。
tests/nodeos_run_test.py
浏览文件 @
6f18dd35
...
...
@@ -56,7 +56,8 @@ dontBootstrap=sanityTest
WalletdName
=
"keosd"
ClientName
=
"cleos"
# Utils.setMongoSyncTime(50)
timeout
=
.
5
*
12
*
2
+
60
# time for finalization with 1 producer + 60 seconds padding
Utils
.
setIrreversibleTimeout
(
timeout
)
try
:
TestHelper
.
printSystemInfo
(
"BEGIN"
)
...
...
@@ -305,62 +306,17 @@ try:
actions
=
node
.
getActions
(
testeraAccount
,
-
1
,
-
1
)
assert
(
actions
)
try
:
if
not
enableMongo
:
assert
(
actions
[
"actions"
][
0
][
"action_trace"
][
"act"
][
"name"
]
==
"transfer"
)
else
:
assert
(
actions
[
"name"
]
==
"transfer"
)
except
(
AssertionError
,
TypeError
,
KeyError
)
as
_
:
Print
(
"
Last a
ction validation failed. Actions: %s"
%
(
actions
))
Print
(
"
A
ction validation failed. Actions: %s"
%
(
actions
))
raise
# This API (get accounts) is no longer supported (Issue 2876)
# expectedAccounts=[testeraAccount.name, currencyAccount.name, exchangeAccount.name]
# Print("Get accounts by key %s, Expected: %s" % (PUB_KEY3, expectedAccounts))
# actualAccounts=node.getAccountsArrByKey(PUB_KEY3)
# if actualAccounts is None:
# cmdError("%s get accounts pub_key3" % (ClientName))
# errorExit("Failed to retrieve accounts by key %s" % (PUB_KEY3))
# noMatch=list(set(expectedAccounts) - set(actualAccounts))
# if len(noMatch) > 0:
# errorExit("FAILURE - Accounts lookup by key %s. Expected: %s, Actual: %s" % (
# PUB_KEY3, expectedAccounts, actualAccounts), raw=True)
#
# expectedAccounts=[testeraAccount.name]
# Print("Get accounts by key %s, Expected: %s" % (PUB_KEY1, expectedAccounts))
# actualAccounts=node.getAccountsArrByKey(PUB_KEY1)
# if actualAccounts is None:
# cmdError("%s get accounts pub_key1" % (ClientName))
# errorExit("Failed to retrieve accounts by key %s" % (PUB_KEY1))
# noMatch=list(set(expectedAccounts) - set(actualAccounts))
# if len(noMatch) > 0:
# errorExit("FAILURE - Accounts lookup by key %s. Expected: %s, Actual: %s" % (
# PUB_KEY1, expectedAccounts, actualAccounts), raw=True)
# This API (get servants) is no longer supported. (Issue 3160)
# expectedServants=[testeraAccount.name, currencyAccount.name]
# Print("Get %s servants, Expected: %s" % (defproduceraAccount.name, expectedServants))
# actualServants=node.getServantsArr(defproduceraAccount.name)
# if actualServants is None:
# cmdError("%s get servants testera11111" % (ClientName))
# errorExit("Failed to retrieve %s servants" % (defproduceraAccount.name))
# noMatch=list(set(expectedAccounts) - set(actualAccounts))
# if len(noMatch) > 0:
# errorExit("FAILURE - %s servants. Expected: %s, Actual: %s" % (
# defproduceraAccount.name, expectedServants, actualServants), raw=True)
#
# Print("Get %s servants, Expected: []" % (testeraAccount.name))
# actualServants=node.getServantsArr(testeraAccount.name)
# if actualServants is None:
# cmdError("%s get servants testera11111" % (ClientName))
# errorExit("Failed to retrieve %s servants" % (testeraAccount.name))
# if len(actualServants) > 0:
# errorExit("FAILURE - %s servants. Expected: [], Actual: %s" % (
# testeraAccount.name, actualServants), raw=True)
node
.
waitForTransInBlock
(
transId
)
transaction
=
None
if
not
enableMongo
:
transaction
=
node
.
getTransaction
(
transId
)
else
:
transaction
=
node
.
getActionFromDb
(
transId
)
if
transaction
is
None
:
cmdError
(
"%s get transaction trans_id"
%
(
ClientName
))
errorExit
(
"Failed to retrieve transaction details %s"
%
(
transId
))
...
...
@@ -368,17 +324,22 @@ try:
typeVal
=
None
amountVal
=
None
assert
(
transaction
)
key
=
""
try
:
if
not
enableMongo
:
key
=
"[traces][0][act][name]"
typeVal
=
transaction
[
"traces"
][
0
][
"act"
][
"name"
]
key
=
"[traces][0][act][data][quantity]"
amountVal
=
transaction
[
"traces"
][
0
][
"act"
][
"data"
][
"quantity"
]
amountVal
=
int
(
decimal
.
Decimal
(
amountVal
.
split
()[
0
])
*
10000
)
else
:
typeVal
=
transaction
[
"name"
]
amountVal
=
transaction
[
"data"
][
"quantity"
]
key
=
"[actions][0][name]"
typeVal
=
transaction
[
"actions"
][
0
][
"name"
]
key
=
"[actions][0][data][quantity]"
amountVal
=
transaction
[
"actions"
][
0
][
"data"
][
"quantity"
]
amountVal
=
int
(
decimal
.
Decimal
(
amountVal
.
split
()[
0
])
*
10000
)
except
(
TypeError
,
KeyError
)
as
e
:
Print
(
"
Transaction validation parsing failed. Transaction: %s"
%
(
transaction
))
Print
(
"
transaction%s not found. Transaction: %s"
%
(
key
,
transaction
))
raise
if
typeVal
!=
"transfer"
or
amountVal
!=
975311
:
...
...
@@ -534,7 +495,10 @@ try:
assert
(
block
)
transactions
=
None
try
:
if
not
enableMongo
:
transactions
=
block
[
"transactions"
]
else
:
transactions
=
block
[
"block"
][
"transactions"
]
assert
(
transactions
)
except
(
AssertionError
,
TypeError
,
KeyError
)
as
_
:
Print
(
"FAILURE - Failed to parse block. %s"
%
(
block
))
...
...
@@ -718,38 +682,33 @@ try:
cmdError
(
"%s get account"
%
(
ClientName
))
errorExit
(
"Failed to get account %s"
%
(
defproduceraAccount
.
name
))
#
# Proxy
#
# not implemented
Print
(
"Unlocking wallet
\"
%s
\"
."
%
(
defproduceraWallet
.
name
))
if
not
walletMgr
.
unlockWallet
(
testWallet
):
cmdError
(
"%s wallet unlock test"
%
(
ClientName
))
errorExit
(
"Failed to unlock wallet %s"
%
(
testWallet
.
name
))
Print
(
"Get head block num."
)
currentBlockNum
=
node
.
getHeadBlockNum
()
Print
(
"CurrentBlockNum: %d"
%
(
currentBlockNum
))
Print
(
"Request blocks 1-%d"
%
(
currentBlockNum
))
for
blockNum
in
range
(
1
,
currentBlockNum
+
1
):
block
=
node
.
getBlock
(
blockNum
,
retry
=
False
,
silentErrors
=
False
)
start
=
1
if
enableMongo
:
start
=
2
# block 1 (genesis block) is not signaled to the plugins, so not available in DB
for
blockNum
in
range
(
start
,
currentBlockNum
+
1
):
block
=
node
.
getBlock
(
blockNum
,
silentErrors
=
False
)
if
block
is
None
:
cmdError
(
"%s get block"
%
(
ClientName
))
errorExit
(
"get block by num %d"
%
blockNum
)
if
enableMongo
:
blockId
=
block
[
"block_id"
]
block2
=
node
.
getBlockById
(
blockId
,
retry
=
False
)
block2
=
node
.
getBlockById
(
blockId
)
if
block2
is
None
:
errorExit
(
"mongo get block by id %s"
%
blockId
)
# TBD: getTransByBlockId() needs to handle multiple returned transactions
# trans=node.getTransByBlockId(blockId, retry=False)
# if trans is not None:
# transId=Node.getTransId(trans)
# trans2=node.getMessageFromDb(transId)
# if trans2 is None:
# errorExit("mongo get messages by transaction id %s" % (transId))
Print
(
"Request invalid block numbered %d. This will generate an expected error message."
%
(
currentBlockNum
+
1000
))
block
=
node
.
getBlock
(
currentBlockNum
+
1000
,
silentErrors
=
True
,
retry
=
False
)
block
=
node
.
getBlock
(
currentBlockNum
+
1000
,
silentErrors
=
True
)
if
block
is
not
None
:
errorExit
(
"ERROR: Received block where not expected"
)
else
:
...
...
tests/testUtils.py
浏览文件 @
6f18dd35
...
...
@@ -41,14 +41,11 @@ class Utils:
SigTermTag
=
"term"
systemWaitTimeout
=
90
# mongoSyncTime: nodeos mongodb plugin seems to sync with a 10-15 seconds delay. This will inject
# a wait period before the 2nd DB check (if first check fails)
mongoSyncTime
=
25
irreversibleTimeout
=
60
@
staticmethod
def
set
MongoSyncTime
(
syncTime
):
Utils
.
mongoSyncTime
=
syncTime
def
set
IrreversibleTimeout
(
timeout
):
Utils
.
irreversibleTimeout
=
timeout
@
staticmethod
def
setSystemWaitTimeout
(
timeout
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录