mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-23 15:14:32 +00:00
parent
5340ce712c
commit
9d79d44f1b
4 changed files with 10 additions and 9 deletions
|
|
@ -49,7 +49,7 @@ import (
|
|||
// current binary as a child process.
|
||||
//
|
||||
// An init hook is used so that the child process executes the node services
|
||||
// (rather than whataver the main() function would normally do), see the
|
||||
// (rather than whatever the main() function would normally do), see the
|
||||
// execP2PNode function for more information.
|
||||
type ExecAdapter struct {
|
||||
// BaseDir is the directory under which the data directories for each
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ var testServices = adapters.LifecycleConstructors{
|
|||
}
|
||||
|
||||
func testHTTPServer(t *testing.T) (*Network, *httptest.Server) {
|
||||
t.Helper()
|
||||
adapter := adapters.NewSimAdapter(testServices)
|
||||
network := NewNetwork(adapter, &NetworkConfig{
|
||||
DefaultService: "test",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Package simulations simulates p2p networks.
|
||||
// A mokcer simulates starting and stopping real nodes in a network.
|
||||
// A mocker simulates starting and stopping real nodes in a network.
|
||||
package simulations
|
||||
|
||||
import (
|
||||
|
|
@ -132,13 +132,13 @@ func TestMocker(t *testing.T) {
|
|||
wg.Wait()
|
||||
|
||||
//check there are nodeCount number of nodes in the network
|
||||
nodes_info, err := client.GetNodes()
|
||||
nodesInfo, err := client.GetNodes()
|
||||
if err != nil {
|
||||
t.Fatalf("Could not get nodes list: %s", err)
|
||||
}
|
||||
|
||||
if len(nodes_info) != nodeCount {
|
||||
t.Fatalf("Expected %d number of nodes, got: %d", nodeCount, len(nodes_info))
|
||||
if len(nodesInfo) != nodeCount {
|
||||
t.Fatalf("Expected %d number of nodes, got: %d", nodeCount, len(nodesInfo))
|
||||
}
|
||||
|
||||
//stop the mocker
|
||||
|
|
@ -159,12 +159,12 @@ func TestMocker(t *testing.T) {
|
|||
resp.Body.Close()
|
||||
|
||||
//now the number of nodes in the network should be zero
|
||||
nodes_info, err = client.GetNodes()
|
||||
nodesInfo, err = client.GetNodes()
|
||||
if err != nil {
|
||||
t.Fatalf("Could not get nodes list: %s", err)
|
||||
}
|
||||
|
||||
if len(nodes_info) != 0 {
|
||||
t.Fatalf("Expected empty list of nodes, got: %d", len(nodes_info))
|
||||
if len(nodesInfo) != 0 {
|
||||
t.Fatalf("Expected empty list of nodes, got: %d", len(nodesInfo))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ func (net *Network) getConn(oneID, otherID discover.NodeID) *Conn {
|
|||
return net.Conns[i]
|
||||
}
|
||||
|
||||
// InitConn(one, other) retrieves the connectiton model for the connection between
|
||||
// InitConn(one, other) retrieves the connection model for the connection between
|
||||
// peers one and other, or creates a new one if it does not exist
|
||||
// the order of nodes does not matter, i.e., Conn(i,j) == Conn(j, i)
|
||||
// it checks if the connection is already up, and if the nodes are running
|
||||
|
|
|
|||
Loading…
Reference in a new issue