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
5795fe6b
Commit
5795fe6b
authored
Dec 17, 2019
by
mdj33
Committed by
vipwzw
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
f1bc1850
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
112 deletions
+24
-112
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+17
-0
rpc_test.go
plugin/dapp/paracross/rpc/rpc_test.go
+0
-112
para_test.go
plugin/dapp/paracross/testnode/para_test.go
+7
-0
No files found.
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
5795fe6b
...
@@ -361,6 +361,23 @@ function para_cross_transfer_withdraw() {
...
@@ -361,6 +361,23 @@ function para_cross_transfer_withdraw() {
break
break
fi
fi
done
done
echo
"check asset transfer tx=
$hash
"
res
=
$(${
CLI
}
para asset_txinfo
-s
"
${
hash
}
"
)
echo
"
$res
"
succ
=
$(
jq
-r
".success"
<<<
"
$res
"
)
if
[
"
${
succ
}
"
!=
"true"
]
;
then
echo
"para asset transfer tx report fail"
exit
1
fi
echo
"check asset withdraw tx=
$hash2
"
res
=
$(${
CLI
}
para asset_txinfo
-s
"
${
hash2
}
"
)
echo
"
$res
"
succ
=
$(
jq
-r
".success"
<<<
"
$res
"
)
if
[
"
${
succ
}
"
!=
"true"
]
;
then
echo
"para asset withdraw tx report fail"
exit
1
fi
}
}
function
token_create_on_mainChain
()
{
function
token_create_on_mainChain
()
{
...
...
plugin/dapp/paracross/rpc/rpc_test.go
View file @
5795fe6b
...
@@ -15,7 +15,6 @@ import (
...
@@ -15,7 +15,6 @@ import (
rpctypes
"github.com/33cn/chain33/rpc/types"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
ptestNode
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
ptestNode
"github.com/33cn/plugin/plugin/dapp/paracross/testnode"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/mock"
"golang.org/x/net/context"
"golang.org/x/net/context"
...
@@ -31,117 +30,6 @@ func newJrpc(api client.QueueProtocolAPI) *Jrpc {
...
@@ -31,117 +30,6 @@ func newJrpc(api client.QueueProtocolAPI) *Jrpc {
return
&
Jrpc
{
cli
:
newGrpc
(
api
)}
return
&
Jrpc
{
cli
:
newGrpc
(
api
)}
}
}
func
TestChannelClient_GetTitle
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
client
:=
newGrpc
(
api
)
client
.
Init
(
"paracross"
,
nil
,
nil
,
nil
)
req
:=
&
types
.
ReqString
{
Data
:
"xxxxxxxxxxx"
}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetTitle"
,
req
)
.
Return
(
&
pt
.
ParacrossStatus
{},
nil
)
api
.
On
(
"GetLastHeader"
,
mock
.
Anything
)
.
Return
(
&
types
.
Header
{},
nil
)
.
Once
()
_
,
err
:=
client
.
GetTitle
(
context
.
Background
(),
req
)
assert
.
Nil
(
t
,
err
)
}
func
TestJrpc_GetTitle
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
j
:=
newJrpc
(
api
)
req
:=
&
types
.
ReqString
{
Data
:
"xxxxxxxxxxx"
}
var
result
interface
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetTitle"
,
req
)
.
Return
(
&
pt
.
ParacrossStatus
{
Title
:
"user.p.para"
,
Height
:
int64
(
64
),
BlockHash
:
[]
byte
{
177
,
17
,
9
,
106
,
247
,
117
,
90
,
242
,
221
,
160
,
157
,
31
,
33
,
51
,
10
,
99
,
77
,
47
,
245
,
223
,
59
,
64
,
121
,
121
,
215
,
167
,
152
,
17
,
223
,
218
,
173
,
83
}},
nil
)
api
.
On
(
"GetLastHeader"
,
mock
.
Anything
)
.
Return
(
&
types
.
Header
{},
nil
)
.
Once
()
err
:=
j
.
GetHeight
(
req
,
&
result
)
assert
.
Nil
(
t
,
err
)
}
func
TestChannelClient_ListTitles
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
client
:=
newGrpc
(
api
)
client
.
Init
(
"paracross"
,
nil
,
nil
,
nil
)
req
:=
&
types
.
ReqNil
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"ListTitles"
,
req
)
.
Return
(
&
pt
.
RespParacrossTitles
{},
nil
)
_
,
err
:=
client
.
ListTitles
(
context
.
Background
(),
req
)
assert
.
Nil
(
t
,
err
)
}
func
TestJrpc_ListTitles
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
j
:=
newJrpc
(
api
)
req
:=
&
types
.
ReqNil
{}
var
result
interface
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"ListTitles"
,
req
)
.
Return
(
&
pt
.
RespParacrossTitles
{},
nil
)
err
:=
j
.
ListTitles
(
req
,
&
result
)
assert
.
Nil
(
t
,
err
)
}
func
TestChannelClient_GetTitleHeight
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
client
:=
newGrpc
(
api
)
client
.
Init
(
"paracross"
,
nil
,
nil
,
nil
)
req
:=
&
pt
.
ReqParacrossTitleHeight
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetTitleHeight"
,
req
)
.
Return
(
&
pt
.
ParacrossHeightStatusRsp
{},
nil
)
_
,
err
:=
client
.
GetTitleHeight
(
context
.
Background
(),
req
)
assert
.
Nil
(
t
,
err
)
}
func
TestChannelClient_GetTitleDoneHeight
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
client
:=
newGrpc
(
api
)
client
.
Init
(
"paracross"
,
nil
,
nil
,
nil
)
req
:=
&
pt
.
ReqParacrossTitleHeight
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetDoneTitleHeight"
,
req
)
.
Return
(
&
pt
.
RespParacrossDone
{},
nil
)
_
,
err
:=
client
.
GetDoneTitleHeight
(
context
.
Background
(),
req
)
assert
.
Nil
(
t
,
err
)
}
func
TestJrpc_GetTitleHeight
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
j
:=
newJrpc
(
api
)
req
:=
&
pt
.
ReqParacrossTitleHeight
{}
var
result
interface
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetTitleHeight"
,
req
)
.
Return
(
&
pt
.
ParacrossHeightStatusRsp
{},
nil
)
err
:=
j
.
GetTitleHeight
(
req
,
&
result
)
assert
.
Nil
(
t
,
err
)
}
func
TestChannelClient_GetAssetTxResult
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
client
:=
newGrpc
(
api
)
client
.
Init
(
"paracross"
,
nil
,
nil
,
nil
)
req
:=
&
types
.
ReqString
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetAssetTxResult"
,
req
)
.
Return
(
&
pt
.
ParacrossAssetRsp
{},
nil
)
_
,
err
:=
client
.
GetAssetTxResult
(
context
.
Background
(),
req
)
assert
.
Nil
(
t
,
err
)
}
func
TestJrpc_GetAssetTxResult
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
.
On
(
"GetConfig"
,
mock
.
Anything
)
.
Return
(
cfg
,
nil
)
j
:=
newJrpc
(
api
)
req
:=
&
types
.
ReqString
{}
var
result
interface
{}
api
.
On
(
"Query"
,
pt
.
GetExecName
(
cfg
),
"GetAssetTxResult"
,
req
)
.
Return
(
&
pt
.
ParacrossAssetRsp
{},
nil
)
err
:=
j
.
GetAssetTxResult
(
req
,
&
result
)
assert
.
Nil
(
t
,
err
)
}
func
TestChannelClient_IsSync
(
t
*
testing
.
T
)
{
func
TestChannelClient_IsSync
(
t
*
testing
.
T
)
{
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
cfg
:=
types
.
NewChain33Config
(
ptestNode
.
DefaultConfig
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
api
:=
new
(
mocks
.
QueueProtocolAPI
)
...
...
plugin/dapp/paracross/testnode/para_test.go
View file @
5795fe6b
...
@@ -6,7 +6,10 @@ import (
...
@@ -6,7 +6,10 @@ import (
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/util"
_
"github.com/33cn/chain33/system"
_
"github.com/33cn/chain33/system"
"github.com/33cn/chain33/types"
_
"github.com/33cn/plugin/plugin"
_
"github.com/33cn/plugin/plugin"
pt
"github.com/33cn/plugin/plugin/dapp/paracross/types"
"github.com/stretchr/testify/assert"
)
)
func
TestParaNode
(
t
*
testing
.
T
)
{
func
TestParaNode
(
t
*
testing
.
T
)
{
...
@@ -20,4 +23,8 @@ func TestParaNode(t *testing.T) {
...
@@ -20,4 +23,8 @@ func TestParaNode(t *testing.T) {
tx
=
util
.
CreateTxWithExecer
(
paraCfg
,
para
.
Para
.
GetGenesisKey
(),
"user.p.test.none"
)
tx
=
util
.
CreateTxWithExecer
(
paraCfg
,
para
.
Para
.
GetGenesisKey
(),
"user.p.test.none"
)
para
.
Para
.
SendTxRPC
(
tx
)
para
.
Para
.
SendTxRPC
(
tx
)
para
.
Para
.
WaitHeight
(
2
)
para
.
Para
.
WaitHeight
(
2
)
res
,
err
:=
para
.
Para
.
GetAPI
()
.
Query
(
pt
.
ParaX
,
"GetTitle"
,
&
types
.
ReqString
{
Data
:
"user.p.test."
})
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
int64
(
-
1
),
res
.
(
*
pt
.
ParacrossStatus
)
.
Height
)
}
}
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