Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
张蕾
Geth-Modification
Commits
206fe259
Commit
206fe259
authored
May 14, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: remove testlog
parent
7fa2607b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
51 deletions
+0
-51
peer_test.go
p2p/peer_test.go
+0
-11
server_test.go
p2p/server_test.go
+0
-15
testlog_test.go
p2p/testlog_test.go
+0
-25
No files found.
p2p/peer_test.go
View file @
206fe259
...
...
@@ -50,8 +50,6 @@ func testPeer(protos []Protocol) (func(), *conn, *Peer, <-chan DiscReason) {
}
func
TestPeerProtoReadMsg
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
done
:=
make
(
chan
struct
{})
proto
:=
Protocol
{
Name
:
"a"
,
...
...
@@ -88,8 +86,6 @@ func TestPeerProtoReadMsg(t *testing.T) {
}
func
TestPeerProtoEncodeMsg
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
proto
:=
Protocol
{
Name
:
"a"
,
Length
:
2
,
...
...
@@ -112,8 +108,6 @@ func TestPeerProtoEncodeMsg(t *testing.T) {
}
func
TestPeerWriteForBroadcast
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
closer
,
rw
,
peer
,
peerErr
:=
testPeer
([]
Protocol
{
discard
})
defer
closer
()
...
...
@@ -152,8 +146,6 @@ func TestPeerWriteForBroadcast(t *testing.T) {
}
func
TestPeerPing
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
closer
,
rw
,
_
,
_
:=
testPeer
(
nil
)
defer
closer
()
if
err
:=
SendItems
(
rw
,
pingMsg
);
err
!=
nil
{
...
...
@@ -165,8 +157,6 @@ func TestPeerPing(t *testing.T) {
}
func
TestPeerDisconnect
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
closer
,
rw
,
_
,
disc
:=
testPeer
(
nil
)
defer
closer
()
if
err
:=
SendItems
(
rw
,
discMsg
,
DiscQuitting
);
err
!=
nil
{
...
...
@@ -185,7 +175,6 @@ func TestPeerDisconnect(t *testing.T) {
// This test is supposed to verify that Peer can reliably handle
// multiple causes of disconnection occurring at the same time.
func
TestPeerDisconnectRace
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
maybe
:=
func
()
bool
{
return
rand
.
Intn
(
1
)
==
1
}
for
i
:=
0
;
i
<
1000
;
i
++
{
...
...
p2p/server_test.go
View file @
206fe259
...
...
@@ -46,8 +46,6 @@ func startTestServer(t *testing.T, pf newPeerHook) *Server {
}
func
TestServerListen
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// start the test server
connected
:=
make
(
chan
*
Peer
)
srv
:=
startTestServer
(
t
,
func
(
p
*
Peer
)
{
...
...
@@ -78,8 +76,6 @@ func TestServerListen(t *testing.T) {
}
func
TestServerDial
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// run a one-shot TCP server to handle the connection.
listener
,
err
:=
net
.
Listen
(
"tcp"
,
"127.0.0.1:0"
)
if
err
!=
nil
{
...
...
@@ -126,8 +122,6 @@ func TestServerDial(t *testing.T) {
}
func
TestServerBroadcast
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
var
connected
sync
.
WaitGroup
srv
:=
startTestServer
(
t
,
func
(
p
*
Peer
)
{
p
.
running
=
matchProtocols
([]
Protocol
{
discard
},
[]
Cap
{
discard
.
cap
()},
p
.
rw
)
...
...
@@ -172,8 +166,6 @@ func TestServerBroadcast(t *testing.T) {
//
// It also serves as a light-weight integration test.
func
TestServerDisconnectAtCap
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
started
:=
make
(
chan
*
Peer
)
srv
:=
&
Server
{
ListenAddr
:
"127.0.0.1:0"
,
...
...
@@ -224,8 +216,6 @@ func TestServerDisconnectAtCap(t *testing.T) {
// Tests that static peers are (re)connected, and done so even above max peers.
func
TestServerStaticPeers
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// Create a test server with limited connection slots
started
:=
make
(
chan
*
Peer
)
server
:=
&
Server
{
...
...
@@ -312,7 +302,6 @@ func TestServerStaticPeers(t *testing.T) {
// Tests that trusted peers and can connect above max peer caps.
func
TestServerTrustedPeers
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// Create a trusted peer to accept connections from
key
:=
newkey
()
...
...
@@ -374,8 +363,6 @@ func TestServerTrustedPeers(t *testing.T) {
// Tests that a failed dial will temporarily throttle a peer.
func
TestServerMaxPendingDials
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// Start a simple test server
server
:=
&
Server
{
ListenAddr
:
"127.0.0.1:0"
,
...
...
@@ -443,8 +430,6 @@ func TestServerMaxPendingDials(t *testing.T) {
}
func
TestServerMaxPendingAccepts
(
t
*
testing
.
T
)
{
defer
testlog
(
t
)
.
detach
()
// Start a test server and a peer sink for synchronization
started
:=
make
(
chan
*
Peer
)
server
:=
&
Server
{
...
...
p2p/testlog_test.go
deleted
100644 → 0
View file @
7fa2607b
package
p2p
import
(
"testing"
"github.com/ethereum/go-ethereum/logger"
)
type
testLogger
struct
{
t
*
testing
.
T
}
func
testlog
(
t
*
testing
.
T
)
testLogger
{
logger
.
Reset
()
l
:=
testLogger
{
t
}
logger
.
AddLogSystem
(
l
)
return
l
}
func
(
l
testLogger
)
LogPrint
(
msg
logger
.
LogMsg
)
{
l
.
t
.
Logf
(
"%s"
,
msg
.
String
())
}
func
(
testLogger
)
detach
()
{
logger
.
Flush
()
logger
.
Reset
()
}
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