refactor(netxlite): finish grouping tests (#488)
They are now more readable. I'll do another pass and start separating integration testing from unit testing. I think we need to have some always on integration testing for netxlite that runs on macOS, linux, and windows. See https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
493b72b170
commit
f2e3e5cc08
7 changed files with 1100 additions and 1088 deletions
|
|
@ -1,12 +1,15 @@
|
|||
package netxlite_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
utls "gitlab.com/yawning/utls.git"
|
||||
)
|
||||
|
||||
func TestHTTPTransport(t *testing.T) {
|
||||
|
|
@ -49,3 +52,21 @@ func TestHTTP3Transport(t *testing.T) {
|
|||
txp.CloseIdleConnections()
|
||||
})
|
||||
}
|
||||
|
||||
func TestUTLSHandshaker(t *testing.T) {
|
||||
t.Run("with chrome fingerprint", func(t *testing.T) {
|
||||
h := netxlite.NewTLSHandshakerUTLS(log.Log, &utls.HelloChrome_Auto)
|
||||
cfg := &tls.Config{ServerName: "google.com"}
|
||||
conn, err := net.Dial("tcp", "google.com:443")
|
||||
if err != nil {
|
||||
t.Fatal("unexpected error", err)
|
||||
}
|
||||
conn, _, err = h.Handshake(context.Background(), conn, cfg)
|
||||
if err != nil {
|
||||
t.Fatal("unexpected error", err)
|
||||
}
|
||||
if conn == nil {
|
||||
t.Fatal("nil connection")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue