MCPcopy Create free account
hub / github.com/screego/server / TestShutdown

Function TestShutdown

server/server_test.go:54–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func 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
72func fakeInterrupt(t *testing.T) func() {
73 oldNotify := notifySignal

Callers

nothing calls this directly

Calls 3

fakeInterruptFunction · 0.85
portFunction · 0.85
StartFunction · 0.70

Tested by

no test coverage detected