Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Make it possible to test gateway opening/closing in Connect #14135
Make it possible to test gateway opening/closing in Connect #14135
Changes from 6 commits
84b7823
1decc93
8c86b65
1efd5ef
5df7832
18b6244
2fafc35
3e34e02
752907d
d32a5d7
031d210
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@espadolini One thing that worries me is that this check fails only if I don't start the listener on that address. It doesn't fail if I never actually start the local proxy or if I start it after 1.5 second.
It turns out that
localProxy.Start()
, unlike gRPC'sServer.Serve()
, doesn't error if it's called afterClose()
.So the test not failing if
Serve()
is called afterClose()
is okay I guess. But why doesn't the test fail if never start the local proxy?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to adapt this to
teleterm_test.go
to replacetime.Sleep
withDial
but it seems that I misunderstood howDial
works. It doesn't actually wait for the other side to accept the connection since, as you said, the listener buffers those connections before they're accepted by the server.So I cannot really use
Dial
there to make sure the server is accepting connections.Diff of teleterm_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
conn.Read()
block until the server accepts the connection?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think
conn.Read()
does the trick. I just pushed 3e34e02 which fails if the connection isn't accepted within a second.I was also able to improve teleterm tests in a similar way, I'll push those changes in a separate PR.