Skip to content

Commit 49f3f80

Browse files
committed
test: Write URL after signal listen to fix flake
The URL could be read before the signal was listening, causing this test to flake: https://github.com/coder/coder/runs/6936820170?check_suite_focus=true
1 parent d0aca86 commit 49f3f80

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cli/server.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,6 @@ func server() *cobra.Command {
403403
errCh <- wg.Wait()
404404
}()
405405

406-
// This is helpful for tests, but can be silently ignored.
407-
// Coder may be ran as users that don't have permission to write in the homedir,
408-
// such as via the systemd service.
409-
_ = config.URL().Write(client.URL.String())
410-
411406
hasFirstUser, err := client.HasFirstUser(cmd.Context())
412407
if !hasFirstUser && err == nil {
413408
cmd.Println()
@@ -437,6 +432,12 @@ func server() *cobra.Command {
437432
stopChan := make(chan os.Signal, 1)
438433
defer signal.Stop(stopChan)
439434
signal.Notify(stopChan, os.Interrupt)
435+
436+
// This is helpful for tests, but can be silently ignored.
437+
// Coder may be ran as users that don't have permission to write in the homedir,
438+
// such as via the systemd service.
439+
_ = config.URL().Write(client.URL.String())
440+
440441
select {
441442
case <-cmd.Context().Done():
442443
coderAPI.Close()

0 commit comments

Comments
 (0)