Skip to content

Commit 437066c

Browse files
authored
fix: Stop sending additional signals in Shutdown test (coder#2582)
Coder was exiting before the additional signals were handled, which caused occasional CI failures.
1 parent f72a6d0 commit 437066c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

cli/server_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,25 +202,19 @@ func TestServer(t *testing.T) {
202202
root, cfg := clitest.New(t, "server", "--in-memory", "--address", ":0", "--provisioner-daemons", "1")
203203
serverErr := make(chan error)
204204
go func() {
205-
err := root.ExecuteContext(ctx)
206-
serverErr <- err
205+
serverErr <- root.ExecuteContext(ctx)
207206
}()
208207
require.Eventually(t, func() bool {
209208
var err error
210209
_, err = cfg.URL().Read()
211210
return err == nil
212211
}, 15*time.Second, 25*time.Millisecond)
213-
214212
currentProcess, err := os.FindProcess(os.Getpid())
215213
require.NoError(t, err)
216214
err = currentProcess.Signal(os.Interrupt)
217215
require.NoError(t, err)
218-
// Send a two more signal, which should be ignored. Send 2 because the channel has a buffer
219-
// of 1 and we want to make sure that nothing strange happens if we exceed the buffer.
220-
err = currentProcess.Signal(os.Interrupt)
221-
require.NoError(t, err)
222-
err = currentProcess.Signal(os.Interrupt)
223-
require.NoError(t, err)
216+
// We cannot send more signals here, because it's possible Coder
217+
// has already exited, which could cause the test to fail due to interrupt.
224218
err = <-serverErr
225219
require.NoError(t, err)
226220
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy