From c128957723b151972ec65a3d3bf4e168ead09f1b Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 7 Mar 2017 19:09:58 +0400 Subject: [PATCH] "must remove file for test to run again" - no way I am doing this by hands, too lazy :) --- rpc_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rpc_test.go b/rpc_test.go index c7779919..99012251 100644 --- a/rpc_test.go +++ b/rpc_test.go @@ -2,6 +2,7 @@ package rpc import ( "net/http" + "os/exec" "testing" "time" @@ -13,8 +14,10 @@ import ( // Client and Server should work over tcp or unix sockets const ( - tcpAddr = "tcp://0.0.0.0:46657" - unixAddr = "unix:///tmp/go-rpc.sock" // NOTE: must remove file for test to run again + tcpAddr = "tcp://0.0.0.0:46657" + + unixSocket = "/tmp/go-rpc.sock" + unixAddr = "unix:///tmp/go-rpc.sock" websocketEndpoint = "/websocket/endpoint" ) @@ -43,6 +46,12 @@ func StatusResult(v string) (Result, error) { // launch unix and tcp servers func init() { + cmd := exec.Command("rm", "-f", unixSocket) + err := cmd.Start() + if err != nil { + panic(err) + } + err = cmd.Wait() mux := http.NewServeMux() server.RegisterRPCFuncs(mux, Routes)