@@ -11,10 +11,8 @@ import (
1111 "fmt"
1212 "os"
1313 "testing"
14- "time"
1514
1615 "github.com/docker/docker/client"
17- "github.com/docker/go-connections/nat"
1816 _ "github.com/lib/pq"
1917 "github.com/stretchr/testify/assert"
2018 "github.com/stretchr/testify/require"
@@ -83,6 +81,7 @@ const (
8381 dbname = "postgres"
8482 user = "postgres"
8583 testPassword = "password"
84+ pgdata = "/var/lib/postgresql/data/"
8685)
8786
8887func TestParsingWAL96 (t * testing.T ) {
@@ -100,7 +99,7 @@ func TestParsingWAL(t *testing.T) {
10099 t .Fatal ("Failed to create a Docker client:" , err )
101100 }
102101
103- postgresVersions := []float64 {10 , 11 , 12 , 13 }
102+ postgresVersions := []float64 {10 , 11 , 12 , 13 , 14 }
104103
105104 for _ , pgVersion := range postgresVersions {
106105 testWALParsing (t , dockerCLI , pgVersion , initialScript )
@@ -122,26 +121,17 @@ func testWALParsing(t *testing.T, dockerCLI *client.Client, pgVersion float64, i
122121 logStrategyForAcceptingConnections := wait .NewLogStrategy ("database system is ready to accept connections" )
123122 logStrategyForAcceptingConnections .Occurrence = 2
124123
125- dbURL := func (port nat.Port ) string {
126- return fmt .Sprintf ("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable" ,
127- "localhost" , port .Port (), user , testPassword , dbname )
128- }
129-
130124 req := testcontainers.ContainerRequest {
131125 Name : "pg_test_" + pgVersionString ,
132126 Image : "postgres:" + pgVersionString ,
133127 ExposedPorts : []string {port },
134128 WaitingFor : wait .ForAll (
135129 logStrategyForAcceptingConnections ,
136130 wait .ForLog ("PostgreSQL init process complete; ready for start up." ),
137- wait .ForSQL (nat .Port (port ), "postgres" , dbURL ).Timeout (10 * time .Second ),
138131 ),
139- BindMounts : map [string ]string {
140- dir : "/var/lib/postgresql/data" ,
141- "/tmp" : "/tmp" ,
142- },
143132 Env : map [string ]string {
144133 "POSTGRES_PASSWORD" : testPassword ,
134+ "PGDATA" : pgdata ,
145135 },
146136 }
147137
@@ -155,7 +145,6 @@ func testWALParsing(t *testing.T, dockerCLI *client.Client, pgVersion float64, i
155145
156146 // Prepare test data.
157147 code , err := postgresContainer .Exec (ctx , []string {"psql" , "-U" , user , "-d" , dbname , "-XAtc" , initialSQL })
158-
159148 require .Nil (t , err )
160149 assert .Equal (t , 0 , code )
161150
@@ -164,7 +153,7 @@ func testWALParsing(t *testing.T, dockerCLI *client.Client, pgVersion float64, i
164153 }
165154
166155 // Check WAL parsing.
167- dsa , err := p .getDSAFromWAL (ctx , pgVersion , postgresContainer .GetContainerID (), dir )
156+ dsa , err := p .getDSAFromWAL (ctx , pgVersion , postgresContainer .GetContainerID (), pgdata )
168157 assert .Nil (t , err )
169158 assert .NotEmpty (t , dsa )
170159
0 commit comments