Merge pull request #7721 from influxdata/mr-fix-flaky-port-tests

Bind to random port in service open/close tests
pull/7727/head
Mark Rushakoff 2016-12-14 10:03:26 -08:00 committed by GitHub
commit eceecf4cfa
2 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,9 @@ import (
)
func Test_Service_OpenClose(t *testing.T) {
c := Config{BindAddress: ":35422"}
// Let the OS assign a random port since we are only opening and closing the service,
// not actually connecting to it.
c := Config{BindAddress: "127.0.0.1:0"}
service := NewTestService(&c)
// Closing a closed service is fine.

View File

@ -20,7 +20,9 @@ import (
)
func Test_Service_OpenClose(t *testing.T) {
service := NewTestService("db0", "127.0.0.1:45362")
// Let the OS assign a random port since we are only opening and closing the service,
// not actually connecting to it.
service := NewTestService("db0", "127.0.0.1:0")
// Closing a closed service is fine.
if err := service.Service.Close(); err != nil {