File tree Expand file tree Collapse file tree 3 files changed +77
-2
lines changed Expand file tree Collapse file tree 3 files changed +77
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Run Go Tests
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+ types :
11+ - ready_for_review
12+ - opened
13+ - reopened
14+ - synchronize
15+ workflow_dispatch :
16+
17+ jobs :
18+ test :
19+ runs-on : ubuntu-latest
20+ services :
21+ # Postgres service container
22+ postgres :
23+ image : postgres:16
24+ env :
25+ # Specify the password for Postgres superuser.
26+ POSTGRES_PASSWORD : a!b@c$d()e*_,/:;=?@ff[]22
27+ # Set health checks to wait until postgres has started
28+ options : >-
29+ --health-cmd pg_isready
30+ --health-interval 10s
31+ --health-timeout 5s
32+ --health-retries 5
33+ ports :
34+ # Maps tcp port 5432 on service container to the host
35+ - 5432:5432
36+
37+ steps :
38+ - uses : actions/checkout@v4
39+ with :
40+ fetch-depth : 0
41+ fetch-tags : true
42+
43+ - name : Setup Go
44+ uses : actions/setup-go@v5
45+ with :
46+ go-version : ' 1.23.x'
47+
48+ - name : Cache Go modules
49+ uses : actions/cache@v4
50+ with :
51+ path : |
52+ ~/go/pkg/mod
53+ ~/.cache/go-build
54+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
55+ restore-keys : |
56+ ${{ runner.os }}-go-
57+
58+ - name : Download dependencies
59+ run : go mod download
60+
61+ - name : Install gotestsum
62+ run : go install gotest.tools/gotestsum@latest
63+
64+ - name : Run tests
65+ run : gotestsum --format github-action
66+ working-directory : ./dbos
67+ env :
68+ PGPASSWORD : a!b@c$d()e*_,/:;=?@ff[]22
69+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 55 "embed"
66 "errors"
77 "fmt"
8+ "net/url"
89 "os"
910 "strings"
1011 "time"
@@ -121,7 +122,9 @@ func NewSystemDatabase() (SystemDatabase, error) {
121122 // TODO: pass proper config
122123 databaseURL := os .Getenv ("DBOS_DATABASE_URL" )
123124 if databaseURL == "" {
124- return nil , NewInitializationError ("DBOS_DATABASE_URL environment variable is required" )
125+ fmt .Println ("DBOS_DATABASE_URL not set, using default: postgres://postgres:${PGPASSWORD}@localhost:5432/dbos?sslmode=disable" )
126+ password := url .QueryEscape (os .Getenv ("PGPASSWORD" ))
127+ databaseURL = fmt .Sprintf ("postgres://postgres:%s@localhost:5432/dbos?sslmode=disable" , password )
125128 }
126129
127130 // Create the database if it doesn't exist
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package dbos
22
33import (
44 "context"
5+ "fmt"
6+ "net/url"
57 "os"
68 "sync"
79 "testing"
@@ -16,7 +18,8 @@ func setupDBOS(t *testing.T) {
1618
1719 databaseURL := os .Getenv ("DBOS_DATABASE_URL" )
1820 if databaseURL == "" {
19- t .Skip ("DBOS_DATABASE_URL not set, skipping integration test" )
21+ password := url .QueryEscape (os .Getenv ("PGPASSWORD" ))
22+ databaseURL = fmt .Sprintf ("postgres://postgres:%s@localhost:5432/dbos?sslmode=disable" , password )
2023 }
2124
2225 // Clean up the test database
You can’t perform that action at this time.
0 commit comments