chore(site): remove dbmem from tests (#18802)

Related to https://github.com/coder/coder/issues/15109.
This commit is contained in:
Hugo Dutka
2025-07-08 17:28:48 +02:00
committed by GitHub
parent 8e038db463
commit 2f50b3b7bb

View File

@ -27,7 +27,6 @@ import (
"github.com/coder/coder/v2/coderd/database"
"github.com/coder/coder/v2/coderd/database/db2sdk"
"github.com/coder/coder/v2/coderd/database/dbgen"
"github.com/coder/coder/v2/coderd/database/dbmem"
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/database/dbtime"
"github.com/coder/coder/v2/coderd/httpmw"
@ -46,7 +45,7 @@ func TestInjection(t *testing.T) {
},
}
binFs := http.FS(fstest.MapFS{})
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
handler := site.New(&site.Options{
Telemetry: telemetry.NewNoop(),
BinFS: binFs,
@ -73,13 +72,17 @@ func TestInjection(t *testing.T) {
// This will update as part of the request!
got.LastSeenAt = user.LastSeenAt
// json.Unmarshal doesn't parse the timezone correctly
got.CreatedAt = got.CreatedAt.In(user.CreatedAt.Location())
got.UpdatedAt = got.UpdatedAt.In(user.CreatedAt.Location())
require.Equal(t, db2sdk.User(user, []uuid.UUID{}), got)
}
func TestInjectionFailureProducesCleanHTML(t *testing.T) {
t.Parallel()
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
// Create an expired user with a refresh token, but provide no OAuth2
// configuration so that refresh is impossible, this should result in