google / seesaw

Seesaw v2 is a Linux Virtual Server (LVS) based load balancing platform.
Apache License 2.0
5.63k stars 511 forks source link

Fix vty_test race that made it flaky. #2

Closed baptr closed 8 years ago

baptr commented 8 years ago

By making the server socket blocking and improving the read loop, this avoids a race where read() would get an EAGAIN and abort before any data was sent.

Add some more error handling and minor style tweaks while I'm here.

Previously: $ go test ./quagga -run=TestVTYWrite -count=10 -parallel=1 --- FAIL: TestVTYWrite (0.00s) vty_test.go:186: Server received []byte{}, want []byte{0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x0} FAIL FAIL github.com/google/seesaw/quagga 0.011s