Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3005ac8

Browse files
committed
rm logger
1 parente80c05d commit3005ac8

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

‎coderd/healthcheck/workspaceproxy.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66

7-
"cdr.dev/slog"
87
"github.com/coder/coder/v2/buildinfo"
98
"github.com/coder/coder/v2/coderd/util/ptr"
109
"github.com/coder/coder/v2/codersdk"
@@ -21,7 +20,6 @@ type WorkspaceProxyReportOptions struct {
2120
// CurrentVersion is the current server version.
2221
// We pass this in to make it easier to test.
2322
CurrentVersionstring
24-
Logger slog.Logger
2523
}
2624

2725
// @typescript-generate Report
@@ -38,26 +36,22 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
3836
r.Warnings= []string{}
3937

4038
ifopts.FetchWorkspaceProxies==nil {
41-
opts.Logger.Debug(ctx,"no workspace proxies configured")
4239
return
4340
}
4441

4542
ifopts.UpdateProxyHealth==nil {
4643
err:="opts.UpdateProxyHealth must not be nil if opts.FetchWorkspaceProxies is not nil"
47-
opts.Logger.Error(ctx,"developer error: "+err)
4844
r.Error=ptr.Ref(err)
4945
return
5046
}
5147

5248
iferr:=opts.UpdateProxyHealth(ctx);err!=nil {
53-
opts.Logger.Error(ctx,"failed to update proxy health: %w",err)
5449
r.Error=ptr.Ref(err.Error())
5550
return
5651
}
5752

5853
proxies,err:=opts.FetchWorkspaceProxies(ctx)
5954
iferr!=nil {
60-
opts.Logger.Error(ctx,"failed to fetch workspace proxies",slog.Error(err))
6155
r.Healthy=false
6256
r.Error=ptr.Ref(err.Error())
6357
return
@@ -75,11 +69,6 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
7569

7670
// check versions
7771
if!buildinfo.VersionsMatch(proxy.Version,opts.CurrentVersion) {
78-
opts.Logger.Warn(ctx,"proxy version mismatch",
79-
slog.F("version",opts.CurrentVersion),
80-
slog.F("proxy_version",proxy.Version),
81-
slog.F("proxy_name",proxy.Name),
82-
)
8372
r.Healthy=false
8473
r.Warnings=append(r.Warnings,fmt.Sprintf("Proxy %q version %q does not match primary server version %q",proxy.Name,proxy.Version,opts.CurrentVersion))
8574
}

‎coderd/healthcheck/workspaceproxy_test.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66

77
"github.com/stretchr/testify/require"
88

9-
"cdr.dev/slog/sloggers/slogtest"
10-
119
"github.com/coder/coder/v2/coderd/healthcheck"
1210
"github.com/coder/coder/v2/codersdk"
1311
"github.com/coder/coder/v2/testutil"
@@ -20,11 +18,8 @@ func TestWorkspaceProxies(t *testing.T) {
2018
t.Parallel()
2119

2220
ctx:=testutil.Context(t,testutil.WaitShort)
23-
log:=slogtest.Make(t,nil)
2421
rpt:= healthcheck.WorkspaceProxyReport{}
25-
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{
26-
Logger:log,
27-
})
22+
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{})
2823

2924
require.True(t,rpt.Healthy,"expected report to be healthy")
3025
require.Empty(t,rpt.Warnings,"expected no warnings")
@@ -35,7 +30,6 @@ func TestWorkspaceProxies(t *testing.T) {
3530
t.Parallel()
3631

3732
ctx:=testutil.Context(t,testutil.WaitShort)
38-
log:=slogtest.Make(t,nil)
3933
rpt:= healthcheck.WorkspaceProxyReport{}
4034
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{
4135
CurrentVersion:"v2.34.5",
@@ -45,7 +39,6 @@ func TestWorkspaceProxies(t *testing.T) {
4539
},nil
4640
},
4741
UpdateProxyHealth:func(context.Context)error {returnnil },
48-
Logger:log,
4942
})
5043

5144
require.True(t,rpt.Healthy,"expected report to be healthy")
@@ -57,7 +50,6 @@ func TestWorkspaceProxies(t *testing.T) {
5750
t.Parallel()
5851

5952
ctx:=testutil.Context(t,testutil.WaitShort)
60-
log:=slogtest.Make(t,nil)
6153
rpt:= healthcheck.WorkspaceProxyReport{}
6254
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{
6355
CurrentVersion:"v2.34.5",
@@ -70,7 +62,6 @@ func TestWorkspaceProxies(t *testing.T) {
7062
},nil
7163
},
7264
UpdateProxyHealth:func(context.Context)error {returnnil },
73-
Logger:log,
7465
})
7566

7667
require.True(t,rpt.Healthy,"expected report to be healthy")
@@ -82,7 +73,6 @@ func TestWorkspaceProxies(t *testing.T) {
8273
t.Parallel()
8374

8475
ctx:=testutil.Context(t,testutil.WaitShort)
85-
log:=slogtest.Make(t,nil)
8676
rpt:= healthcheck.WorkspaceProxyReport{}
8777
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{
8878
CurrentVersion:"v2.35.0",
@@ -94,7 +84,6 @@ func TestWorkspaceProxies(t *testing.T) {
9484
},
9585
},nil
9686
},
97-
Logger:log,
9887
UpdateProxyHealth:func(context.Context)error {returnnil },
9988
})
10089

@@ -108,7 +97,6 @@ func TestWorkspaceProxies(t *testing.T) {
10897
t.Parallel()
10998

11099
ctx:=testutil.Context(t,testutil.WaitShort)
111-
log:=slogtest.Make(t,nil)
112100
rpt:= healthcheck.WorkspaceProxyReport{}
113101
rpt.Run(ctx,&healthcheck.WorkspaceProxyReportOptions{
114102
CurrentVersion:"v2.35.0",
@@ -120,7 +108,6 @@ func TestWorkspaceProxies(t *testing.T) {
120108
},
121109
},nil
122110
},
123-
Logger:log,
124111
UpdateProxyHealth:func(context.Context)error {returnnil },
125112
})
126113

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp