mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: convert dbauthz tests to also run with Postgres (#15862)
Another PR to address https://github.com/coder/coder/issues/15109. - adds the DisableForeignKeysAndTriggers utility, which simplifies converting tests from in-mem to postgres - converts the dbauthz test suite to pass on both the in-mem db and Postgres
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
"github.com/coder/coder/v2/coderd/database/dbauthz"
|
||||
"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/rbac"
|
||||
)
|
||||
@@ -22,13 +21,9 @@ import (
|
||||
func TestGroupsAuth(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if dbtestutil.WillUsePostgres() {
|
||||
t.Skip("this test would take too long to run on postgres")
|
||||
}
|
||||
|
||||
authz := rbac.NewAuthorizer(prometheus.NewRegistry())
|
||||
|
||||
db := dbauthz.New(dbmem.New(), authz, slogtest.Make(t, &slogtest.Options{
|
||||
store, _ := dbtestutil.NewDB(t)
|
||||
db := dbauthz.New(store, authz, slogtest.Make(t, &slogtest.Options{
|
||||
IgnoreErrors: true,
|
||||
}), coderdtest.AccessControlStorePointer())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user