Skip to content

Commit ebfa78d

Browse files
authored
[testing] Switch to bitnamilegacy/postgresql and testing improvements (#141)
#### Type of change - Bug fix - Test update #### Description - Switched from the bitnami/postgresql image to bitnamilegacy/postgresql. - Reduced the retry profile's maximum elapsed time for service clients. - Added an additional level of parallelism for the secure client test. #### Related issues - resolves #140 - resolves #138 --------- Signed-off-by: Dean Amar <Dean.Amar@ibm.com>
1 parent 56aad55 commit ebfa78d

File tree

2 files changed

+35
-29
lines changed

2 files changed

+35
-29
lines changed

integration/runner/postgres.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ const (
2424
// The image includes built-in scripts and environment variables that handle replication configuration
2525
// out of the box, which reduces complexity and potential
2626
// misconfigurations compared to setting it up manually with the official image.
27-
postgresImage = "bitnami/postgresql"
27+
// Bitnami has migrated the bitnami/postgresql image to bitnamilegacy/postgresql,
28+
// where it no longer receives updates or security patches.
29+
// Since this image is used only for testing purposes, we can retain it for now.
30+
postgresImage = "bitnamilegacy/postgresql"
2831
defaultPostgresDBName = "postgres"
2932
defaultBitnamiPostgresTag = "latest"
3033

utils/test/secure_connection.go

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -133,33 +133,31 @@ func RunSecureConnectionTest(
133133
},
134134
},
135135
} {
136-
// create server's tls config and start it according to the serverSecureMode.
137-
serverTLS := tlsMgr.CreateServerCredentials(t, tc.serverMode, defaultHostName)
138-
rpcAttemptFunc := starter(t, serverTLS)
139-
// for each server secure mode, build the client's test cases.
140-
for _, clientTestCase := range tc.cases {
141-
clientTc := clientTestCase
142-
t.Run(fmt.Sprintf(
143-
"tls-mode:%s/%s",
144-
tc.serverMode,
145-
clientTc.testDescription,
146-
), func(t *testing.T) {
147-
t.Parallel()
148-
149-
cfg := baseClientTLS
150-
cfg.Mode = clientTc.clientSecureMode
151-
152-
ctx, cancel := context.WithTimeout(t.Context(), 90*time.Second)
153-
t.Cleanup(cancel)
154-
155-
err := rpcAttemptFunc(ctx, t, cfg)
156-
if clientTc.shouldFail {
157-
require.Error(t, err)
158-
} else {
159-
require.NoError(t, err)
160-
}
161-
})
162-
}
136+
t.Run(fmt.Sprintf("server-tls:%s", tc.serverMode), func(t *testing.T) {
137+
t.Parallel()
138+
// create server's tls config and start it according to the server tls mode.
139+
serverTLS := tlsMgr.CreateServerCredentials(t, tc.serverMode, defaultHostName)
140+
rpcAttemptFunc := starter(t, serverTLS)
141+
// for each server secure mode, build the client's test cases.
142+
for _, clientTestCase := range tc.cases {
143+
t.Run(clientTestCase.testDescription, func(t *testing.T) {
144+
t.Parallel()
145+
146+
cfg := baseClientTLS
147+
cfg.Mode = clientTestCase.clientSecureMode
148+
149+
ctx, cancel := context.WithTimeout(t.Context(), 90*time.Second)
150+
t.Cleanup(cancel)
151+
152+
err := rpcAttemptFunc(ctx, t, cfg)
153+
if clientTestCase.shouldFail {
154+
require.Error(t, err)
155+
} else {
156+
require.NoError(t, err)
157+
}
158+
})
159+
}
160+
})
163161
}
164162
}
165163

@@ -173,7 +171,12 @@ func CreateClientWithTLS[T any](
173171
protoClient func(grpc.ClientConnInterface) T,
174172
) T {
175173
t.Helper()
176-
conn, err := connection.Connect(NewSecuredDialConfig(t, endpoint, tlsCfg))
174+
dialConfig := NewSecuredDialConfig(t, endpoint, tlsCfg)
175+
// prevents secure connection tests from hanging until the context times out.
176+
dialConfig.SetRetryProfile(&connection.RetryProfile{
177+
MaxElapsedTime: 3 * time.Second,
178+
})
179+
conn, err := connection.Connect(dialConfig)
177180
require.NoError(t, err)
178181
t.Cleanup(func() {
179182
require.NoError(t, conn.Close())

0 commit comments

Comments
 (0)