Skip to content

Commit 78988a3

Browse files
committed
chore(tests): specify password for indexworker tests
1 parent ee91c5f commit 78988a3

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ jobs:
113113
env:
114114
MULTIGRES_GATEWAY_PG_PORT: "5432"
115115
MULTIGRES_NUM_CELLS: "2"
116+
MULTIGRES_PG_MAX_CONNECTIONS: "100"
116117
ports:
117118
- 5432:5432
118119
options: >-
@@ -133,4 +134,7 @@ jobs:
133134
- name: Run migrations
134135
run: make migrate_dev
135136
- name: Run tests
137+
# Multigres' postgres superuser password is "postgres" (not "root")
138+
env:
139+
POSTGRES_PASSWORD: postgres
136140
run: go test ./... -p 1 -race -v -count=1

internal/indexworker/indexworker_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package indexworker
22

33
import (
4+
"cmp"
45
"context"
56
"errors"
67
"fmt"
78
"net/url"
9+
"os"
810
"sync"
911
"sync/atomic"
1012
"testing"
@@ -433,11 +435,12 @@ func (ts *IndexWorkerTestSuite) TestCreateIndexesWithInvalidIndexes() {
433435
assert.True(ts.T(), idx.IsReady, "Index %s should be ready initially", idx.IndexName)
434436
}
435437

436-
// Step 2: Connect as the postgres superuser to manipulate pg_index
437-
// Parse the existing connection URL and replace credentials with postgres superuser
438+
// Step 2: Connect as the postgres superuser to manipulate pg_index.
439+
// Parse the existing connection URL and replace credentials with the postgres superuser.
440+
superuserPassword := cmp.Or(os.Getenv("POSTGRES_PASSWORD"), "root")
438441
manipulatorURL := ts.config.DB.URL
439442
if u, err := url.Parse(ts.config.DB.URL); err == nil {
440-
u.User = url.UserPassword("postgres", "root")
443+
u.User = url.UserPassword("postgres", superuserPassword)
441444
manipulatorURL = u.String()
442445
}
443446

0 commit comments

Comments
 (0)