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: host access port instability #2867

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

stevenh
Copy link
Collaborator

@stevenh stevenh commented Oct 31, 2024

Fix clean up of sshd container used for HostAccessPorts if the container setup fails.

Fix ensureDefaultNetwork instability by preferring the default network if available. This prevents random port forwarding test failures due to different network bindings between the containers.

Fix data race when reading exec command with Multiplexed enabled.

Fix deadlock if an error was encountered reading from a container exec command.

Refactor port forwarding tests so they can be run individually from code editors.

Add timeout to port forwarding requests so that we don't need to wait for a full test timeout to identify failures.

Copy link

netlify bot commented Oct 31, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 0a2d1ff
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/672a5f7876fe9e00085c6653
😎 Deploy Preview https://deploy-preview-2867--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.

@stevenh stevenh force-pushed the fix/orphaned-sshd-container branch 2 times, most recently from 7051de2 to d8be6d9 Compare October 31, 2024 21:18
@stevenh stevenh changed the title fix: orphaned sshd container fix: host access port instability Oct 31, 2024
@stevenh stevenh marked this pull request as ready for review November 1, 2024 09:55
@stevenh stevenh requested a review from a team as a code owner November 1, 2024 09:55
@stevenh stevenh requested a review from mdelapenya November 1, 2024 09:55
@stevenh stevenh force-pushed the fix/orphaned-sshd-container branch from 7597ee4 to 48b75b5 Compare November 5, 2024 12:29
Fix clean up of sshd container used for HostAccessPorts if the container
setup fails.

Fix ensureDefaultNetwork instability by preferring the default network
if available. This prevents random port forwarding test failures due
to different network bindings between the containers.

Fix data race when reading exec command with Multiplexed enabled.

Fix deadlock if an error was encountered reading from a container
exec command.

Refactor port forwarding tests so they can be run individually from
code editors.

Add timeout to port forwarding requests so that we don't need to wait
for a full test timeout to identify failures.
mdelapenya
mdelapenya previously approved these changes Nov 5, 2024
Copy link
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!

Added a few questions, not blockers, so feel free to resolve them if they do not apply. We'll merge right after that.

docker.go Show resolved Hide resolved
port_forwarding_test.go Outdated Show resolved Hide resolved
port_forwarding_test.go Show resolved Hide resolved
port_forwarding.go Show resolved Hide resolved
port_forwarding.go Show resolved Hide resolved
@mdelapenya mdelapenya self-assigned this Nov 5, 2024
@mdelapenya mdelapenya added the bug An issue with the library label Nov 5, 2024
Add TODO's and missing tests, renaming to they are more consistent.
Speed up host port access test by using explicit cancellation instead of
timeout.

Only allocate the ports once to reduce resource usage.
@stevenh stevenh requested a review from mdelapenya November 6, 2024 09:51
Copy link
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 merged commit 42e9a55 into main Nov 6, 2024
122 checks passed
@mdelapenya mdelapenya deleted the fix/orphaned-sshd-container branch November 6, 2024 11:13
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 19, 2024
* main: (34 commits)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (testcontainers#2868)
  ...
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 21, 2024
* main: (76 commits)
  fix(influxdb): Respect custom waitStrategy (testcontainers#2845)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  ...
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.

2 participants