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

Commite5268e4

Browse files
authored
chore: spin clock library out to coder/quartz repo (#13777)
Code that was in `/clock` has been moved to github.com/coder/quartz. This PR refactors our use of the clock library to point to the external Quartz repo.
1 parenta110d18 commite5268e4

25 files changed

+61
-1986
lines changed

‎agent/apphealth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"golang.org/x/xerrors"
1111

1212
"cdr.dev/slog"
13-
"github.com/coder/coder/v2/clock"
1413
"github.com/coder/coder/v2/codersdk"
1514
"github.com/coder/coder/v2/codersdk/agentsdk"
15+
"github.com/coder/quartz"
1616
)
1717

1818
// PostWorkspaceAgentAppHealth updates the workspace app health.
@@ -23,7 +23,7 @@ type WorkspaceAppHealthReporter func(ctx context.Context)
2323

2424
// NewWorkspaceAppHealthReporter creates a WorkspaceAppHealthReporter that reports app health to coderd.
2525
funcNewWorkspaceAppHealthReporter(logger slog.Logger,apps []codersdk.WorkspaceApp,postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth)WorkspaceAppHealthReporter {
26-
returnNewAppHealthReporterWithClock(logger,apps,postWorkspaceAgentAppHealth,clock.NewReal())
26+
returnNewAppHealthReporterWithClock(logger,apps,postWorkspaceAgentAppHealth,quartz.NewReal())
2727
}
2828

2929
// NewAppHealthReporterWithClock is only called directly by test code. Product code should call
@@ -32,7 +32,7 @@ func NewAppHealthReporterWithClock(
3232
logger slog.Logger,
3333
apps []codersdk.WorkspaceApp,
3434
postWorkspaceAgentAppHealthPostWorkspaceAgentAppHealth,
35-
clkclock.Clock,
35+
clkquartz.Clock,
3636
)WorkspaceAppHealthReporter {
3737
logger=logger.Named("apphealth")
3838

‎agent/apphealth_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import (
1717
"github.com/coder/coder/v2/agent"
1818
"github.com/coder/coder/v2/agent/agenttest"
1919
"github.com/coder/coder/v2/agent/proto"
20-
"github.com/coder/coder/v2/clock"
2120
"github.com/coder/coder/v2/coderd/httpapi"
2221
"github.com/coder/coder/v2/codersdk"
2322
"github.com/coder/coder/v2/codersdk/agentsdk"
2423
"github.com/coder/coder/v2/testutil"
24+
"github.com/coder/quartz"
2525
)
2626

2727
funcTestAppHealth_Healthy(t*testing.T) {
@@ -69,7 +69,7 @@ func TestAppHealth_Healthy(t *testing.T) {
6969
httpapi.Write(r.Context(),w,http.StatusOK,nil)
7070
}),
7171
}
72-
mClock:=clock.NewMock(t)
72+
mClock:=quartz.NewMock(t)
7373
healthcheckTrap:=mClock.Trap().TickerFunc("healthcheck")
7474
deferhealthcheckTrap.Close()
7575
reportTrap:=mClock.Trap().TickerFunc("report")
@@ -137,7 +137,7 @@ func TestAppHealth_500(t *testing.T) {
137137
}),
138138
}
139139

140-
mClock:=clock.NewMock(t)
140+
mClock:=quartz.NewMock(t)
141141
healthcheckTrap:=mClock.Trap().TickerFunc("healthcheck")
142142
deferhealthcheckTrap.Close()
143143
reportTrap:=mClock.Trap().TickerFunc("report")
@@ -187,7 +187,7 @@ func TestAppHealth_Timeout(t *testing.T) {
187187
<-r.Context().Done()
188188
}),
189189
}
190-
mClock:=clock.NewMock(t)
190+
mClock:=quartz.NewMock(t)
191191
start:=mClock.Now()
192192

193193
// for this test, it's easier to think in the number of milliseconds elapsed
@@ -235,7 +235,7 @@ func setupAppReporter(
235235
ctx context.Context,t*testing.T,
236236
apps []codersdk.WorkspaceApp,
237237
handlers []http.Handler,
238-
clkclock.Clock,
238+
clkquartz.Clock,
239239
) (*agenttest.FakeAgentAPI,func()) {
240240
closers:= []func(){}
241241
for_,app:=rangeapps {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp