good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
46ea193a
Commit
46ea193a
authored
10 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
whisper: remove some unneeded testing complexity
parent
bcf41797
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
whisper/common_test.go
+0
-29
0 additions, 29 deletions
whisper/common_test.go
whisper/peer_test.go
+3
-2
3 additions, 2 deletions
whisper/peer_test.go
whisper/whisper_test.go
+2
-1
2 additions, 1 deletion
whisper/whisper_test.go
with
5 additions
and
32 deletions
whisper/common_test.go
+
0
−
29
View file @
46ea193a
...
...
@@ -4,40 +4,11 @@ package whisper
import
(
"bytes"
"fmt"
"io/ioutil"
"math/rand"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
)
// randomNodeID generates and returns a random P2P discovery node id for the
// whisper tests.
func
randomNodeID
()
(
id
discover
.
NodeID
)
{
for
i
:=
range
id
{
id
[
i
]
=
byte
(
rand
.
Intn
(
255
))
}
return
id
}
// randomNodeName generates and returns a random P2P node name for the whisper
// tests.
func
randomNodeName
()
string
{
return
common
.
MakeName
(
fmt
.
Sprintf
(
"whisper-go-test-%3d"
,
rand
.
Intn
(
999
)),
"1.0"
)
}
// whisperCaps returns the node capabilities for running the whisper sub-protocol.
func
whisperCaps
()
[]
p2p
.
Cap
{
return
[]
p2p
.
Cap
{
p2p
.
Cap
{
Name
:
protocolName
,
Version
:
uint
(
protocolVersion
),
},
}
}
// bufMsgPipe creates a buffered message pipe between two endpoints.
func
bufMsgPipe
()
(
*
p2p
.
MsgPipeRW
,
*
p2p
.
MsgPipeRW
)
{
A
,
midA
:=
p2p
.
MsgPipe
()
...
...
This diff is collapsed.
Click to expand it.
whisper/peer_test.go
+
3
−
2
View file @
46ea193a
...
...
@@ -5,6 +5,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
)
type
testPeer
struct
{
...
...
@@ -15,7 +16,7 @@ type testPeer struct {
func
startTestPeer
()
*
testPeer
{
// Create a simulated P2P remote peer and data streams to it
remote
:=
p2p
.
NewPeer
(
randomNodeID
(),
randomNodeName
(),
whisperCaps
()
)
remote
:=
p2p
.
NewPeer
(
discover
.
NodeID
{},
""
,
nil
)
tester
,
tested
:=
p2p
.
MsgPipe
()
// Create a whisper client and connect with it to the tester peer
...
...
@@ -30,7 +31,7 @@ func startTestPeer() *testPeer {
client
.
handlePeer
(
remote
,
tested
)
}()
// Assemble and return the test peer
return
&
testPeer
{
client
:
client
,
stream
:
tester
,
...
...
This diff is collapsed.
Click to expand it.
whisper/whisper_test.go
+
2
−
1
View file @
46ea193a
...
...
@@ -5,13 +5,14 @@ import (
"time"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
)
func
startTestCluster
(
n
int
)
[]
*
Whisper
{
// Create the batch of simulated peers
nodes
:=
make
([]
*
p2p
.
Peer
,
n
)
for
i
:=
0
;
i
<
n
;
i
++
{
nodes
[
i
]
=
p2p
.
NewPeer
(
randomNodeID
(),
randomNodeName
(),
whisperCaps
()
)
nodes
[
i
]
=
p2p
.
NewPeer
(
discover
.
NodeID
{},
""
,
nil
)
}
whispers
:=
make
([]
*
Whisper
,
n
)
for
i
:=
0
;
i
<
n
;
i
++
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment