mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: Write URL after signal listen to fix flake (#2456)
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
This commit is contained in:
+6
-5
@@ -408,11 +408,6 @@ func server() *cobra.Command {
|
||||
errCh <- wg.Wait()
|
||||
}()
|
||||
|
||||
// This is helpful for tests, but can be silently ignored.
|
||||
// Coder may be ran as users that don't have permission to write in the homedir,
|
||||
// such as via the systemd service.
|
||||
_ = config.URL().Write(client.URL.String())
|
||||
|
||||
hasFirstUser, err := client.HasFirstUser(cmd.Context())
|
||||
if !hasFirstUser && err == nil {
|
||||
cmd.Println()
|
||||
@@ -442,6 +437,12 @@ func server() *cobra.Command {
|
||||
stopChan := make(chan os.Signal, 1)
|
||||
defer signal.Stop(stopChan)
|
||||
signal.Notify(stopChan, os.Interrupt)
|
||||
|
||||
// This is helpful for tests, but can be silently ignored.
|
||||
// Coder may be ran as users that don't have permission to write in the homedir,
|
||||
// such as via the systemd service.
|
||||
_ = config.URL().Write(client.URL.String())
|
||||
|
||||
select {
|
||||
case <-cmd.Context().Done():
|
||||
coderAPI.Close()
|
||||
|
||||
Reference in New Issue
Block a user