aboutsummaryrefslogtreecommitdiffstats
path: root/dex/peer_test.go
diff options
context:
space:
mode:
authorSonic <sonic@cobinhood.com>2018-10-12 15:02:33 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:49 +0800
commit1da23cc940d308e5376e3056c2737ddd2f01642a (patch)
tree39543166fae33dfe2dd70ce03900384c0ebd6d51 /dex/peer_test.go
parentcdf1f022696971d9d6209d577ed0b578e7462007 (diff)
downloaddexon-1da23cc940d308e5376e3056c2737ddd2f01642a.tar.gz
dexon-1da23cc940d308e5376e3056c2737ddd2f01642a.tar.zst
dexon-1da23cc940d308e5376e3056c2737ddd2f01642a.zip
dex: network: implement the network interface
Diffstat (limited to 'dex/peer_test.go')
-rw-r--r--dex/peer_test.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/dex/peer_test.go b/dex/peer_test.go
index bac6ed5ec..6e539e078 100644
--- a/dex/peer_test.go
+++ b/dex/peer_test.go
@@ -74,7 +74,7 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{notaryset, 0, 10},
},
@@ -120,7 +120,7 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{notaryset, 0, 10},
peerLabel{notaryset, 0, 11},
@@ -176,7 +176,7 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{notaryset, 0, 10},
peerLabel{notaryset, 0, 11},
@@ -242,7 +242,7 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(2).String(): []peerLabel{
peerLabel{notaryset, 2, 12},
},
@@ -291,7 +291,7 @@ func TestPeerSetBuildAndForgetNotaryConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{})
+ err = checkPeer2Labels(ps, map[string][]peerLabel{})
if err != nil {
t.Error(err)
}
@@ -354,7 +354,7 @@ func TestPeerSetBuildDKGConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{dkgset, 0, 10},
},
@@ -391,7 +391,7 @@ func TestPeerSetBuildDKGConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{dkgset, 0, 10},
},
@@ -428,7 +428,7 @@ func TestPeerSetBuildDKGConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(1).String(): []peerLabel{
peerLabel{dkgset, 0, 10},
},
@@ -467,7 +467,7 @@ func TestPeerSetBuildDKGConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{
+ err = checkPeer2Labels(ps, map[string][]peerLabel{
nodeID(3).String(): []peerLabel{
peerLabel{dkgset, 0, 12},
},
@@ -499,7 +499,7 @@ func TestPeerSetBuildDKGConn(t *testing.T) {
if err != nil {
t.Error(err)
}
- err = checkPeerLabels(ps, map[string][]peerLabel{})
+ err = checkPeer2Labels(ps, map[string][]peerLabel{})
if err != nil {
t.Error(err)
}
@@ -527,13 +527,13 @@ func checkLabels(p *peer, want []peerLabel) error {
return nil
}
-func checkPeerLabels(ps *peerSet, want map[string][]peerLabel) error {
- if len(ps.peerLabels) != len(want) {
+func checkPeer2Labels(ps *peerSet, want map[string][]peerLabel) error {
+ if len(ps.peer2Labels) != len(want) {
return fmt.Errorf("peer num mismatch: got %d, want %d",
- len(ps.peerLabels), len(want))
+ len(ps.peer2Labels), len(want))
}
- for peerID, gotLabels := range ps.peerLabels {
+ for peerID, gotLabels := range ps.peer2Labels {
wantLabels, ok := want[peerID]
if !ok {
return fmt.Errorf("peer id %s not exists", peerID)