Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: never cache JSON representation of a container #2606

Merged
merged 7 commits into from
Jul 2, 2024

Conversation

mdelapenya
Copy link
Collaborator

@mdelapenya mdelapenya commented Jun 25, 2024

  • chore: wait for the exposed ports before wait strategies
  • chore: do not cache raw representation of a container while inspecting it

What does this PR do?

We are removing the raw attribute of the container, so we are not caching it when calling the Inspect method of a container.

At the same time, a container will wait for all the exposed ports to be available from the Docker representation for the container.

Why is it important?

There are cases where Docker or the container runtime is not updating the mapped ports by the time testcontainers uses them. Here we are fixing them.

Related issues

Follow-ups

We probably need a way to cache again the response, but we can decide how in a follow-up. Returning to pre-#2534 seems convenient until then.

@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Jun 25, 2024
@mdelapenya mdelapenya requested a review from a team as a code owner June 25, 2024 16:48
@mdelapenya mdelapenya self-assigned this Jun 25, 2024
Copy link

netlify bot commented Jun 25, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 1be17a2
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/6683cce3fc24f000072f298d
😎 Deploy Preview https://deploy-preview-2606--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

* main:
  chore(deps): bump github.com/docker/docker from v26.1.4 to v27.0.2 (testcontainers#2593)
  fix: Rename TC_HOST environment variable to TESTCONTAINERS_HOST_OVERRIDE (testcontainers#2536)
  chore: test cleanups (testcontainers#2608)
  chore(ci): pass docker install type to the nightly build payload (testcontainers#2612)
  chore: run rootless mode in nighlty builds (testcontainers#2611)
  chore(deps): bump github.com/hashicorp/go-retryablehttp (testcontainers#2605)
  chore: improve log handling when container is stopping (testcontainers#2601)
@mdelapenya mdelapenya added bug An issue with the library and removed chore Changes that do not impact the existing functionality labels Jul 2, 2024
@mdelapenya mdelapenya changed the title chore: never cache JSON representation of a container fix: never cache JSON representation of a container Jul 2, 2024
@mdelapenya mdelapenya merged commit 59cf064 into testcontainers:main Jul 2, 2024
108 checks passed
mdelapenya added a commit that referenced this pull request Jul 2, 2024
* main:
  fix: never cache JSON representation of a container (#2606)
  chore: remove most uses of  TestcontainersConfig and deprecated TestcontainersConfig fields. (#2614)
  chore(deps): bump github.com/docker/docker from v27.0.2 to v27.0.3 (#2615)
  chore(deps): bump github.com/docker/docker from v26.1.4 to v27.0.2 (#2593)
@mdelapenya mdelapenya mentioned this pull request Jul 2, 2024
@mdelapenya mdelapenya deleted the wait-for-available-ports branch July 15, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: port not found when calling [Bug]: Restarted container cannot fetch its port
1 participant