nolint:tparallel,paralleltest // This test cannot be run in parallel due to signal handling.
(t *testing.T)
| 2202 | |
| 2203 | //nolint:tparallel,paralleltest // This test cannot be run in parallel due to signal handling. |
| 2204 | func TestServer_InterruptShutdown(t *testing.T) { |
| 2205 | t.Skip("This test issues an interrupt signal which will propagate to the test runner.") |
| 2206 | |
| 2207 | if runtime.GOOS == "windows" { |
| 2208 | // Sending interrupt signal isn't supported on Windows! |
| 2209 | t.SkipNow() |
| 2210 | } |
| 2211 | ctx, cancelFunc := context.WithCancel(context.Background()) |
| 2212 | defer cancelFunc() |
| 2213 | |
| 2214 | root, cfg := clitest.New(t, |
| 2215 | "server", |
| 2216 | dbArg(t), |
| 2217 | "--http-address", ":0", |
| 2218 | "--access-url", "http://example.com", |
| 2219 | "--provisioner-daemons", "1", |
| 2220 | "--cache-dir", t.TempDir(), |
| 2221 | ) |
| 2222 | serverErr := make(chan error, 1) |
| 2223 | go func() { |
| 2224 | serverErr <- root.WithContext(ctx).Run() |
| 2225 | }() |
| 2226 | _ = waitAccessURL(t, cfg) |
| 2227 | currentProcess, err := os.FindProcess(os.Getpid()) |
| 2228 | require.NoError(t, err) |
| 2229 | err = currentProcess.Signal(os.Interrupt) |
| 2230 | require.NoError(t, err) |
| 2231 | // We cannot send more signals here, because it's possible Coder |
| 2232 | // has already exited, which could cause the test to fail due to interrupt. |
| 2233 | err = <-serverErr |
| 2234 | require.NoError(t, err) |
| 2235 | } |
| 2236 | |
| 2237 | // TestServer_AIGatewayShutdownOrdering is a regression test for a shutdown |
| 2238 | // ordering bug. The in-memory AI Gateway daemon registers itself with the |
nothing calls this directly
no test coverage detected