File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,31 @@ jobs:
11
11
go-version :
12
12
- 1.20.x
13
13
os : [ubuntu-latest]
14
+ services :
15
+ postgres :
16
+ image : postgres
17
+ env :
18
+ POSTGRES_PASSWORD : postgres
19
+ options : >-
20
+ --health-cmd pg_isready
21
+ --health-interval 10s
22
+ --health-timeout 5s
23
+ --health-retries 5
24
+ ports :
25
+ - 5432:5432
14
26
runs-on : ubuntu-latest
15
27
steps :
16
28
- name : Checkout code
17
29
uses : actions/checkout@v3
18
30
with :
19
31
fetch-depth : 0
32
+ - name : Setup Postgres
33
+ uses : ikalnytskyi/action-setup-postgres@v4
34
+ with :
35
+ username : postgres
36
+ password : postgres
37
+ database : oui
38
+ port : 5432
20
39
21
40
- name : Go Setup
22
41
uses : actions/setup-go@v4
25
44
26
45
- name : Run Tests
27
46
run : go test -v ./...
47
+ env :
48
+ POSTGRES_PASSWORD : postgres
Original file line number Diff line number Diff line change 1
1
package oui_test
2
2
3
3
import (
4
+ "fmt"
5
+ "os"
4
6
"path/filepath"
5
7
"testing"
6
8
@@ -14,9 +16,12 @@ func Test_New(t *testing.T) {
14
16
prefix := "00:50:56:00:00:00/24"
15
17
org := "VMware, Inc."
16
18
registry := "MA-L"
19
+
17
20
t .Run ("postgres" , func (t * testing.T ) {
18
21
t .Parallel ()
19
- cs := "postgresql://oui:J5brHrAXFLQSif0K@localhost/oui?sslmode=disable"
22
+ password := os .Getenv ("POSTGRES_PASSWORD" )
23
+ require .NotEqual (t , "" , password )
24
+ cs := fmt .Sprintf ("postgresql://oui:%s@localhost/oui" , password )
20
25
psql , err := oui .CreatePostgresOption (cs )
21
26
require .NoError (t , err )
22
27
ouidb , err := oui .New (oui .WithVersion ("test" ), psql )
You can’t perform that action at this time.
0 commit comments