Skip to content

Commit

Permalink
FAB-1688: Fix network test connection problem on ppc64
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1688

Change-Id: I1d025e9d9462002a97d1dc8b096fbfc0efca4bc7
Signed-off-by: Gabor Hosszu <gabor@digitalasset.com>
  • Loading branch information
gaborh-da committed Feb 21, 2017
1 parent 809759b commit ae48020
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions orderer/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"math/big"
"os"
"os/exec"
"runtime"
"testing"
"time"

Expand All @@ -42,6 +43,8 @@ import (
"google.golang.org/grpc"
)

const ppc64 = "ppc64le"

const keyfile = "sbft/testdata/key.pem"
const maindir = "github.com/hyperledger/fabric/orderer"

Expand Down Expand Up @@ -105,7 +108,7 @@ func TestMain(m *testing.M) {
}

func TestTwoReplicasBroadcastAndDeliverUsingTheSame(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
startingPort := 2000
skipInShortMode(t)
peers := InitPeers(2, startingPort)
Expand All @@ -128,7 +131,7 @@ func TestTwoReplicasBroadcastAndDeliverUsingTheSame(t *testing.T) {
}

func TestTwoReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
logging.SetLevel(logging.DEBUG, "sbft")
startingPort := 2500
skipInShortMode(t)
Expand All @@ -152,7 +155,7 @@ func TestTwoReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) {
}

func TestTenReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
startingPort := 3000
skipInShortMode(t)
peers := InitPeers(10, startingPort)
Expand All @@ -175,7 +178,7 @@ func TestTenReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) {
}

func TestFourReplicasBombedWithBroadcasts(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
startingPort := 4000
skipInShortMode(t)
// Add for debug mode:
Expand Down Expand Up @@ -204,7 +207,7 @@ func TestFourReplicasBombedWithBroadcasts(t *testing.T) {
}

func TestTenReplicasBombedWithBroadcasts(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
startingPort := 5000
skipInShortMode(t)
broadcastCount := 15
Expand All @@ -231,7 +234,7 @@ func TestTenReplicasBombedWithBroadcasts(t *testing.T) {
}

func TestTenReplicasBombedWithBroadcastsIfLedgersConsistent(t *testing.T) {
t.Parallel()
parallelIfNotPpc64(t)
startingPort := 6000
skipInShortMode(t)
broadcastCount := 15
Expand Down Expand Up @@ -269,6 +272,12 @@ func TestTenReplicasBombedWithBroadcastsIfLedgersConsistent(t *testing.T) {
}
}

func parallelIfNotPpc64(t *testing.T) {
if runtime.GOARCH != ppc64 {
t.Parallel()
}
}

func InitPeers(num uint64, startingPort int) []*Peer {
peers := make([]*Peer, 0, num)
certFiles := make([]string, 0, num)
Expand All @@ -291,6 +300,9 @@ func InitPeers(num uint64, startingPort int) []*Peer {
func StartPeers(peers []*Peer) {
for _, p := range peers {
p.start()
if runtime.GOARCH == ppc64 {
time.Sleep(3 * time.Second)
}
}
}

Expand Down

0 comments on commit ae48020

Please sign in to comment.