summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-01-27 10:50:05 +0900
committerHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-01-27 10:50:05 +0900
commiteef23350f3a1474e6a06abb6c5a097a5e1319ee5 (patch)
treeab07fa4907615d3822e32b7a28bd2baa4553abc5 /server
parentc4c487118dc9a77c1c36dbcc173fe116c2edc769 (diff)
fsm_test: shorten wait time
Diffstat (limited to 'server')
-rw-r--r--server/fsm_test.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/server/fsm_test.go b/server/fsm_test.go
index 894fcb88..5a1feafa 100644
--- a/server/fsm_test.go
+++ b/server/fsm_test.go
@@ -105,8 +105,6 @@ func TestReadAll(t *testing.T) {
pushBytes := func() {
fmt.Println("push 5 bytes")
m.recvCh <- expected1[0:5]
- fmt.Println("wait 5 seconds...")
- time.Sleep(time.Second * 5)
fmt.Println("push rest")
m.recvCh <- expected1[5:]
fmt.Println("push bytes at once")
@@ -136,11 +134,11 @@ func TestFSMHandlerOpensent_HoldTimerExpired(t *testing.T) {
p.fsm.passiveConn = m
// set up keepalive ticker
- sec := time.Second * 2
+ sec := time.Second * 1
p.fsm.keepaliveTicker = time.NewTicker(sec)
// set holdtime
- p.fsm.opensentHoldTime = 5
+ p.fsm.opensentHoldTime = 2
state := h.opensent()
@@ -162,10 +160,10 @@ func TestFSMHandlerOpenconfirm_HoldTimerExpired(t *testing.T) {
p.fsm.passiveConn = m
// set up keepalive ticker
- p.fsm.peerConfig.Timers.KeepaliveInterval = 2
+ p.fsm.peerConfig.Timers.KeepaliveInterval = 1
// set holdtime
- p.fsm.negotiatedHoldTime = 10
+ p.fsm.negotiatedHoldTime = 2
state := h.openconfirm()
assert.Equal(bgp.BGP_FSM_IDLE, state)
@@ -186,7 +184,7 @@ func TestFSMHandlerEstablish_HoldTimerExpired(t *testing.T) {
p.fsm.passiveConn = m
// set up keepalive ticker
- sec := time.Second * 2
+ sec := time.Second * 1
p.fsm.keepaliveTicker = time.NewTicker(sec)
msg := keepalive()
@@ -200,12 +198,12 @@ func TestFSMHandlerEstablish_HoldTimerExpired(t *testing.T) {
}
// set holdtime
- p.fsm.peerConfig.Timers.HoldTime = 10
- p.fsm.negotiatedHoldTime = 10
+ p.fsm.peerConfig.Timers.HoldTime = 2
+ p.fsm.negotiatedHoldTime = 2
go pushPackets()
state := h.established()
- time.Sleep(time.Second * 4)
+ time.Sleep(time.Second * 1)
assert.Equal(bgp.BGP_FSM_IDLE, state)
lastMsg := m.sendBuf[len(m.sendBuf)-1]
sent, _ := bgp.ParseBGPMessage(lastMsg)