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

Function TestShutdownOnErrorWhileShutdown

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

Source from the content-addressed store, hash-verified

15)
16
17func TestShutdownOnErrorWhileShutdown(t *testing.T) {
18 disposeInterrupt := fakeInterrupt(t)
19 defer disposeInterrupt()
20
21 shutdownError := errors.New("shutdown error")
22 disposeShutdown := fakeShutdownError(shutdownError)
23 defer disposeShutdown()
24
25 finished := make(chan error)
26
27 go func() {
28 finished <- Start(mux.NewRouter(), ":"+strconv.Itoa(port()), "", "")
29 }()
30
31 select {
32 case <-time.After(1 * time.Second):
33 t.Fatal("Server should be closed")
34 case err := <-finished:
35 assert.Equal(t, shutdownError, err)
36 }
37}
38
39func TestShutdownAfterError(t *testing.T) {
40 finished := make(chan error)

Callers

nothing calls this directly

Calls 4

fakeInterruptFunction · 0.85
fakeShutdownErrorFunction · 0.85
portFunction · 0.85
StartFunction · 0.70

Tested by

no test coverage detected