| 365 | } |
| 366 | |
| 367 | func (t *T) killServer() { |
| 368 | if err := t.servProc.Process.Signal(os.Interrupt); err != nil { |
| 369 | t.Log("Unable to kill the server process:", err) |
| 370 | assert.NoError(t, os.RemoveAll(t.testDir)) |
| 371 | return // Return, as now it is pointless to wait for it. |
| 372 | } |
| 373 | |
| 374 | go func() { |
| 375 | time.Sleep(5 * time.Second) |
| 376 | if t.servProc != nil { |
| 377 | t.Log("Killing possibly hung server process") |
| 378 | t.servProc.Process.Kill() //nolint:errcheck |
| 379 | } |
| 380 | }() |
| 381 | |
| 382 | if err := t.servProc.Wait(); err != nil { |
| 383 | t.Error("The server did not stop cleanly, deadlock?") |
| 384 | } |
| 385 | |
| 386 | t.servProc = nil |
| 387 | |
| 388 | if err := os.RemoveAll(t.testDir); err != nil { |
| 389 | t.Log("Failed to remove test directory:", err) |
| 390 | } |
| 391 | t.testDir = "" |
| 392 | } |
| 393 | |
| 394 | func (t *T) Close() { |
| 395 | t.Log("close is no-op") |