Skip to content

Commit 5476774

Browse files
committed
disable RLS for PG14
1 parent 9f623ed commit 5476774

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
env:
5050
DUTY_DB_URL: postgres://postgres:postgres@localhost:5432/mission-control?sslmode=disable
5151
DUTY_DB_CREATE: "false"
52+
DUTY_DB_DISABLE_RLS: ${{ matrix.postgres-version.tag == '14' && 'true' || 'false' }}
5253

5354
migrate:
5455
runs-on: ubuntu-latest

tests/setup/common.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ import (
3636
_ "github.com/spf13/cobra"
3737
)
3838

39+
const (
40+
DUTY_DB_CREATE = "DUTY_DB_CREATE"
41+
DUTY_DB_DISABLE_RLS = "DUTY_DB_DISABLE_RLS"
42+
)
43+
3944
// Env vars for embedded db
4045
const (
41-
DUTY_DB_CREATE = "DUTY_DB_CREATE"
4246
DUTY_DB_DATA_DIR = "DUTY_DB_DATA_DIR"
4347
DUTY_DB_URL = "DUTY_DB_URL"
4448
TEST_DB_PORT = "TEST_DB_PORT"
@@ -99,7 +103,11 @@ func MustDB() *sql.DB {
99103
var WithoutRLS = "rls_disabled"
100104
var WithoutDummyData = "without_dummy_data"
101105
var WithExistingDatabase = "with_existing_database"
102-
var recreateDatabase = os.Getenv(DUTY_DB_CREATE) != "false"
106+
107+
var (
108+
recreateDatabase = os.Getenv(DUTY_DB_CREATE) != "false"
109+
disableRLS = os.Getenv(DUTY_DB_DISABLE_RLS) == "true"
110+
)
103111

104112
func findFileInPath(filename string, depth int) string {
105113
if !path.IsAbs(filename) {
@@ -139,7 +147,6 @@ func SetupDB(dbName string, args ...interface{}) (context.Context, error) {
139147
defer telemetry.InitTracer()
140148

141149
importDummyData := true
142-
disableRLS := false
143150
dbOptions := []duty.StartOption{duty.DisablePostgrest, duty.RunMigrations}
144151
for _, arg := range args {
145152
if arg == WithoutDummyData {

0 commit comments

Comments
 (0)