Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
5aeea35f
Commit
5aeea35f
authored
Sep 28, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unit test
parent
ca63e5a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
3 deletions
+59
-3
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+38
-3
supervisionaccount_test.go
plugin/dapp/paracross/executor/supervisionaccount_test.go
+21
-0
No files found.
plugin/dapp/paracross/executor/superaccount_test.go
View file @
5aeea35f
...
...
@@ -24,7 +24,7 @@ import (
var
(
PrivKey14K
=
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
// 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt
Account14K
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
applyAddrs
=
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,
1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,
1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
applyAddrs
=
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4,
1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR,
1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k,1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
Account12Q
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
PrivKey12Q
=
"4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
)
...
...
@@ -75,6 +75,14 @@ func (suite *NodeManageTestSuite) SetupSuite() {
suite
.
api
=
new
(
apimock
.
QueueProtocolAPI
)
suite
.
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
chain33TestCfg
,
nil
)
block
:=
&
types
.
Block
{
Height
:
1
,
MainHeight
:
10
,
}
detail
:=
&
types
.
BlockDetail
{
Block
:
block
}
details
:=
&
types
.
BlockDetails
{
Items
:
[]
*
types
.
BlockDetail
{
detail
}}
suite
.
api
.
On
(
"GetBlocks"
,
mock
.
Anything
)
.
Return
(
details
,
nil
)
suite
.
exec
=
newParacross
()
.
(
*
Paracross
)
suite
.
exec
.
SetAPI
(
suite
.
api
)
suite
.
exec
.
SetLocalDB
(
suite
.
localDB
)
...
...
@@ -244,7 +252,6 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
suite
.
Nil
(
err
)
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
//checkGroupApproveReceipt(suite, receipt)
}
func
(
suite
*
NodeManageTestSuite
)
testNodeGroupConfig
()
{
...
...
@@ -318,9 +325,14 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
}
func
(
suite
*
NodeManageTestSuite
)
TestExec
()
{
suite
.
testSuperExec
()
suite
.
testSupervisionExec
()
}
func
(
suite
*
NodeManageTestSuite
)
testSuperExec
()
{
suite
.
testNodeGroupConfig
()
suite
.
testNodeConfig
()
suite
.
testSuper
visionExec
()
suite
.
testSuper
Query
()
}
func
TestNodeManageSuite
(
t
*
testing
.
T
)
{
...
...
@@ -379,3 +391,26 @@ func TestGetNodeIdSuffix(t *testing.T) {
rtID
=
getParaNodeIDSuffix
(
id
)
assert
.
Equal
(
t
,
txID
,
rtID
)
}
func
(
suite
*
NodeManageTestSuite
)
testSuperQuery
()
{
ret
,
err
:=
suite
.
exec
.
Query_GetNodeGroupAddrs
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
()})
suite
.
Nil
(
err
)
resp
,
ok
:=
ret
.
(
*
types
.
ReplyConfig
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
Equal
(
suite
.
T
(),
resp
.
Value
,
applyAddrs
)
ret
,
err
=
suite
.
exec
.
Query_GetNodeAddrInfo
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
(),
Addr
:
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
})
suite
.
Nil
(
err
)
resp2
,
ok
:=
ret
.
(
*
pt
.
ParaNodeAddrIdStatus
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
NotNil
(
suite
.
T
(),
resp2
)
ret
,
err
=
suite
.
exec
.
Query_GetNodeAddrInfo
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
(),
Addr
:
"1FbS6G4CRYAYeSEPGg7uKP9MukUo6crEE5"
})
suite
.
NotNil
(
err
)
ret
,
err
=
suite
.
exec
.
Query_GetNodeGroupStatus
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
()})
suite
.
Nil
(
err
)
resp3
,
ok
:=
ret
.
(
*
pt
.
ParaNodeGroupStatus
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
Equal
(
suite
.
T
(),
resp3
.
Status
,
int32
(
pt
.
ParacrossNodeGroupApprove
))
}
plugin/dapp/paracross/executor/supervisionaccount_test.go
View file @
5aeea35f
...
...
@@ -22,6 +22,7 @@ func createRawSupervisionNodeConfigTx(config *pt.ParaNodeAddrConfig) (*types.Tra
func
(
suite
*
NodeManageTestSuite
)
testSupervisionExec
()
{
suite
.
testSupervisionNodeConfigQuit
()
suite
.
testSupervisionNodeConfigApprove
()
suite
.
testSupervisionQuery
()
}
func
(
suite
*
NodeManageTestSuite
)
testSupervisionNodeConfigQuit
()
{
...
...
@@ -88,3 +89,23 @@ func checkSupervisionGroupApplyReceipt(suite *NodeManageTestSuite, receipt *type
assert
.
Len
(
suite
.
T
(),
receipt
.
Logs
,
1
)
assert
.
Equal
(
suite
.
T
(),
int32
(
pt
.
TyLogParaSupervisionNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
}
func
(
suite
*
NodeManageTestSuite
)
testSupervisionQuery
()
{
ret
,
err
:=
suite
.
exec
.
Query_GetSupervisionNodeGroupAddrs
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
()})
suite
.
Nil
(
err
)
resp
,
ok
:=
ret
.
(
*
types
.
ReplyConfig
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
Equal
(
suite
.
T
(),
resp
.
Value
,
Account14K
)
ret
,
err
=
suite
.
exec
.
Query_GetSupervisionNodeAddrInfo
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
(),
Addr
:
Account14K
})
suite
.
Nil
(
err
)
resp2
,
ok
:=
ret
.
(
*
pt
.
ParaNodeAddrIdStatus
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
NotNil
(
suite
.
T
(),
resp2
)
ret
,
err
=
suite
.
exec
.
Query_GetSupervisionNodeGroupStatus
(
&
pt
.
ReqParacrossNodeInfo
{
Title
:
chain33TestCfg
.
GetTitle
()})
suite
.
Nil
(
err
)
resp3
,
ok
:=
ret
.
(
*
pt
.
ParaNodeGroupStatus
)
assert
.
Equal
(
suite
.
T
(),
ok
,
true
)
assert
.
Equal
(
suite
.
T
(),
resp3
.
Status
,
int32
(
pt
.
ParacrossSupervisionNodeApprove
))
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment