testhelpers(ldap): always time out if we can't start the container in 1 minute (#31509)

Signed-off-by: Ryan Cragun <me@ryan.ec>
This commit is contained in:
Ryan Cragun 2025-08-15 17:35:06 -06:00 committed by GitHub
parent 04295060d1
commit 4c3a440e1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ import (
"runtime"
"strings"
"testing"
"time"
"github.com/hashicorp/cap/ldap"
"github.com/hashicorp/vault/sdk/helper/docker"
@ -55,8 +56,9 @@ func PrepareTestContainer(t *testing.T, version string) (cleanup func(), cfg *ld
var started bool
ctx, _ := context.WithTimeout(t.Context(), 1*time.Minute)
for i := 0; i < 3; i++ {
svc, err := runner.StartService(context.Background(), func(ctx context.Context, host string, port int) (docker.ServiceConfig, error) {
svc, err := runner.StartService(ctx, func(ctx context.Context, host string, port int) (docker.ServiceConfig, error) {
connURL := fmt.Sprintf("ldap://%s:%d", host, port)
cfg.Url = connURL