From c8d6a15ccba759ce73dfcdf8ca0e14622407f154 Mon Sep 17 00:00:00 2001 From: kylecarbs Date: Wed, 22 Jun 2022 16:13:56 +0000 Subject: [PATCH] fix: Stop sending additional signals in Shutdown test Coder was exiting before the additional signals were handled, which caused occasional CI failures. --- cli/server_test.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cli/server_test.go b/cli/server_test.go index cad67f3d34b16..430be799245a7 100644 --- a/cli/server_test.go +++ b/cli/server_test.go @@ -202,25 +202,19 @@ func TestServer(t *testing.T) { root, cfg := clitest.New(t, "server", "--in-memory", "--address", ":0", "--provisioner-daemons", "1") serverErr := make(chan error) go func() { - err := root.ExecuteContext(ctx) - serverErr <- err + serverErr <- root.ExecuteContext(ctx) }() require.Eventually(t, func() bool { var err error _, err = cfg.URL().Read() return err == nil }, 15*time.Second, 25*time.Millisecond) - currentProcess, err := os.FindProcess(os.Getpid()) require.NoError(t, err) err = currentProcess.Signal(os.Interrupt) require.NoError(t, err) - // Send a two more signal, which should be ignored. Send 2 because the channel has a buffer - // of 1 and we want to make sure that nothing strange happens if we exceed the buffer. - err = currentProcess.Signal(os.Interrupt) - require.NoError(t, err) - err = currentProcess.Signal(os.Interrupt) - require.NoError(t, err) + // We cannot send more signals here, because it's possible Coder + // has already exited, which could cause the test to fail due to interrupt. err = <-serverErr require.NoError(t, err) }) 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