Skip to content

Fix network accessor for port-forwarding feature#2551

Merged
mdelapenya merged 2 commits intotestcontainers:mainfrom
JulienBreux:fix/network-and-port-forward
May 24, 2024
Merged

Fix network accessor for port-forwarding feature#2551
mdelapenya merged 2 commits intotestcontainers:mainfrom
JulienBreux:fix/network-and-port-forward

Conversation

@JulienBreux
Copy link
Copy Markdown
Contributor

What does this PR do?

This pull-request fixes a bug in the port-fowarding functionality.
There is confusion between the use of the network name and the network identifier.
In order to correct the problem, a new function for selecting the network by name has been added.

@JulienBreux JulienBreux requested a review from a team as a code owner May 23, 2024 13:33
@netlify
Copy link
Copy Markdown

netlify bot commented May 23, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit cd96afb
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/665079a0d84b470008899e11
😎 Deploy Preview https://deploy-preview-2551--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.

@JulienBreux
Copy link
Copy Markdown
Contributor Author

@mdelapenya could you help me?
Sorry for direct ping dear friend!
But it's a blocker for my TS-Go usage 🥹

@kiview
Copy link
Copy Markdown
Member

kiview commented May 24, 2024

Hey @JulienBreux, could you please elaborate in what kind of behavior this issue manifests? Or how it can be reproduced? Asking, because I want to align with our implementation in other languages.

@JulienBreux
Copy link
Copy Markdown
Contributor Author

Hey @JulienBreux, could you please elaborate in what kind of behavior this issue manifests? Or how it can be reproduced? Asking, because I want to align with our implementation in other languages.

Sure! If you read this PR, you'll see that in the code there is a confusion between "name" and "id" of network.
I just fix this because, always I want to use this feature with a specific custom network, I've the error "network not found".
Normal behaviour, because the code search the first network "by name" and put to a network.Get by ID.

IDK if I'm clear.
So to reproduce, easy:

  1. Create a network
  2. Create a generic container using this network
    2.1) Configure the "ExposeHostPorts" field

Network not found!

Copy link
Copy Markdown
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdelapenya mdelapenya self-assigned this May 24, 2024
@mdelapenya mdelapenya added the bug An issue with the library label May 24, 2024
@JulienBreux
Copy link
Copy Markdown
Contributor Author

JulienBreux commented May 24, 2024

@mdelapenya in your own opinion, this feature is for a next patch, for example "v0.31.1" or for a new major minor version "v0.32.0" ?
Thanks to you, and my apologies for the direct (force) touch. 😊

@mdelapenya
Copy link
Copy Markdown
Member

I'm usually doing a monthly minor release, so it will probably land into the next minor.

@mdelapenya mdelapenya merged commit d4a21ea into testcontainers:main May 24, 2024
@JulienBreux JulienBreux deleted the fix/network-and-port-forward branch May 28, 2024 08:12
mdelapenya added a commit to bearrito/testcontainers-go that referenced this pull request Jun 11, 2024
* main: (48 commits)
  Fix race condition when looking up reaper (ryuk) container (testcontainers#2508)
  chore: bring golangci-lint back (testcontainers#2571)
  docs(compose): Fix typo docker compose docs (testcontainers#2565)
  Handle error properly during port forwarding initialization. (testcontainers#2550)
  chore: pin vearch version (testcontainers#2568)
  feat: add vearch module (testcontainers#2560)
  chore: run tests against latest Docker engine, nightly (testcontainers#2566)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.0.7 (testcontainers#2562)
  Fix network accessor for port-forwarding feature (testcontainers#2551)
  --- (testcontainers#2549)
  fix: update search bar eval in mkdocs (testcontainers#2547)
  docs: improve contributing docs for code snippets (testcontainers#2546)
  chore: use a virtualenv for working with the docs site (testcontainers#2545)
  docs: document test session semantics (testcontainers#2544)
  feat(ryuk): allow to configure ryuk timeouts using env variables (testcontainers#2541)
  docs: fix CircleCI docs (testcontainers#2539)
  fix: add import to module generation (testcontainers#2537)
  chore: prepare for next minor development cycle (0.32.0)
  chore: use new version (v0.31.0) in modules and examples
  feat(mongodb): add replica set support via opts (testcontainers#2469)
  ...
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.

3 participants