From eb6bada57c9d1df915200247908e28af45e59573 Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Tue, 20 Aug 2013 13:15:00 -0700 Subject: [PATCH] connection refused errors are expectede --- gracehttp/testserver/testserver.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gracehttp/testserver/testserver.go b/gracehttp/testserver/testserver.go index 07e6509..a601e63 100644 --- a/gracehttp/testserver/testserver.go +++ b/gracehttp/testserver/testserver.go @@ -9,6 +9,7 @@ import ( "log" "net/http" "os" + "strings" "sync" "time" @@ -18,7 +19,7 @@ import ( type response struct { Sleep time.Duration Pid int - Error string `json:,omitempty` + Error string `json:",omitempty"` } func wait(wg *sync.WaitGroup, url string) { @@ -28,12 +29,15 @@ func wait(wg *sync.WaitGroup, url string) { if err == nil { return } else { - e2 := json.NewEncoder(os.Stderr).Encode(&response{ - Error: err.Error(), - Pid: os.Getpid(), - }) - if e2 != nil { - log.Fatalf("Error writing error json: %s", e2) + // we expect connection refused + if !strings.HasSuffix(err.Error(), "connection refused") { + e2 := json.NewEncoder(os.Stderr).Encode(&response{ + Error: err.Error(), + Pid: os.Getpid(), + }) + if e2 != nil { + log.Fatalf("Error writing error json: %s", e2) + } } } }