From b7c3e87e5d7556fea74d13457f663f1343bd7b72 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Sun, 15 Aug 2021 18:09:44 +0200 Subject: [PATCH] Fix TestNoInitialKeyspace Signed-off-by: Rohit Nayak --- go/test/endtoend/cluster/vtgate_process.go | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/go/test/endtoend/cluster/vtgate_process.go b/go/test/endtoend/cluster/vtgate_process.go index d35fd8ecaa2..f5a24acf932 100644 --- a/go/test/endtoend/cluster/vtgate_process.go +++ b/go/test/endtoend/cluster/vtgate_process.go @@ -27,6 +27,7 @@ import ( "reflect" "strconv" "strings" + "syscall" "time" "vitess.io/vitess/go/vt/log" @@ -191,26 +192,21 @@ func (vtgate *VtgateProcess) TearDown() error { return nil } // graceful shutdown is not currently working with vtgate, attempting a force-kill to make tests less flaky - vtgate.proc.Process.Kill() - vtgate.proc = nil - return nil - /* - // Attempt graceful shutdown with SIGTERM first - vtgate.proc.Process.Signal(syscall.SIGTERM) + // Attempt graceful shutdown with SIGTERM first + vtgate.proc.Process.Signal(syscall.SIGTERM) - // We are not checking vtgate's exit code because it sometimes - // returns exit code 2, even though vtgate terminates cleanly. - select { - case <-vtgate.exit: - vtgate.proc = nil - return nil + // We are not checking vtgate's exit code because it sometimes + // returns exit code 2, even though vtgate terminates cleanly. + select { + case <-vtgate.exit: + vtgate.proc = nil + return nil - case <-time.After(30 * time.Second): - vtgate.proc.Process.Kill() - vtgate.proc = nil - return <-vtgate.exit - } - */ + case <-time.After(30 * time.Second): + vtgate.proc.Process.Kill() + vtgate.proc = nil + return <-vtgate.exit + } } // VtgateProcessInstance returns a Vtgate handle for vtgate process