This repository has been archived by the owner on Mar 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Intermittent internal/dialerapi tests failure #1
Labels
bug
Something isn't working
Comments
Running
|
So, the problem is that, with a super short timeout as in func TestIntegrationTLSHandshakeTimeout(t *testing.T) {
dialer := dialerapi.NewDialer(time.Now(), handlers.StdoutHandler)
dialer.TLSHandshakeTimeout = 1 // very small timeout
conn, err := dialer.DialTLS("tcp", "ooni.io:443")
if err == nil {
t.Fatal("expected an error here")
}
if conn != nil {
t.Fatal("expected a nil conn here")
}
} There is a race between: tc = tls.Client(net.Conn(conn), config)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
ech := make(chan error, 1)
start := time.Now()
go func() {
ech <- tc.Handshake()
}()
select {
case <-ctx.Done():
err = ctx.Err()
case err = <-ech:
// FALLTHROUGH
} and if err != nil {
tc.Close()
tc = nil
} where |
bassosimone
added a commit
that referenced
this issue
Sep 19, 2019
This would have prevented #1 early.
bassosimone
added a commit
that referenced
this issue
Oct 22, 2019
All the netx code now does not depend on a preconfigured beginning and handler, except toplevel code. This is very helpful because it allows us to specify different contexts depending on circumstances. Yet, the public API has not changed because there is still a notion of the binding of a dialer with a handler. What I like about this change is that it allows us to evolve our code potentially in two directions: 1. we keep a single handler and we provide correct information concerning the current TransactionID 2. we switch to a rooted handlers model where the handler is passed as part of the context Now, internals in netx already follow model #2, while the toplevel API is still using model #1. The part that needs refactoring now is httpx.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
i have seen this intermittent unit tests failure:
The text was updated successfully, but these errors were encountered: