From e78490e4ba43a2d80f88b4977b54889b4133882f Mon Sep 17 00:00:00 2001 From: Gabor Hosszu Date: Tue, 20 Dec 2016 10:12:33 +0100 Subject: [PATCH] Skip SBFT tests in short test mode Change-Id: I40e5ddd751bf71ae30d2716ac1d4ee5f82add919 Signed-off-by: Gabor Hosszu --- orderer/sbft/main/network_test.go | 11 ++++++++++ orderer/sbft/main/sbft_test.go | 1 + orderer/sbft/simplebft/simplebft_test.go | 28 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/orderer/sbft/main/network_test.go b/orderer/sbft/main/network_test.go index 239e663a02f..f991321f36f 100644 --- a/orderer/sbft/main/network_test.go +++ b/orderer/sbft/main/network_test.go @@ -60,6 +60,12 @@ type receiver struct { signals chan bool } +func skipInShortMode(t *testing.T) { + if testing.Short() { + t.Skip("Skipping test in short mode.") + } +} + func build() { buildcmd := exec.Command("go", "build", maindir) buildcmd.Stdout = os.Stdout @@ -82,6 +88,7 @@ func TestMain(m *testing.M) { } func TestTwoReplicasBroadcastAndDeliverUsingTheSame(t *testing.T) { + skipInShortMode(t) peers := InitPeers(2) StartPeers(peers) r, err := Receive(peers[1]) @@ -100,6 +107,7 @@ func TestTwoReplicasBroadcastAndDeliverUsingTheSame(t *testing.T) { } func TestTenReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) { + skipInShortMode(t) peers := InitPeers(10) StartPeers(peers) r, err := Receive(peers[9]) @@ -118,6 +126,7 @@ func TestTenReplicasBroadcastAndDeliverUsingDifferent(t *testing.T) { } func TestFourReplicasBombedWithBroadcasts(t *testing.T) { + skipInShortMode(t) // Add for debug mode: // logging.SetLevel(logging.DEBUG, "sbft") broadcastCount := 15 @@ -142,6 +151,7 @@ func TestFourReplicasBombedWithBroadcasts(t *testing.T) { } func TestTenReplicasBombedWithBroadcasts(t *testing.T) { + skipInShortMode(t) broadcastCount := 15 peers := InitPeers(10) StartPeers(peers) @@ -164,6 +174,7 @@ func TestTenReplicasBombedWithBroadcasts(t *testing.T) { } func TestTenReplicasBombedWithBroadcastsIfLedgersConsistent(t *testing.T) { + skipInShortMode(t) broadcastCount := 15 peers := InitPeers(10) StartPeers(peers) diff --git a/orderer/sbft/main/sbft_test.go b/orderer/sbft/main/sbft_test.go index 483b70ae278..bd735887df3 100644 --- a/orderer/sbft/main/sbft_test.go +++ b/orderer/sbft/main/sbft_test.go @@ -41,6 +41,7 @@ var NEEDED_UPDATES = 2 var NEEDED_SENT = 1 func TestSbftPeer(t *testing.T) { + skipInShortMode(t) tempDir, err := ioutil.TempDir("", "sbft_test") if err != nil { panic("Failed to create a temporary directory") diff --git a/orderer/sbft/simplebft/simplebft_test.go b/orderer/sbft/simplebft/simplebft_test.go index 23bb98a380c..be56c1974f0 100644 --- a/orderer/sbft/simplebft/simplebft_test.go +++ b/orderer/sbft/simplebft/simplebft_test.go @@ -33,6 +33,12 @@ func init() { //logging.SetLevel(logging.DEBUG, "sbft") } +func skipInShortMode(t *testing.T) { + if testing.Short() { + t.Skip("Skipping test in short mode.") + } +} + func connectAll(sys *testSystem) { // map iteration is non-deterministic, so use linear iteration instead max := uint64(0) @@ -62,6 +68,7 @@ func connectAll(sys *testSystem) { } func TestSBFT(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -98,6 +105,7 @@ func TestSBFT(t *testing.T) { } func TestSBFTDelayed(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -139,6 +147,7 @@ func TestSBFTDelayed(t *testing.T) { } func TestN1(t *testing.T) { + skipInShortMode(t) N := uint64(1) sys := newTestSystem(N) var repls []*SBFT @@ -167,6 +176,7 @@ func TestN1(t *testing.T) { } func TestMonotonicViews(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -202,6 +212,7 @@ func TestMonotonicViews(t *testing.T) { } func TestByzPrimary(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -256,6 +267,7 @@ func TestByzPrimary(t *testing.T) { } func TestViewChange(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -295,6 +307,7 @@ func TestViewChange(t *testing.T) { } func TestMsgReordering(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -347,6 +360,7 @@ func TestMsgReordering(t *testing.T) { } func TestBacklogReordering(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -399,6 +413,7 @@ func TestBacklogReordering(t *testing.T) { } func TestViewChangeWithRetransmission(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -438,6 +453,7 @@ func TestViewChangeWithRetransmission(t *testing.T) { } func TestViewChangeXset(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -514,6 +530,7 @@ func TestViewChangeXset(t *testing.T) { } func TestRestart(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -567,6 +584,7 @@ func TestRestart(t *testing.T) { } func TestAbdicatingPrimary(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -625,6 +643,7 @@ func TestAbdicatingPrimary(t *testing.T) { } func TestRestartAfterPrepare(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -694,6 +713,7 @@ func TestRestartAfterPrepare(t *testing.T) { } func TestRestartAfterCommit(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -763,6 +783,7 @@ func TestRestartAfterCommit(t *testing.T) { } func TestRestartAfterCheckpoint(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -832,6 +853,7 @@ func TestRestartAfterCheckpoint(t *testing.T) { } func TestErroneousViewChange(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -921,6 +943,7 @@ func TestErroneousViewChange(t *testing.T) { } func TestRestartMissedViewChange(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -993,6 +1016,7 @@ func TestRestartMissedViewChange(t *testing.T) { } func TestFullBacklog(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -1034,6 +1058,7 @@ func TestFullBacklog(t *testing.T) { } func TestHelloMsg(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystemWOTimers(N) var repls []*SBFT @@ -1100,6 +1125,7 @@ func TestHelloMsg(t *testing.T) { } func TestViewChangeTimer(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -1183,6 +1209,7 @@ func TestViewChangeTimer(t *testing.T) { } func TestResendViewChange(t *testing.T) { + skipInShortMode(t) N := uint64(4) sys := newTestSystem(N) var repls []*SBFT @@ -1242,6 +1269,7 @@ func TestResendViewChange(t *testing.T) { } func TestTenReplicasBombedWithRequests(t *testing.T) { + skipInShortMode(t) N := uint64(10) requestNumber := 11 sys := newTestSystem(N)