Skip to content

feat: Generate random admin user password in dev mode #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use sync.WaitGroup instead of channel
  • Loading branch information
mafredri committed Apr 28, 2022
commit 0026a1243c34db90ce834656ebe6ec70d0054ec9
15 changes: 9 additions & 6 deletions cli/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"os"
"runtime"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -81,9 +82,10 @@ func TestServer(t *testing.T) {
root, cfg := clitest.New(t, "server", "--dev", "--skip-tunnel", "--address", ":0")
var buf strings.Builder
root.SetOutput(&buf)
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer close(done)
defer wg.Done()

err := root.ExecuteContext(ctx)
require.ErrorIs(t, err, context.Canceled)
Expand Down Expand Up @@ -116,7 +118,7 @@ func TestServer(t *testing.T) {
require.NoError(t, err)

cancelFunc()
<-done
wg.Wait()
})
// Duplicated test from "Development" above to test setting email/password via env.
// Cannot run parallel due to os.Setenv.
Expand All @@ -133,9 +135,10 @@ func TestServer(t *testing.T) {
root, cfg := clitest.New(t, "server", "--dev", "--skip-tunnel", "--address", ":0")
var buf strings.Builder
root.SetOutput(&buf)
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer close(done)
defer wg.Done()

err := root.ExecuteContext(ctx)
require.ErrorIs(t, err, context.Canceled)
Expand All @@ -161,7 +164,7 @@ func TestServer(t *testing.T) {
require.NoError(t, err)

cancelFunc()
<-done
wg.Wait()
})
t.Run("TLSBadVersion", func(t *testing.T) {
t.Parallel()
Expand Down