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

port forward util returns before port forward is available for use #9353

Open
jbohanon opened this issue Apr 11, 2024 · 0 comments
Open

port forward util returns before port forward is available for use #9353

jbohanon opened this issue Apr 11, 2024 · 0 comments
Labels
Type: Bug Something isn't working

Comments

@jbohanon
Copy link
Contributor

Gloo Edge Product

Open Source

Gloo Edge Version

v1.17.0

Kubernetes Version

All

Describe the bug

The utility to create a port forward, when started, does not wait until the port forward is available for use. This can cause a race condition in tests which expect to be able to make requests against the forwarded port immediately upon Start returning.

Expected Behavior

Start should not return without an error until the port is reachable

Steps to reproduce the bug

Set up a test that creates a port forward using

portFwd := portforward.NewPortForwarder(
	portforward.WithDeployment(proxyName, namespace),
	portforward.WithPorts(19000, 19000),
)
err = portFwd.Start(ctx)
Expect(err).NotTo(HaveOccurred())
defer func() {
	portFwd.Close()
	portFwd.WaitForStop()
}()

then immediately try a request against the forwarded port. It is possible that it will work appropriately, but it will be flaky at best since the port is not guaranteed to be available yet

Additional Environment Detail

No response

Additional Context

func (c *cliPortForwarder) Start(ctx context.Context, options ...retry.Option) error {

https://github.com/solo-io/solo-projects/pull/5973/files#r1560360903

@jbohanon jbohanon added the Type: Bug Something isn't working label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant