aboutsummaryrefslogtreecommitdiffstats
path: root/integration_test
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-08 16:33:42 +0800
committerGitHub <noreply@github.com>2018-12-08 16:33:42 +0800
commit7654e95f94f4902eb624bcdae1e6c8ebbf38e289 (patch)
tree5c50289fe6305507d71d72d96abbfe2d4b584d0a /integration_test
parent1b352d9e52839c8b6c316c2601d08c91c995d8f0 (diff)
downloaddexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar.gz
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar.bz2
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar.lz
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar.xz
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.tar.zst
dexon-consensus-7654e95f94f4902eb624bcdae1e6c8ebbf38e289.zip
ci: Add TravisCI setting. (#363)
* Update Gopkg.lock * Fix test * Add travisCI setting * Print log using fmt * Update GNUmakefile * Use single go rountine for consensus_test
Diffstat (limited to 'integration_test')
-rw-r--r--integration_test/consensus_test.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/integration_test/consensus_test.go b/integration_test/consensus_test.go
index d66ff72..16cfa8f 100644
--- a/integration_test/consensus_test.go
+++ b/integration_test/consensus_test.go
@@ -19,6 +19,7 @@ package integration
import (
"context"
+ "fmt"
"sync"
"testing"
"time"
@@ -208,10 +209,10 @@ func (s *ConsensusTestSuite) TestSimple() {
Loop:
for {
<-time.After(5 * time.Second)
- s.T().Log("check latest position delivered by each node")
+ fmt.Println("check latest position delivered by each node")
for _, n := range nodes {
latestPos := n.app.GetLatestDeliveredPosition()
- s.T().Log("latestPos", n.ID, &latestPos)
+ fmt.Println("latestPos", n.ID, &latestPos)
if latestPos.Round < untilRound {
continue Loop
}
@@ -283,10 +284,10 @@ func (s *ConsensusTestSuite) TestNumChainsChange() {
Loop:
for {
<-time.After(5 * time.Second)
- s.T().Log("check latest position delivered by each node")
+ fmt.Println("check latest position delivered by each node")
for _, n := range nodes {
latestPos := n.app.GetLatestDeliveredPosition()
- s.T().Log("latestPos", n.ID, &latestPos)
+ fmt.Println("latestPos", n.ID, &latestPos)
if latestPos.Round < untilRound {
continue Loop
}
@@ -320,7 +321,7 @@ func (s *ConsensusTestSuite) TestSync() {
core.ConfigRoundShift)
req.NoError(err)
req.NoError(seedGov.State().RequestChange(
- test.StateChangeRoundInterval, 30*time.Second))
+ test.StateChangeRoundInterval, 50*time.Second))
// A short round interval.
nodes := s.setupNodes(dMoment, prvKeys, seedGov)
// Choose the first node as "syncNode" that its consensus' Run() is called
@@ -348,6 +349,24 @@ func (s *ConsensusTestSuite) TestSync() {
}
}
}()
+ // Print status every 5 seconds so CI won't fail.
+ monitorCtx, monitorCancel := context.WithCancel(
+ context.Background())
+ defer monitorCancel()
+ go func() {
+ for {
+ select {
+ case <-time.After(5 * time.Second):
+ for _, n := range nodes {
+ pos := n.app.GetLatestDeliveredPosition()
+ fmt.Println("latestPos", n.ID, &pos)
+ break
+ }
+ case <-monitorCtx.Done():
+ return
+ }
+ }
+ }()
ReachAlive:
for {
// If all nodes excepts syncNode have reached aliveRound, call syncNode's
@@ -425,7 +444,7 @@ ReachAlive:
// Stop a node, we should still be able to proceed.
stoppedNode.con.Stop()
stoppedNode.con = nil
- s.T().Log("one node stopped")
+ fmt.Println("one node stopped")
// Initiate a dummy routine to consume the receive channel.
go func() {
for {