Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
2abeb35d
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2abeb35d
编写于
1月 24, 2019
作者:
E
Elad
提交者:
Anton Evangelatov
1月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
p2p/testing, swarm: remove unused testing.T in protocol tester (#18500)
上级
c512d605
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
38 addition
and
39 deletion
+38
-39
p2p/protocols/protocol_test.go
p2p/protocols/protocol_test.go
+6
-6
p2p/testing/protocoltester.go
p2p/testing/protocoltester.go
+1
-2
swarm/network/protocol_test.go
swarm/network/protocol_test.go
+8
-7
swarm/network/stream/common_test.go
swarm/network/stream/common_test.go
+2
-3
swarm/network/stream/delivery_test.go
swarm/network/stream/delivery_test.go
+4
-4
swarm/network/stream/lightnode_test.go
swarm/network/stream/lightnode_test.go
+4
-4
swarm/network/stream/streamer_test.go
swarm/network/stream/streamer_test.go
+13
-13
未找到文件。
p2p/protocols/protocol_test.go
浏览文件 @
2abeb35d
...
@@ -142,9 +142,9 @@ func newProtocol(pp *p2ptest.TestPeerPool) func(*p2p.Peer, p2p.MsgReadWriter) er
...
@@ -142,9 +142,9 @@ func newProtocol(pp *p2ptest.TestPeerPool) func(*p2p.Peer, p2p.MsgReadWriter) er
}
}
}
}
func
protocolTester
(
t
*
testing
.
T
,
pp
*
p2ptest
.
TestPeerPool
)
*
p2ptest
.
ProtocolTester
{
func
protocolTester
(
pp
*
p2ptest
.
TestPeerPool
)
*
p2ptest
.
ProtocolTester
{
conf
:=
adapters
.
RandomNodeConfig
()
conf
:=
adapters
.
RandomNodeConfig
()
return
p2ptest
.
NewProtocolTester
(
t
,
conf
.
ID
,
2
,
newProtocol
(
pp
))
return
p2ptest
.
NewProtocolTester
(
conf
.
ID
,
2
,
newProtocol
(
pp
))
}
}
func
protoHandshakeExchange
(
id
enode
.
ID
,
proto
*
protoHandshake
)
[]
p2ptest
.
Exchange
{
func
protoHandshakeExchange
(
id
enode
.
ID
,
proto
*
protoHandshake
)
[]
p2ptest
.
Exchange
{
...
@@ -173,7 +173,7 @@ func protoHandshakeExchange(id enode.ID, proto *protoHandshake) []p2ptest.Exchan
...
@@ -173,7 +173,7 @@ func protoHandshakeExchange(id enode.ID, proto *protoHandshake) []p2ptest.Exchan
func
runProtoHandshake
(
t
*
testing
.
T
,
proto
*
protoHandshake
,
errs
...
error
)
{
func
runProtoHandshake
(
t
*
testing
.
T
,
proto
*
protoHandshake
,
errs
...
error
)
{
pp
:=
p2ptest
.
NewTestPeerPool
()
pp
:=
p2ptest
.
NewTestPeerPool
()
s
:=
protocolTester
(
t
,
pp
)
s
:=
protocolTester
(
pp
)
// TODO: make this more than one handshake
// TODO: make this more than one handshake
node
:=
s
.
Nodes
[
0
]
node
:=
s
.
Nodes
[
0
]
if
err
:=
s
.
TestExchanges
(
protoHandshakeExchange
(
node
.
ID
(),
proto
)
...
);
err
!=
nil
{
if
err
:=
s
.
TestExchanges
(
protoHandshakeExchange
(
node
.
ID
(),
proto
)
...
);
err
!=
nil
{
...
@@ -250,7 +250,7 @@ func TestProtocolHook(t *testing.T) {
...
@@ -250,7 +250,7 @@ func TestProtocolHook(t *testing.T) {
}
}
conf
:=
adapters
.
RandomNodeConfig
()
conf
:=
adapters
.
RandomNodeConfig
()
tester
:=
p2ptest
.
NewProtocolTester
(
t
,
conf
.
ID
,
2
,
runFunc
)
tester
:=
p2ptest
.
NewProtocolTester
(
conf
.
ID
,
2
,
runFunc
)
err
:=
tester
.
TestExchanges
(
p2ptest
.
Exchange
{
err
:=
tester
.
TestExchanges
(
p2ptest
.
Exchange
{
Expects
:
[]
p2ptest
.
Expect
{
Expects
:
[]
p2ptest
.
Expect
{
{
{
...
@@ -392,7 +392,7 @@ func moduleHandshakeExchange(id enode.ID, resp uint) []p2ptest.Exchange {
...
@@ -392,7 +392,7 @@ func moduleHandshakeExchange(id enode.ID, resp uint) []p2ptest.Exchange {
func
runModuleHandshake
(
t
*
testing
.
T
,
resp
uint
,
errs
...
error
)
{
func
runModuleHandshake
(
t
*
testing
.
T
,
resp
uint
,
errs
...
error
)
{
pp
:=
p2ptest
.
NewTestPeerPool
()
pp
:=
p2ptest
.
NewTestPeerPool
()
s
:=
protocolTester
(
t
,
pp
)
s
:=
protocolTester
(
pp
)
node
:=
s
.
Nodes
[
0
]
node
:=
s
.
Nodes
[
0
]
if
err
:=
s
.
TestExchanges
(
protoHandshakeExchange
(
node
.
ID
(),
&
protoHandshake
{
42
,
"420"
})
...
);
err
!=
nil
{
if
err
:=
s
.
TestExchanges
(
protoHandshakeExchange
(
node
.
ID
(),
&
protoHandshake
{
42
,
"420"
})
...
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -472,7 +472,7 @@ func testMultiPeerSetup(a, b enode.ID) []p2ptest.Exchange {
...
@@ -472,7 +472,7 @@ func testMultiPeerSetup(a, b enode.ID) []p2ptest.Exchange {
func
runMultiplePeers
(
t
*
testing
.
T
,
peer
int
,
errs
...
error
)
{
func
runMultiplePeers
(
t
*
testing
.
T
,
peer
int
,
errs
...
error
)
{
pp
:=
p2ptest
.
NewTestPeerPool
()
pp
:=
p2ptest
.
NewTestPeerPool
()
s
:=
protocolTester
(
t
,
pp
)
s
:=
protocolTester
(
pp
)
if
err
:=
s
.
TestExchanges
(
testMultiPeerSetup
(
s
.
Nodes
[
0
]
.
ID
(),
s
.
Nodes
[
1
]
.
ID
())
...
);
err
!=
nil
{
if
err
:=
s
.
TestExchanges
(
testMultiPeerSetup
(
s
.
Nodes
[
0
]
.
ID
(),
s
.
Nodes
[
1
]
.
ID
())
...
);
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
p2p/testing/protocoltester.go
浏览文件 @
2abeb35d
...
@@ -30,7 +30,6 @@ import (
...
@@ -30,7 +30,6 @@ import (
"io/ioutil"
"io/ioutil"
"strings"
"strings"
"sync"
"sync"
"testing"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/node"
...
@@ -52,7 +51,7 @@ type ProtocolTester struct {
...
@@ -52,7 +51,7 @@ type ProtocolTester struct {
// NewProtocolTester constructs a new ProtocolTester
// NewProtocolTester constructs a new ProtocolTester
// it takes as argument the pivot node id, the number of dummy peers and the
// it takes as argument the pivot node id, the number of dummy peers and the
// protocol run function called on a peer connection by the p2p server
// protocol run function called on a peer connection by the p2p server
func
NewProtocolTester
(
t
*
testing
.
T
,
id
enode
.
ID
,
n
int
,
run
func
(
*
p2p
.
Peer
,
p2p
.
MsgReadWriter
)
error
)
*
ProtocolTester
{
func
NewProtocolTester
(
id
enode
.
ID
,
n
int
,
run
func
(
*
p2p
.
Peer
,
p2p
.
MsgReadWriter
)
error
)
*
ProtocolTester
{
services
:=
adapters
.
Services
{
services
:=
adapters
.
Services
{
"test"
:
func
(
ctx
*
adapters
.
ServiceContext
)
(
node
.
Service
,
error
)
{
"test"
:
func
(
ctx
*
adapters
.
ServiceContext
)
(
node
.
Service
,
error
)
{
return
&
testNode
{
run
},
nil
return
&
testNode
{
run
},
nil
...
...
swarm/network/protocol_test.go
浏览文件 @
2abeb35d
...
@@ -83,7 +83,7 @@ func newBzzBaseTester(t *testing.T, n int, addr *BzzAddr, spec *protocols.Spec,
...
@@ -83,7 +83,7 @@ func newBzzBaseTester(t *testing.T, n int, addr *BzzAddr, spec *protocols.Spec,
return
srv
(
&
BzzPeer
{
Peer
:
protocols
.
NewPeer
(
p
,
rw
,
spec
),
BzzAddr
:
NewAddr
(
p
.
Node
())})
return
srv
(
&
BzzPeer
{
Peer
:
protocols
.
NewPeer
(
p
,
rw
,
spec
),
BzzAddr
:
NewAddr
(
p
.
Node
())})
}
}
s
:=
p2ptest
.
NewProtocolTester
(
t
,
addr
.
ID
(),
n
,
protocol
)
s
:=
p2ptest
.
NewProtocolTester
(
addr
.
ID
(),
n
,
protocol
)
for
_
,
node
:=
range
s
.
Nodes
{
for
_
,
node
:=
range
s
.
Nodes
{
cs
[
node
.
ID
()
.
String
()]
=
make
(
chan
bool
)
cs
[
node
.
ID
()
.
String
()]
=
make
(
chan
bool
)
...
@@ -116,9 +116,9 @@ func newBzz(addr *BzzAddr, lightNode bool) *Bzz {
...
@@ -116,9 +116,9 @@ func newBzz(addr *BzzAddr, lightNode bool) *Bzz {
return
bzz
return
bzz
}
}
func
newBzzHandshakeTester
(
t
*
testing
.
T
,
n
int
,
addr
*
BzzAddr
,
lightNode
bool
)
*
bzzTester
{
func
newBzzHandshakeTester
(
n
int
,
addr
*
BzzAddr
,
lightNode
bool
)
*
bzzTester
{
bzz
:=
newBzz
(
addr
,
lightNode
)
bzz
:=
newBzz
(
addr
,
lightNode
)
pt
:=
p2ptest
.
NewProtocolTester
(
t
,
addr
.
ID
(),
n
,
bzz
.
runBzz
)
pt
:=
p2ptest
.
NewProtocolTester
(
addr
.
ID
(),
n
,
bzz
.
runBzz
)
return
&
bzzTester
{
return
&
bzzTester
{
addr
:
addr
,
addr
:
addr
,
...
@@ -166,7 +166,7 @@ func correctBzzHandshake(addr *BzzAddr, lightNode bool) *HandshakeMsg {
...
@@ -166,7 +166,7 @@ func correctBzzHandshake(addr *BzzAddr, lightNode bool) *HandshakeMsg {
func
TestBzzHandshakeNetworkIDMismatch
(
t
*
testing
.
T
)
{
func
TestBzzHandshakeNetworkIDMismatch
(
t
*
testing
.
T
)
{
lightNode
:=
false
lightNode
:=
false
addr
:=
RandomAddr
()
addr
:=
RandomAddr
()
s
:=
newBzzHandshakeTester
(
t
,
1
,
addr
,
lightNode
)
s
:=
newBzzHandshakeTester
(
1
,
addr
,
lightNode
)
node
:=
s
.
Nodes
[
0
]
node
:=
s
.
Nodes
[
0
]
err
:=
s
.
testHandshake
(
err
:=
s
.
testHandshake
(
...
@@ -183,7 +183,7 @@ func TestBzzHandshakeNetworkIDMismatch(t *testing.T) {
...
@@ -183,7 +183,7 @@ func TestBzzHandshakeNetworkIDMismatch(t *testing.T) {
func
TestBzzHandshakeVersionMismatch
(
t
*
testing
.
T
)
{
func
TestBzzHandshakeVersionMismatch
(
t
*
testing
.
T
)
{
lightNode
:=
false
lightNode
:=
false
addr
:=
RandomAddr
()
addr
:=
RandomAddr
()
s
:=
newBzzHandshakeTester
(
t
,
1
,
addr
,
lightNode
)
s
:=
newBzzHandshakeTester
(
1
,
addr
,
lightNode
)
node
:=
s
.
Nodes
[
0
]
node
:=
s
.
Nodes
[
0
]
err
:=
s
.
testHandshake
(
err
:=
s
.
testHandshake
(
...
@@ -200,7 +200,7 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) {
...
@@ -200,7 +200,7 @@ func TestBzzHandshakeVersionMismatch(t *testing.T) {
func
TestBzzHandshakeSuccess
(
t
*
testing
.
T
)
{
func
TestBzzHandshakeSuccess
(
t
*
testing
.
T
)
{
lightNode
:=
false
lightNode
:=
false
addr
:=
RandomAddr
()
addr
:=
RandomAddr
()
s
:=
newBzzHandshakeTester
(
t
,
1
,
addr
,
lightNode
)
s
:=
newBzzHandshakeTester
(
1
,
addr
,
lightNode
)
node
:=
s
.
Nodes
[
0
]
node
:=
s
.
Nodes
[
0
]
err
:=
s
.
testHandshake
(
err
:=
s
.
testHandshake
(
...
@@ -225,7 +225,8 @@ func TestBzzHandshakeLightNode(t *testing.T) {
...
@@ -225,7 +225,8 @@ func TestBzzHandshakeLightNode(t *testing.T) {
for
_
,
test
:=
range
lightNodeTests
{
for
_
,
test
:=
range
lightNodeTests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
randomAddr
:=
RandomAddr
()
randomAddr
:=
RandomAddr
()
pt
:=
newBzzHandshakeTester
(
nil
,
1
,
randomAddr
,
false
)
// TODO change signature - t is not used anywhere
pt
:=
newBzzHandshakeTester
(
1
,
randomAddr
,
false
)
node
:=
pt
.
Nodes
[
0
]
node
:=
pt
.
Nodes
[
0
]
addr
:=
NewAddr
(
node
)
addr
:=
NewAddr
(
node
)
...
...
swarm/network/stream/common_test.go
浏览文件 @
2abeb35d
...
@@ -27,7 +27,6 @@ import (
...
@@ -27,7 +27,6 @@ import (
"os"
"os"
"strings"
"strings"
"sync/atomic"
"sync/atomic"
"testing"
"time"
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -67,7 +66,7 @@ func init() {
...
@@ -67,7 +66,7 @@ func init() {
log
.
Root
()
.
SetHandler
(
log
.
LvlFilterHandler
(
log
.
Lvl
(
*
loglevel
),
log
.
StreamHandler
(
colorable
.
NewColorableStderr
(),
log
.
TerminalFormat
(
true
))))
log
.
Root
()
.
SetHandler
(
log
.
LvlFilterHandler
(
log
.
Lvl
(
*
loglevel
),
log
.
StreamHandler
(
colorable
.
NewColorableStderr
(),
log
.
TerminalFormat
(
true
))))
}
}
func
newStreamerTester
(
t
*
testing
.
T
,
registryOptions
*
RegistryOptions
)
(
*
p2ptest
.
ProtocolTester
,
*
Registry
,
*
storage
.
LocalStore
,
func
(),
error
)
{
func
newStreamerTester
(
registryOptions
*
RegistryOptions
)
(
*
p2ptest
.
ProtocolTester
,
*
Registry
,
*
storage
.
LocalStore
,
func
(),
error
)
{
// setup
// setup
addr
:=
network
.
RandomAddr
()
// tested peers peer address
addr
:=
network
.
RandomAddr
()
// tested peers peer address
to
:=
network
.
NewKademlia
(
addr
.
OAddr
,
network
.
NewKadParams
())
to
:=
network
.
NewKademlia
(
addr
.
OAddr
,
network
.
NewKadParams
())
...
@@ -102,7 +101,7 @@ func newStreamerTester(t *testing.T, registryOptions *RegistryOptions) (*p2ptest
...
@@ -102,7 +101,7 @@ func newStreamerTester(t *testing.T, registryOptions *RegistryOptions) (*p2ptest
streamer
.
Close
()
streamer
.
Close
()
removeDataDir
()
removeDataDir
()
}
}
protocolTester
:=
p2ptest
.
NewProtocolTester
(
t
,
addr
.
ID
(),
1
,
streamer
.
runProtocol
)
protocolTester
:=
p2ptest
.
NewProtocolTester
(
addr
.
ID
(),
1
,
streamer
.
runProtocol
)
err
=
waitForPeers
(
streamer
,
1
*
time
.
Second
,
1
)
err
=
waitForPeers
(
streamer
,
1
*
time
.
Second
,
1
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
swarm/network/stream/delivery_test.go
浏览文件 @
2abeb35d
...
@@ -48,7 +48,7 @@ func TestStreamerRetrieveRequest(t *testing.T) {
...
@@ -48,7 +48,7 @@ func TestStreamerRetrieveRequest(t *testing.T) {
Retrieval
:
RetrievalClientOnly
,
Retrieval
:
RetrievalClientOnly
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
}
}
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
regOpts
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
regOpts
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -97,7 +97,7 @@ func TestStreamerRetrieveRequest(t *testing.T) {
...
@@ -97,7 +97,7 @@ func TestStreamerRetrieveRequest(t *testing.T) {
//Test requesting a chunk from a peer then issuing a "empty" OfferedHashesMsg (no hashes available yet)
//Test requesting a chunk from a peer then issuing a "empty" OfferedHashesMsg (no hashes available yet)
//Should time out as the peer does not have the chunk (no syncing happened previously)
//Should time out as the peer does not have the chunk (no syncing happened previously)
func
TestStreamerUpstreamRetrieveRequestMsgExchangeWithoutStore
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamRetrieveRequestMsgExchangeWithoutStore
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
Retrieval
:
RetrievalEnabled
,
Retrieval
:
RetrievalEnabled
,
Syncing
:
SyncingDisabled
,
//do no syncing
Syncing
:
SyncingDisabled
,
//do no syncing
})
})
...
@@ -169,7 +169,7 @@ func TestStreamerUpstreamRetrieveRequestMsgExchangeWithoutStore(t *testing.T) {
...
@@ -169,7 +169,7 @@ func TestStreamerUpstreamRetrieveRequestMsgExchangeWithoutStore(t *testing.T) {
// upstream request server receives a retrieve Request and responds with
// upstream request server receives a retrieve Request and responds with
// offered hashes or delivery if skipHash is set to true
// offered hashes or delivery if skipHash is set to true
func
TestStreamerUpstreamRetrieveRequestMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamRetrieveRequestMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
localStore
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
tester
,
streamer
,
localStore
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
Retrieval
:
RetrievalEnabled
,
Retrieval
:
RetrievalEnabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
})
})
...
@@ -359,7 +359,7 @@ func TestRequestFromPeersWithLightNode(t *testing.T) {
...
@@ -359,7 +359,7 @@ func TestRequestFromPeersWithLightNode(t *testing.T) {
}
}
func
TestStreamerDownstreamChunkDeliveryMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerDownstreamChunkDeliveryMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
localStore
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
tester
,
streamer
,
localStore
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
})
})
...
...
swarm/network/stream/lightnode_test.go
浏览文件 @
2abeb35d
...
@@ -28,7 +28,7 @@ func TestLigthnodeRetrieveRequestWithRetrieve(t *testing.T) {
...
@@ -28,7 +28,7 @@ func TestLigthnodeRetrieveRequestWithRetrieve(t *testing.T) {
Retrieval
:
RetrievalClientOnly
,
Retrieval
:
RetrievalClientOnly
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
}
}
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
registryOptions
)
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
registryOptions
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -67,7 +67,7 @@ func TestLigthnodeRetrieveRequestWithoutRetrieve(t *testing.T) {
...
@@ -67,7 +67,7 @@ func TestLigthnodeRetrieveRequestWithoutRetrieve(t *testing.T) {
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
}
}
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
registryOptions
)
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
registryOptions
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -111,7 +111,7 @@ func TestLigthnodeRequestSubscriptionWithSync(t *testing.T) {
...
@@ -111,7 +111,7 @@ func TestLigthnodeRequestSubscriptionWithSync(t *testing.T) {
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingRegisterOnly
,
Syncing
:
SyncingRegisterOnly
,
}
}
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
registryOptions
)
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
registryOptions
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -156,7 +156,7 @@ func TestLigthnodeRequestSubscriptionWithoutSync(t *testing.T) {
...
@@ -156,7 +156,7 @@ func TestLigthnodeRequestSubscriptionWithoutSync(t *testing.T) {
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
}
}
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
registryOptions
)
tester
,
_
,
_
,
teardown
,
err
:=
newStreamerTester
(
registryOptions
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
...
swarm/network/stream/streamer_test.go
浏览文件 @
2abeb35d
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
)
)
func
TestStreamerSubscribe
(
t
*
testing
.
T
)
{
func
TestStreamerSubscribe
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -48,7 +48,7 @@ func TestStreamerSubscribe(t *testing.T) {
...
@@ -48,7 +48,7 @@ func TestStreamerSubscribe(t *testing.T) {
}
}
func
TestStreamerRequestSubscription
(
t
*
testing
.
T
)
{
func
TestStreamerRequestSubscription
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -139,7 +139,7 @@ func (self *testServer) Close() {
...
@@ -139,7 +139,7 @@ func (self *testServer) Close() {
}
}
func
TestStreamerDownstreamSubscribeUnsubscribeMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerDownstreamSubscribeUnsubscribeMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -232,7 +232,7 @@ func TestStreamerDownstreamSubscribeUnsubscribeMsgExchange(t *testing.T) {
...
@@ -232,7 +232,7 @@ func TestStreamerDownstreamSubscribeUnsubscribeMsgExchange(t *testing.T) {
}
}
func
TestStreamerUpstreamSubscribeUnsubscribeMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamSubscribeUnsubscribeMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -299,7 +299,7 @@ func TestStreamerUpstreamSubscribeUnsubscribeMsgExchange(t *testing.T) {
...
@@ -299,7 +299,7 @@ func TestStreamerUpstreamSubscribeUnsubscribeMsgExchange(t *testing.T) {
}
}
func
TestStreamerUpstreamSubscribeUnsubscribeMsgExchangeLive
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamSubscribeUnsubscribeMsgExchangeLive
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -365,7 +365,7 @@ func TestStreamerUpstreamSubscribeUnsubscribeMsgExchangeLive(t *testing.T) {
...
@@ -365,7 +365,7 @@ func TestStreamerUpstreamSubscribeUnsubscribeMsgExchangeLive(t *testing.T) {
}
}
func
TestStreamerUpstreamSubscribeErrorMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamSubscribeErrorMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -409,7 +409,7 @@ func TestStreamerUpstreamSubscribeErrorMsgExchange(t *testing.T) {
...
@@ -409,7 +409,7 @@ func TestStreamerUpstreamSubscribeErrorMsgExchange(t *testing.T) {
}
}
func
TestStreamerUpstreamSubscribeLiveAndHistory
(
t
*
testing
.
T
)
{
func
TestStreamerUpstreamSubscribeLiveAndHistory
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -472,7 +472,7 @@ func TestStreamerUpstreamSubscribeLiveAndHistory(t *testing.T) {
...
@@ -472,7 +472,7 @@ func TestStreamerUpstreamSubscribeLiveAndHistory(t *testing.T) {
}
}
func
TestStreamerDownstreamCorruptHashesMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerDownstreamCorruptHashesMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -537,7 +537,7 @@ func TestStreamerDownstreamCorruptHashesMsgExchange(t *testing.T) {
...
@@ -537,7 +537,7 @@ func TestStreamerDownstreamCorruptHashesMsgExchange(t *testing.T) {
}
}
func
TestStreamerDownstreamOfferedHashesMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerDownstreamOfferedHashesMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -636,7 +636,7 @@ func TestStreamerDownstreamOfferedHashesMsgExchange(t *testing.T) {
...
@@ -636,7 +636,7 @@ func TestStreamerDownstreamOfferedHashesMsgExchange(t *testing.T) {
}
}
func
TestStreamerRequestSubscriptionQuitMsgExchange
(
t
*
testing
.
T
)
{
func
TestStreamerRequestSubscriptionQuitMsgExchange
(
t
*
testing
.
T
)
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
nil
)
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
nil
)
defer
teardown
()
defer
teardown
()
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
...
@@ -769,7 +769,7 @@ func TestStreamerRequestSubscriptionQuitMsgExchange(t *testing.T) {
...
@@ -769,7 +769,7 @@ func TestStreamerRequestSubscriptionQuitMsgExchange(t *testing.T) {
// leaving place for new streams.
// leaving place for new streams.
func
TestMaxPeerServersWithUnsubscribe
(
t
*
testing
.
T
)
{
func
TestMaxPeerServersWithUnsubscribe
(
t
*
testing
.
T
)
{
var
maxPeerServers
=
6
var
maxPeerServers
=
6
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
MaxPeerServers
:
maxPeerServers
,
MaxPeerServers
:
maxPeerServers
,
...
@@ -845,7 +845,7 @@ func TestMaxPeerServersWithUnsubscribe(t *testing.T) {
...
@@ -845,7 +845,7 @@ func TestMaxPeerServersWithUnsubscribe(t *testing.T) {
// error message exchange.
// error message exchange.
func
TestMaxPeerServersWithoutUnsubscribe
(
t
*
testing
.
T
)
{
func
TestMaxPeerServersWithoutUnsubscribe
(
t
*
testing
.
T
)
{
var
maxPeerServers
=
6
var
maxPeerServers
=
6
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
tester
,
streamer
,
_
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
MaxPeerServers
:
maxPeerServers
,
MaxPeerServers
:
maxPeerServers
,
})
})
defer
teardown
()
defer
teardown
()
...
@@ -930,7 +930,7 @@ func TestMaxPeerServersWithoutUnsubscribe(t *testing.T) {
...
@@ -930,7 +930,7 @@ func TestMaxPeerServersWithoutUnsubscribe(t *testing.T) {
//TestHasPriceImplementation is to check that the Registry has a
//TestHasPriceImplementation is to check that the Registry has a
//`Price` interface implementation
//`Price` interface implementation
func
TestHasPriceImplementation
(
t
*
testing
.
T
)
{
func
TestHasPriceImplementation
(
t
*
testing
.
T
)
{
_
,
r
,
_
,
teardown
,
err
:=
newStreamerTester
(
t
,
&
RegistryOptions
{
_
,
r
,
_
,
teardown
,
err
:=
newStreamerTester
(
&
RegistryOptions
{
Retrieval
:
RetrievalDisabled
,
Retrieval
:
RetrievalDisabled
,
Syncing
:
SyncingDisabled
,
Syncing
:
SyncingDisabled
,
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录