From 25db23e3c8e5e0ab1e880b2a6188f9e456178575 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 24 Sep 2015 00:11:14 +0900 Subject: [PATCH] integration: Workaround flaky test around signal --- integration-tests/nghttpx_http1_test.go | 2 ++ integration-tests/nghttpx_http2_test.go | 2 ++ integration-tests/server_tester.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/integration-tests/nghttpx_http1_test.go b/integration-tests/nghttpx_http1_test.go index c7658eb5..03524bb6 100644 --- a/integration-tests/nghttpx_http1_test.go +++ b/integration-tests/nghttpx_http1_test.go @@ -10,6 +10,7 @@ import ( "net/http" "syscall" "testing" + "time" ) // TestH1H1PlainGET tests whether simple HTTP/1 GET request works. @@ -140,6 +141,7 @@ func TestH1H1GracefulShutdown(t *testing.T) { } st.cmd.Process.Signal(syscall.SIGQUIT) + time.Sleep(150 * time.Millisecond) res, err = st.http1(requestParam{ name: "TestH1H1GracefulShutdown-2", diff --git a/integration-tests/nghttpx_http2_test.go b/integration-tests/nghttpx_http2_test.go index 527cf4c8..52eebf91 100644 --- a/integration-tests/nghttpx_http2_test.go +++ b/integration-tests/nghttpx_http2_test.go @@ -11,6 +11,7 @@ import ( "strings" "syscall" "testing" + "time" ) // TestH2H1PlainGET tests whether simple HTTP/2 GET request works. @@ -1175,6 +1176,7 @@ func TestH2H1GracefulShutdown(t *testing.T) { // send SIGQUIT signal to nghttpx to perform graceful shutdown st.cmd.Process.Signal(syscall.SIGQUIT) + time.Sleep(150 * time.Millisecond) // after signal, finish request body if err := st.fr.WriteData(1, true, nil); err != nil { diff --git a/integration-tests/server_tester.go b/integration-tests/server_tester.go index 689ffa89..9f41e620 100644 --- a/integration-tests/server_tester.go +++ b/integration-tests/server_tester.go @@ -205,6 +205,8 @@ func (st *serverTester) Close() { if st.cmd != nil { st.cmd.Process.Kill() st.cmd.Wait() + // workaround to unreliable Process.Signal() + time.Sleep(150 * time.Millisecond) } if st.ts != nil { st.ts.Close()