8a0c062844
See what we documented at https://github.com/ooni/spec/pull/257 Reference issue: https://github.com/ooni/probe/issues/2238 See also the related ooni/spec PR: https://github.com/ooni/spec/pull/257 See also https://github.com/ooni/probe/issues/2237 While there, bump webconnectivity@v0.5 version because this change has an impact onto the generated data format. The drop in coverage is unavoidable because we've written some tests for `measurex` to ensure we deal with DNS resolvers and transport names correctly depending on the splitting policy we use. (However, `measurex` is only used for the `tor` experiment and, per the step-by-step design document, new experiments should use `measurexlite` instead, so this is hopefully fine(TM).) While there, fix a broken integration test that does not run in `-short` mode.
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package measurex
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/miekg/dns"
|
|
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
|
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
|
)
|
|
|
|
func TestDNSXModifiesStdlibTransportName(t *testing.T) {
|
|
// See https://github.com/ooni/spec/pull/257 for more information.
|
|
child := netxlite.NewDNSOverGetaddrinfoTransport()
|
|
mx := NewMeasurerWithDefaultSettings()
|
|
dbout := &MeasurementDB{}
|
|
txp := mx.WrapDNSXRoundTripper(dbout, child)
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
cancel() // we want to fail immediately
|
|
query := &mocks.DNSQuery{
|
|
MockDomain: func() string {
|
|
return "dns.google"
|
|
},
|
|
MockType: func() uint16 {
|
|
return dns.TypeANY
|
|
},
|
|
MockBytes: func() ([]byte, error) {
|
|
return []byte{}, nil
|
|
},
|
|
MockID: func() uint16 {
|
|
return 1453
|
|
},
|
|
}
|
|
_, _ = txp.RoundTrip(ctx, query)
|
|
measurement := dbout.AsMeasurement()
|
|
var good int
|
|
for _, rtinfo := range measurement.DNSRoundTrip {
|
|
network := rtinfo.Network
|
|
if network != netxlite.StdlibResolverSystem {
|
|
t.Fatal("unexpected network", network)
|
|
}
|
|
good++
|
|
}
|
|
if good < 1 {
|
|
t.Fatal("no good entry seen")
|
|
}
|
|
}
|