Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
fixup! add testing
  • Loading branch information
coadler committed Jan 13, 2023
commit d929d0fe5d510f93e79b035d64093dc1b5cede1e
4 changes: 2 additions & 2 deletions cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1535,9 +1535,9 @@ func buildLogger(cmd *cobra.Command, cfg *codersdk.DeploymentConfig) (slog.Logge
sinks = append(sinks, sinkFn(cmd.ErrOrStderr()))

default:
fi, err := os.OpenFile(cfg.Logging.Human.Value, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
fi, err := os.OpenFile(loc, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
return xerrors.Errorf("open log file %q: %w", cfg.Logging.Human.Value, err)
return xerrors.Errorf("open log file %q: %w", loc, err)
}

closers = append(closers, fi.Close)
Expand Down
16 changes: 8 additions & 8 deletions cli/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ func TestServer(t *testing.T) {
require.Eventually(t, func() bool {
stat, err := os.Stat(fiName)
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
cancelFunc()
<-serverErr
})
Expand Down Expand Up @@ -1188,7 +1188,7 @@ func TestServer(t *testing.T) {
require.Eventually(t, func() bool {
stat, err := os.Stat(fi.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
cancelFunc()
<-serverErr
})
Expand Down Expand Up @@ -1217,10 +1217,10 @@ func TestServer(t *testing.T) {
serverErr <- root.ExecuteContext(ctx)
}()

require.Eventually(t, func() bool {
assert.Eventually(t, func() bool {
stat, err := os.Stat(fi.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
cancelFunc()
<-serverErr
})
Expand Down Expand Up @@ -1252,7 +1252,7 @@ func TestServer(t *testing.T) {
require.Eventually(t, func() bool {
stat, err := os.Stat(fi.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
cancelFunc()
<-serverErr
})
Expand Down Expand Up @@ -1298,15 +1298,15 @@ func TestServer(t *testing.T) {
require.Eventually(t, func() bool {
stat, err := os.Stat(fi1.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
require.Eventually(t, func() bool {
stat, err := os.Stat(fi2.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)
require.Eventually(t, func() bool {
stat, err := os.Stat(fi3.Name())
return err == nil && stat.Size() > 0
}, testutil.IntervalFast, testutil.WaitShort)
}, testutil.WaitShort, testutil.IntervalFast)

cancelFunc()
<-serverErr
Expand Down