fix(quic): properly unwrap OONI errors from TransportError (#495)

Noticed while playing around with QUIC code.

Part of https://github.com/ooni/probe/issues/1544.
This commit is contained in:
Simone Basso 2021-09-09 00:07:38 +02:00 committed by GitHub
commit 00a85cb7f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 128 additions and 27 deletions

View file

@ -144,28 +144,6 @@ func TestQUICDialerQUICGo(t *testing.T) {
}
})
t.Run("works as intended", func(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
tlsConfig := &tls.Config{
ServerName: "dns.google",
}
systemdialer := quicDialerQUICGo{
QUICListener: &quicListenerStdlib{},
}
ctx := context.Background()
sess, err := systemdialer.DialContext(
ctx, "udp", "8.8.8.8:443", tlsConfig, &quic.Config{})
if err != nil {
t.Fatal("not the error we expected", err)
}
<-sess.HandshakeComplete().Done()
if err := sess.CloseWithError(0, ""); err != nil {
t.Fatal(err)
}
})
t.Run("TLS defaults for web", func(t *testing.T) {
expected := errors.New("mocked error")
var gotTLSConfig *tls.Config