summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/server_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-31 11:23:13 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-31 11:23:13 +0900
commit9a0323419e9481186340a6455553fbc515969258 (patch)
tree9438edaa0de065ef627fa998c433e25232aab23d /pkg/server/server_test.go
parent475818dd3ccaa613fdd972097cf689ff9a4a6012 (diff)
fix closing listening socket blocked
with go v1.11, closing a listening socket is blocked and unittests fail due to timeout. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/server/server_test.go')
-rw-r--r--pkg/server/server_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go
index e56c6302..f1809e26 100644
--- a/pkg/server/server_test.go
+++ b/pkg/server/server_test.go
@@ -115,6 +115,7 @@ func TestListPolicyAssignment(t *testing.T) {
},
})
assert.Nil(err)
+ defer s.StopBgp(context.Background(), &api.StopBgpRequest{})
for i := 1; i < 4; i++ {
addr := fmt.Sprintf("127.0.0.%d", i)
@@ -211,6 +212,11 @@ func TestMonitor(test *testing.T) {
RemotePort: 10179,
},
},
+ Timers: config.Timers{
+ Config: config.TimersConfig{
+ ConnectRetry: 10,
+ },
+ },
}
err = t.AddPeer(context.Background(), &api.AddPeerRequest{Peer: NewPeerFromConfigStruct(m)})
assert.Nil(err)
@@ -344,6 +350,11 @@ func TestNumGoroutineWithAddDeleteNeighbor(t *testing.T) {
// wait goroutines to finish (e.g. internal goroutine for
// InfiniteChannel)
time.Sleep(time.Second * 5)
+ for i := 0; i < 5; i++ {
+ if num == runtime.NumGoroutine() {
+ return
+ }
+ }
assert.Equal(num, runtime.NumGoroutine())
}
@@ -580,6 +591,11 @@ func TestPeerGroup(test *testing.T) {
RemotePort: 10179,
},
},
+ Timers: config.Timers{
+ Config: config.TimersConfig{
+ ConnectRetry: 10,
+ },
+ },
}
err = t.AddPeer(context.Background(), &api.AddPeerRequest{Peer: NewPeerFromConfigStruct(m)})
assert.Nil(err)
@@ -647,6 +663,11 @@ func TestDynamicNeighbor(t *testing.T) {
RemotePort: 10179,
},
},
+ Timers: config.Timers{
+ Config: config.TimersConfig{
+ ConnectRetry: 10,
+ },
+ },
}
err = s2.AddPeer(context.Background(), &api.AddPeerRequest{Peer: NewPeerFromConfigStruct(m)})
@@ -722,6 +743,11 @@ func TestGracefulRestartTimerExpired(t *testing.T) {
RestartTime: 1,
},
},
+ Timers: config.Timers{
+ Config: config.TimersConfig{
+ ConnectRetry: 10,
+ },
+ },
}
err = s2.addNeighbor(m)
assert.Nil(err)