From 853944f785c2034bbf82a128b86d511e297cf221 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 21 Oct 2019 16:10:40 +0900 Subject: server: speed up session establishment The unittest on pkg/server finishes quicker. Signed-off-by: FUJITA Tomonori --- pkg/server/fsm.go | 2 +- pkg/server/server_test.go | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go index b037c0f5..35172bd2 100644 --- a/pkg/server/fsm.go +++ b/pkg/server/fsm.go @@ -36,7 +36,7 @@ import ( ) const ( - minConnectRetryInterval = 10 + minConnectRetryInterval = 5 ) type fsmStateReasonType uint8 diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 3cbf53a9..34e9be1f 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -335,6 +335,12 @@ func TestListPathEnableFiltered(test *testing.T) { Transport: &api.Transport{ RemotePort: 10179, }, + Timers: &api.Timers{ + Config: &api.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } ch := make(chan struct{}) go s.MonitorPeer(context.Background(), &api.MonitorPeerRequest{}, func(peer *api.Peer) { @@ -504,6 +510,12 @@ func TestMonitor(test *testing.T) { Transport: &api.Transport{ RemotePort: 10179, }, + Timers: &api.Timers{ + Config: &api.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } ch := make(chan struct{}) go t.MonitorPeer(context.Background(), &api.MonitorPeerRequest{}, func(peer *api.Peer) { @@ -916,6 +928,12 @@ func TestPeerGroup(test *testing.T) { RemotePort: 10179, }, }, + Timers: config.Timers{ + Config: config.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } ch := make(chan struct{}) go t.MonitorPeer(context.Background(), &api.MonitorPeerRequest{}, func(peer *api.Peer) { @@ -983,6 +1001,12 @@ func TestDynamicNeighbor(t *testing.T) { RemotePort: 10179, }, }, + Timers: config.Timers{ + Config: config.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } ch := make(chan struct{}) go s2.MonitorPeer(context.Background(), &api.MonitorPeerRequest{}, func(peer *api.Peer) { @@ -1049,6 +1073,12 @@ func TestGracefulRestartTimerExpired(t *testing.T) { Enabled: true, RestartTime: 1, }, + Timers: &api.Timers{ + Config: &api.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } ch := make(chan struct{}) @@ -1163,6 +1193,12 @@ func peerServers(t *testing.T, ctx context.Context, servers []*BgpServer, famili RemotePort: uint16(peer.bgpConfig.Global.Config.Port), }, }, + Timers: config.Timers{ + Config: config.TimersConfig{ + ConnectRetry: 1, + IdleHoldTimeAfterReset: 1, + }, + }, } // first server to get neighbor config is passive to hopefully make handshake faster -- cgit v1.2.3