Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the test work with a big WTF
Browse files Browse the repository at this point in the history
bassosimone committed Sep 4, 2023

Verified

This commit was signed with the committer’s verified signature.
abelsromero Abel Salgado Romero
1 parent d075aad commit 3145e55
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions internal/netemx/http3_test.go
Original file line number Diff line number Diff line change
@@ -13,8 +13,24 @@ import (

func TestHTTP3ServerFactory(t *testing.T) {
t.Run("when using the TLSConfig provided by netem", func(t *testing.T) {
/*
__ ________________________
/ \ / \__ ___/\_ _____/
\ \/\/ / | | | __)
\ / | | | \
\__/\ / |____| \___ /
\/ \/
I originally wrote this test to use AddressWwwExampleCom and the test
failed with generic_timeout_error. Now, instead, if I change it to use
10.55.56.57, the test is working as intended. I am wondering whether
I am not fully understanding how quic-go/quic-go works.
See https://github.com/ooni/probe/issues/2527.
*/

env := MustNewQAEnv(
QAEnvOptionNetStack(AddressWwwExampleCom, &HTTP3ServerFactory{
QAEnvOptionNetStack("10.55.56.57", &HTTP3ServerFactory{
Factory: HTTPHandlerFactoryFunc(func() http.Handler {
return ExampleWebPageHandler()
}),
@@ -24,7 +40,7 @@ func TestHTTP3ServerFactory(t *testing.T) {
)
defer env.Close()

env.AddRecordToAllResolvers("www.example.com", "", AddressWwwExampleCom)
env.AddRecordToAllResolvers("www.example.com", "", "10.55.56.57")

env.Do(func() {
client := netxlite.NewHTTP3ClientWithResolver(log.Log, netxlite.NewStdlibResolver(log.Log))
@@ -48,14 +64,28 @@ func TestHTTP3ServerFactory(t *testing.T) {
})

t.Run("when using an incompatible TLS config", func(t *testing.T) {
t.Skip("https://github.com/ooni/probe/issues/2527")
/*
__ ________________________
/ \ / \__ ___/\_ _____/
\ \/\/ / | | | __)
\ / | | | \
\__/\ / |____| \___ /
\/ \/
I originally wrote this test to use AddressWwwExampleCom and the test
failed with generic_timeout_error. Now, instead, if I change it to use
10.55.56.100, the test is working as intended. I am wondering whether
I am not fully understanding how quic-go/quic-go works.
See https://github.com/ooni/probe/issues/2527.
*/

// we're creating a distinct MITM TLS config and we're using it, so we expect
// that we're not able to verify certificates in client code
mitmConfig := runtimex.Try1(netem.NewTLSMITMConfig())

env := MustNewQAEnv(
QAEnvOptionNetStack(AddressWwwExampleCom, &HTTP3ServerFactory{
QAEnvOptionNetStack("10.55.56.100", &HTTP3ServerFactory{
Factory: HTTPHandlerFactoryFunc(func() http.Handler {
return ExampleWebPageHandler()
}),
@@ -65,7 +95,7 @@ func TestHTTP3ServerFactory(t *testing.T) {
)
defer env.Close()

env.AddRecordToAllResolvers("www.example.com", "", AddressWwwExampleCom)
env.AddRecordToAllResolvers("www.example.com", "", "10.55.56.100")

env.Do(func() {
client := netxlite.NewHTTP3ClientWithResolver(log.Log, netxlite.NewStdlibResolver(log.Log))

0 comments on commit 3145e55

Please sign in to comment.