Address comments

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
Hector Sanjuan 2018-01-25 23:34:06 +01:00
parent f4c57d8581
commit 4d26550e5c
2 changed files with 15 additions and 11 deletions

View File

@ -40,7 +40,7 @@ func init() {
//logging.SetLogLevel("consensus", "DEBUG")
}
func makeTestingHost(t *testing.T, idn int) host.Host {
func makeTestingHost(t *testing.T) host.Host {
priv, pub, _ := crypto.GenerateKeyPair(crypto.RSA, 2048)
pid, _ := peer.IDFromPublicKey(pub)
@ -59,7 +59,7 @@ func makeTestingHost(t *testing.T, idn int) host.Host {
}
func testingConsensus(t *testing.T, idn int) *Consensus {
h := makeTestingHost(t, idn)
h := makeTestingHost(t)
st := mapstate.NewMapState()
cfg := &Config{}

View File

@ -39,10 +39,10 @@ var (
logLevel = "CRITICAL"
// ports
clusterPort = 10000
apiPort = 10100
ipfsProxyPort = 10200
// When testing with fixed ports...
// clusterPort = 10000
// apiPort = 10100
// ipfsProxyPort = 10200
)
func init() {
@ -151,7 +151,9 @@ func createClusters(t *testing.T) ([]*Cluster, []*test.IpfsMock) {
ipfsMocks := make([]*test.IpfsMock, nClusters, nClusters)
clusters := make([]*Cluster, nClusters, nClusters)
clusterPeers := make([]ma.Multiaddr, nClusters, nClusters)
// Uncomment when testing with fixed ports
// clusterPeers := make([]ma.Multiaddr, nClusters, nClusters)
for i := 0; i < nClusters; i++ {
clusterCfg, consensusCfg, api, ipfs, state, tracker, mon, alloc, inf, mock := createComponents(t, i, testingClusterSecret)
cfgs[i] = clusterCfg
@ -164,10 +166,12 @@ func createClusters(t *testing.T) ([]*Cluster, []*test.IpfsMock) {
allocs[i] = alloc
infs[i] = inf
ipfsMocks[i] = mock
addr, _ := ma.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d/ipfs/%s",
clusterPort+i,
clusterCfg.ID.Pretty()))
clusterPeers[i] = addr
// Uncomment with testing with fixed ports and ClusterPeers
// addr, _ := ma.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d/ipfs/%s",
// clusterPort+i,
// clusterCfg.ID.Pretty()))
// clusterPeers[i] = addr
}
// ----------------------------------------------------------