(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func TestShutdown(t *testing.T) { |
| 55 | dispose := fakeInterrupt(t) |
| 56 | defer dispose() |
| 57 | |
| 58 | finished := make(chan error) |
| 59 | |
| 60 | go func() { |
| 61 | finished <- Start(mux.NewRouter(), ":"+strconv.Itoa(port()), "", "") |
| 62 | }() |
| 63 | |
| 64 | select { |
| 65 | case <-time.After(1 * time.Second): |
| 66 | t.Fatal("Server should be closed") |
| 67 | case err := <-finished: |
| 68 | assert.Nil(t, err) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func fakeInterrupt(t *testing.T) func() { |
| 73 | oldNotify := notifySignal |
nothing calls this directly
no test coverage detected