mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove references to dbtestutil.WillUsePostgres (#20436)
Addresses https://github.com/coder/internal/issues/758. This PR only cleans up dead code, it makes no changes to test logic.
This commit is contained in:
@@ -2946,7 +2946,6 @@ func (s *MethodTestSuite) TestSystemFunctions() {
|
||||
dbm.EXPECT().GetParameterSchemasByJobID(gomock.Any(), jobID).Return([]database.ParameterSchema{}, nil).AnyTimes()
|
||||
check.Args(jobID).
|
||||
Asserts(tpl, policy.ActionRead).
|
||||
ErrorsWithInMemDB(sql.ErrNoRows).
|
||||
Returns([]database.ParameterSchema{})
|
||||
}))
|
||||
s.Run("GetWorkspaceAppsByAgentIDs", s.Mocked(func(dbm *dbmock.MockStore, faker *gofakeit.Faker, check *expects) {
|
||||
@@ -3189,7 +3188,7 @@ func (s *MethodTestSuite) TestSystemFunctions() {
|
||||
}))
|
||||
s.Run("GetAppSecurityKey", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
|
||||
dbm.EXPECT().GetAppSecurityKey(gomock.Any()).Return("", sql.ErrNoRows).AnyTimes()
|
||||
check.Args().Asserts(rbac.ResourceSystem, policy.ActionRead).ErrorsWithPG(sql.ErrNoRows)
|
||||
check.Args().Asserts(rbac.ResourceSystem, policy.ActionRead).Errors(sql.ErrNoRows)
|
||||
}))
|
||||
s.Run("UpsertAppSecurityKey", s.Mocked(func(dbm *dbmock.MockStore, _ *gofakeit.Faker, check *expects) {
|
||||
dbm.EXPECT().UpsertAppSecurityKey(gomock.Any(), "foo").Return(nil).AnyTimes()
|
||||
|
||||
@@ -430,24 +430,6 @@ func (m *expects) Errors(err error) *expects {
|
||||
return m
|
||||
}
|
||||
|
||||
// ErrorsWithPG is optional. If it is never called, it will not be asserted.
|
||||
// It will only be asserted if the test is running with a Postgres database.
|
||||
func (m *expects) ErrorsWithPG(err error) *expects {
|
||||
if dbtestutil.WillUsePostgres() {
|
||||
return m.Errors(err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// ErrorsWithInMemDB is optional. If it is never called, it will not be asserted.
|
||||
// It will only be asserted if the test is running with an in-memory database.
|
||||
func (m *expects) ErrorsWithInMemDB(err error) *expects {
|
||||
if !dbtestutil.WillUsePostgres() {
|
||||
return m.Errors(err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *expects) FailSystemObjectChecks() *expects {
|
||||
return m.WithSuccessAuthorizer(func(ctx context.Context, subject rbac.Subject, action policy.Action, obj rbac.Object) error {
|
||||
if obj.Type == rbac.ResourceSystem.Type {
|
||||
|
||||
Reference in New Issue
Block a user