Skip to content

Commit 1c05dd5

Browse files
authored
chore(deps): bump Ryuk to v0.14.0 (#3313)
* chore(deps): bump Ryuk to v0.14.0 * fix(ryuk): more robust wait strategy Signed-off-by: mdelapenya <[email protected]> --------- Signed-off-by: mdelapenya <[email protected]>
1 parent 96ab095 commit 1c05dd5

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎internal/config/config.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/magiconair/properties"
1212
)
1313

14-
const ReaperDefaultImage = "testcontainers/ryuk:0.13.0"
14+
const ReaperDefaultImage = "testcontainers/ryuk:0.14.0"
1515

1616
var (
1717
tcConfig Config

‎reaper.go‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,20 @@ func (r *reaperSpawner) fromContainer(ctx context.Context, sessionID string, pro
367367
}, nil
368368
}
369369

370+
// defaultRyukWaitStrategy returns the wait strategy used when creating a new
371+
// reaper container. It combines a log match for "Started" (the moment ryuk's
372+
// TCP listener is bound inside the container, which is the readiness signal
373+
// also used by other Testcontainers libraries) with a host port-mapping check,
374+
// to guard against the docker-proxy accepting TCP connections before the ryuk
375+
// process is actually listening — a race that surfaced once the ryuk binary
376+
// was UPX-compressed.
377+
func defaultRyukWaitStrategy(port string) wait.Strategy {
378+
return wait.ForAll(
379+
wait.ForLog("Started"),
380+
wait.ForListeningPort(port),
381+
)
382+
}
383+
370384
// newReaper creates a connected Reaper with a sessionID to identify containers
371385
// and a provider to use.
372386
func (r *reaperSpawner) newReaper(ctx context.Context, sessionID string, provider ReaperProvider) (reaper *Reaper, err error) {
@@ -378,7 +392,7 @@ func (r *reaperSpawner) newReaper(ctx context.Context, sessionID string, provide
378392
Image: config.ReaperDefaultImage,
379393
ExposedPorts: []string{port.String()},
380394
Labels: core.DefaultLabels(sessionID),
381-
WaitingFor: wait.ForListeningPort(port.String()),
395+
WaitingFor: defaultRyukWaitStrategy(port.String()),
382396
Name: reaperContainerNameFromSessionID(sessionID),
383397
HostConfigModifier: func(hc *container.HostConfig) {
384398
hc.AutoRemove = true

‎reaper_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919

2020
"github.com/testcontainers/testcontainers-go/internal/config"
2121
"github.com/testcontainers/testcontainers-go/internal/core"
22-
"github.com/testcontainers/testcontainers-go/wait"
2322
)
2423

2524
// testSessionID the tests need to create a reaper in a different session, so that it does not interfere with other tests
@@ -78,7 +77,7 @@ func expectedReaperRequest(customize ...func(*ContainerRequest)) ContainerReques
7877
hostConfig.Binds = []string{core.MustExtractDockerSocket(context.Background()) + ":/var/run/docker.sock"}
7978
hostConfig.Privileged = true
8079
},
81-
WaitingFor: wait.ForListeningPort("8080/tcp"),
80+
WaitingFor: defaultRyukWaitStrategy("8080/tcp"),
8281
Env: map[string]string{
8382
"RYUK_CONNECTION_TIMEOUT": "1m0s",
8483
"RYUK_RECONNECTION_TIMEOUT": "10s",

0 commit comments

Comments
 (0)