Skip to content

chore(coderd/provisionerdserver): convert dbmem tests to use postgres #18278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions coderd/provisionerdserver/acquirer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"go.uber.org/goleak"

"github.com/coder/coder/v2/coderd/database"
"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/database/provisionerjobs"
Expand All @@ -34,8 +33,7 @@ func TestMain(m *testing.M) {
// TestAcquirer_Store tests that a database.Store is accepted as a provisionerdserver.AcquirerStore
func TestAcquirer_Store(t *testing.T) {
t.Parallel()
db := dbmem.New()
ps := pubsub.NewInMemory()
db, ps := dbtestutil.NewDB(t)
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
defer cancel()
logger := testutil.Logger(t)
Expand Down
10 changes: 5 additions & 5 deletions coderd/provisionerdserver/provisionerdserver_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/coder/coder/v2/coderd/database"
"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/testutil"
)
Expand All @@ -21,14 +21,14 @@ func TestObtainOIDCAccessToken(t *testing.T) {
ctx := context.Background()
t.Run("NoToken", func(t *testing.T) {
t.Parallel()
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
_, err := obtainOIDCAccessToken(ctx, db, nil, uuid.Nil)
require.NoError(t, err)
})
t.Run("InvalidConfig", func(t *testing.T) {
// We still want OIDC to succeed even if exchanging the token fails.
t.Parallel()
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
user := dbgen.User(t, db, database.User{})
dbgen.UserLink(t, db, database.UserLink{
UserID: user.ID,
Expand All @@ -40,7 +40,7 @@ func TestObtainOIDCAccessToken(t *testing.T) {
})
t.Run("MissingLink", func(t *testing.T) {
t.Parallel()
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
user := dbgen.User(t, db, database.User{
LoginType: database.LoginTypeOIDC,
})
Expand All @@ -50,7 +50,7 @@ func TestObtainOIDCAccessToken(t *testing.T) {
})
t.Run("Exchange", func(t *testing.T) {
t.Parallel()
db := dbmem.New()
db, _ := dbtestutil.NewDB(t)
user := dbgen.User(t, db, database.User{})
dbgen.UserLink(t, db, database.UserLink{
UserID: user.ID,
Expand Down
Loading
Loading