diff --git a/tools/functional-tester/etcd-agent/agent.go b/tools/functional-tester/etcd-agent/agent.go index 346ce563c..4d04c923e 100644 --- a/tools/functional-tester/etcd-agent/agent.go +++ b/tools/functional-tester/etcd-agent/agent.go @@ -73,12 +73,12 @@ func (a *Agent) start(args ...string) error { } // stop stops the existing etcd process the agent started. -func (a *Agent) stop() error { +func (a *Agent) stopWithSig(sig os.Signal) error { if a.state != stateStarted { return nil } - err := sigtermAndWait(a.cmd) + err := stopWithSig(a.cmd, sig) if err != nil { return err } @@ -87,8 +87,8 @@ func (a *Agent) stop() error { return nil } -func sigtermAndWait(cmd *exec.Cmd) error { - err := cmd.Process.Signal(syscall.SIGTERM) +func stopWithSig(cmd *exec.Cmd, sig os.Signal) error { + err := cmd.Process.Signal(sig) if err != nil { return err } @@ -125,7 +125,8 @@ func (a *Agent) restart() error { } func (a *Agent) cleanup() error { - if err := a.stop(); err != nil { + // exit with stackstrace + if err := a.stopWithSig(syscall.SIGQUIT); err != nil { return err } a.state = stateUninitialized @@ -152,7 +153,7 @@ func (a *Agent) cleanup() error { // terminate stops the exiting etcd process the agent started // and removes the data dir. func (a *Agent) terminate() error { - err := a.stop() + err := a.stopWithSig(syscall.SIGTERM) if err != nil { return err } diff --git a/tools/functional-tester/etcd-agent/rpc.go b/tools/functional-tester/etcd-agent/rpc.go index 122f64085..c9cc7a390 100644 --- a/tools/functional-tester/etcd-agent/rpc.go +++ b/tools/functional-tester/etcd-agent/rpc.go @@ -19,6 +19,7 @@ import ( "net" "net/http" "net/rpc" + "syscall" "github.com/coreos/etcd/tools/functional-tester/etcd-agent/client" ) @@ -47,7 +48,7 @@ func (a *Agent) RPCStart(args []string, pid *int) error { func (a *Agent) RPCStop(args struct{}, reply *struct{}) error { plog.Printf("stop etcd") - err := a.stop() + err := a.stopWithSig(syscall.SIGTERM) if err != nil { plog.Println("error stopping etcd", err) return err