(t *testing.T)
| 182 | } |
| 183 | |
| 184 | func Test_Hook_OnPreShutdown(t *testing.T) { |
| 185 | t.Parallel() |
| 186 | app := New() |
| 187 | |
| 188 | buf := bytebufferpool.Get() |
| 189 | defer bytebufferpool.Put(buf) |
| 190 | |
| 191 | app.Hooks().OnPreShutdown(func() error { |
| 192 | _, err := buf.WriteString("pre-shutdown") |
| 193 | require.NoError(t, err) |
| 194 | |
| 195 | return nil |
| 196 | }) |
| 197 | |
| 198 | require.NoError(t, app.Shutdown()) |
| 199 | require.Equal(t, "pre-shutdown", buf.String()) |
| 200 | } |
| 201 | |
| 202 | func Test_Hook_OnPostShutdown(t *testing.T) { |
| 203 | t.Run("should execute post shutdown hook with error", func(t *testing.T) { |
nothing calls this directly
no test coverage detected