-
Notifications
You must be signed in to change notification settings - Fork 48
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
WIP: Draft PR for improving connectivity testing to capture resolved IPs and all attempts #228
base: main
Are you sure you want to change the base?
Conversation
@fortuna I appreciate your feedback on the format and the proposed approach for testing. This is in reference to #209 (comment) |
@@ -268,6 +268,11 @@ func NewUDPResolver(pd transport.PacketDialer, resolverAddr string) Resolver { | |||
return nil, &nestedError{ErrDial, err} | |||
} | |||
defer conn.Close() | |||
// force close connection is context is done/cancelled. |
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.
@fortuna I have to add this here to close the connection for pending receives (in case of timeouts) when another attempt succeeds. I managed to do this with the following change. I am basically cancelling the passed context in connectivity.go
and checking if context is done. This is the best I came up with but I am not sure if there's a more elegant way to accomplish this.
dns/resolver.go
Outdated
@@ -391,3 +396,14 @@ func NewHTTPSResolver(sd transport.StreamDialer, resolverAddr string, url string | |||
return &msg, nil | |||
}) | |||
} | |||
|
|||
func wrappErrors(err1, err2 error) error { |
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.
@fortuna we need to use this function instead of errors.Join()
since errors.Join()
breaks the wrapped chain of errors. when we are unwrapping the errors with unwrapAll()
in makeErrorRecord
in test_connectivity.go
(
record.Msg = unwrapAll(result.Err).Error() |
d597f81
to
60eed45
Compare
Note: The code is still messy not ready for merge. I made this PR to discuss upcoming high-level changes to the testing approach and format for connectivity testing pursuant to #209 (comment)
I moved the
loop
that iterates over ip addresses outside of the intercept dialer. This way in each iteration I am generating a new intercept dialer that takes one of the resolved addresses and use that to continue the end-to-end test.In this approach, I am allowing each attempt to run end-to-end. The test may fail earlier for example at connect attempt. In that case, it won't continue to the next stage. However each attempt could continue to the end and test for connect/read/write operations for each resolved IP.
We also need to decide if test for all resolved IPs or abort at success.
Format
I am proposing below format that we can use for both
udp
andtcp
.List of suggested format changes:
ConnectivityError
type that includesop
,PosixError
,Error
fields.selected_address
in the main report. It is hard to tell which address this should be populated with.error
field in the main report should be populated with. What if the test makes 3 attempts and all of them fail with different types of errors. Does 'error' then reflect? I guess when one of the attempts succeederror
field should benil
.TODO: The code is slow and I am planning to optimize it such that tests run in an independent treads in parallel.
TODO: Update the format in the code to match the proposal