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

Commit0828c1d

Browse files
committed
fix tests
1 parente338c8f commit0828c1d

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

‎site/site_test.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ import (
2727
"github.com/coder/coder/v2/coderd/database/db2sdk"
2828
"github.com/coder/coder/v2/coderd/database/dbgen"
2929
"github.com/coder/coder/v2/coderd/database/dbmem"
30+
"github.com/coder/coder/v2/coderd/database/dbtestutil"
3031
"github.com/coder/coder/v2/coderd/database/dbtime"
3132
"github.com/coder/coder/v2/coderd/httpmw"
33+
"github.com/coder/coder/v2/coderd/telemetry"
3234
"github.com/coder/coder/v2/codersdk"
3335
"github.com/coder/coder/v2/site"
3436
"github.com/coder/coder/v2/testutil"
@@ -45,9 +47,10 @@ func TestInjection(t *testing.T) {
4547
binFs:=http.FS(fstest.MapFS{})
4648
db:=dbmem.New()
4749
handler:=site.New(&site.Options{
48-
BinFS:binFs,
49-
Database:db,
50-
SiteFS:siteFS,
50+
Telemetry:telemetry.NewNoop(),
51+
BinFS:binFs,
52+
Database:db,
53+
SiteFS:siteFS,
5154
})
5255

5356
user:=dbgen.User(t,db, database.User{})
@@ -101,9 +104,10 @@ func TestInjectionFailureProducesCleanHTML(t *testing.T) {
101104
},
102105
}
103106
handler:=site.New(&site.Options{
104-
BinFS:binFs,
105-
Database:db,
106-
SiteFS:siteFS,
107+
Telemetry:telemetry.NewNoop(),
108+
BinFS:binFs,
109+
Database:db,
110+
SiteFS:siteFS,
107111

108112
// No OAuth2 configs, refresh will fail.
109113
OAuth2Configs:&httpmw.OAuth2Configs{
@@ -147,9 +151,12 @@ func TestCaching(t *testing.T) {
147151
}
148152
binFS:=http.FS(fstest.MapFS{})
149153

154+
db,_:=dbtestutil.NewDB(t)
150155
srv:=httptest.NewServer(site.New(&site.Options{
151-
BinFS:binFS,
152-
SiteFS:rootFS,
156+
Telemetry:telemetry.NewNoop(),
157+
BinFS:binFS,
158+
SiteFS:rootFS,
159+
Database:db,
153160
}))
154161
defersrv.Close()
155162

@@ -213,9 +220,12 @@ func TestServingFiles(t *testing.T) {
213220
}
214221
binFS:=http.FS(fstest.MapFS{})
215222

223+
db,_:=dbtestutil.NewDB(t)
216224
srv:=httptest.NewServer(site.New(&site.Options{
217-
BinFS:binFS,
218-
SiteFS:rootFS,
225+
Telemetry:telemetry.NewNoop(),
226+
BinFS:binFS,
227+
SiteFS:rootFS,
228+
Database:db,
219229
}))
220230
defersrv.Close()
221231

@@ -473,6 +483,7 @@ func TestServingBin(t *testing.T) {
473483
}
474484

475485
srv:=httptest.NewServer(site.New(&site.Options{
486+
Telemetry:telemetry.NewNoop(),
476487
BinFS:binFS,
477488
BinHashes:binHashes,
478489
SiteFS:rootFS,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp