Skip to content

Commit

Permalink
Fix race condition when looking up reaper (ryuk) container (#2508)
Browse files Browse the repository at this point in the history
* If the ryuk container has a health status, wait for a healthy container before returning.

* Use docker/types for health status, but also check for the zero value.

* Wait for the ryuk port to be available in case the container is still being started by newReaper in a separate process.

A race between newReaper and lookUpReaperContainer occurs:
- newReaper creates the container with a ContainerRequest.WaitingFor = wait.ForListeningPort(listeningPort)
- newReaper starts the container
- lookUpReaperContainer obtains the container and returns.
- newReaper invokes the readiness hook wait.ForListeningPort(listeningPort).

* Fix whitespace.

* chore: simplify

* chore: make lint

* chore: change emoji in log output when waiting

* chore: move inside reuseReaper

---------

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
  • Loading branch information
emetsger and mdelapenya committed Jun 18, 2024
1 parent 693edb8 commit 1d694a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ func (c *DockerContainer) WaitUntilReady(ctx context.Context) error {

// if a Wait Strategy has been specified, wait before returning
c.Printf(
"🚧 Waiting for container id %s image: %s. Waiting for: %+v",
" Waiting for container id %s image: %s. Waiting for: %+v",
c.GetContainerID()[:12], c.GetImage(), c.WaitingFor,
)

Expand Down

0 comments on commit 1d694a5

Please sign in to comment.