Skip to content

Commit

Permalink
test(p2p): use 'asQriNodes' all over the place
Browse files Browse the repository at this point in the history
  • Loading branch information
b5 committed Oct 10, 2018
1 parent 14d473f commit da6b5a3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 35 deletions.
6 changes: 1 addition & 5 deletions p2p/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ func TestRequestDatasetInfo(t *testing.T) {
t.Errorf("error connecting peers: %s", err.Error())
}

// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}
peers := asQriNodes(testPeers)

refs := []repo.DatasetRef{}
for _, c := range peers {
Expand Down
6 changes: 1 addition & 5 deletions p2p/datasets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ func TestRequestDatasetsList(t *testing.T) {
t.Errorf("error connecting peers: %s", err.Error())
}

// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}
peers := asQriNodes(testPeers)

t.Logf("testing RequestDatasetList message with %d peers", len(peers))
var wg sync.WaitGroup
Expand Down
7 changes: 2 additions & 5 deletions p2p/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ func TestRequestEventsList(t *testing.T) {
t.Errorf("error creating network: %s", err.Error())
return
}
// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}

peers := asQriNodes(testPeers)

for _, p := range peers {
p.Repo.LogEvent(repo.ETDsCreated, repo.DatasetRef{})
Expand Down
6 changes: 1 addition & 5 deletions p2p/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ func TestRequestDatasetLog(t *testing.T) {
t.Errorf("error connecting peers: %s", err.Error())
}

// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}
peers := asQriNodes(testPeers)

tc, err := dstest.NewTestCaseFromDir("testdata/tim/craigslist")
if err != nil {
Expand Down
8 changes: 3 additions & 5 deletions p2p/ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package p2p

import (
"context"
"github.com/qri-io/qri/p2p/test"
"testing"

"github.com/qri-io/qri/p2p/test"
)

func TestPing(t *testing.T) {
Expand All @@ -16,10 +17,7 @@ func TestPing(t *testing.T) {
}

// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, arg := range testPeers {
peers[i] = arg.(*QriNode)
}
peers := asQriNodes(testPeers)

if err := p2ptest.ConnectNodes(ctx, testPeers); err != nil {
t.Errorf("error connecting peers: %s", err.Error())
Expand Down
13 changes: 3 additions & 10 deletions p2p/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ func TestRequestProfileConnectNodes(t *testing.T) {
t.Errorf("error creating network: %s", err.Error())
return
}
// Convert from test nodes to non-test nodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}

peers := asQriNodes(testPeers)

if err := p2ptest.ConnectNodes(ctx, testPeers); err != nil {
t.Errorf("error connecting peers: %s", err.Error())
Expand Down Expand Up @@ -110,11 +107,7 @@ func TestRequestProfileOneWayConnection(t *testing.T) {
return
}

// Convert from test nodes to QriNodes.
peers := make([]*QriNode, len(testPeers))
for i, node := range testPeers {
peers[i] = node.(*QriNode)
}
peers := asQriNodes(testPeers)

p1 := peers[0]
peers = peers[1:]
Expand Down

0 comments on commit da6b5a3

Please sign in to comment.