feat: context-based tracing to record delayed DNS responses (#870)
See https://github.com/ooni/probe/issues/2221 Co-authored-by: decfox <decfox@github.com> Co-authored-by: Simone Basso <bassosimone@gmail.com>
This commit is contained in:
parent
fe6d378a1f
commit
2301a30630
10 changed files with 498 additions and 317 deletions
|
|
@ -84,7 +84,7 @@ func TestNewTrace(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
t.Run("DNSLookup has the expected buffer size", func(t *testing.T) {
|
||||
t.Run("dnsLookup has the expected buffer size", func(t *testing.T) {
|
||||
ff := &testingx.FakeFiller{}
|
||||
var idx int
|
||||
Loop:
|
||||
|
|
@ -99,11 +99,30 @@ func TestNewTrace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
if idx != DNSLookupBufferSize {
|
||||
t.Fatal("invalid DNSLookup channel buffer size")
|
||||
t.Fatal("invalid dnsLookup channel buffer size")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("TCPConnect has the expected buffer size", func(t *testing.T) {
|
||||
t.Run("delayedDNSResponse has the expected buffer size", func(t *testing.T) {
|
||||
ff := &testingx.FakeFiller{}
|
||||
var idx int
|
||||
Loop:
|
||||
for {
|
||||
ev := &model.ArchivalDNSLookupResult{}
|
||||
ff.Fill(ev)
|
||||
select {
|
||||
case trace.delayedDNSResponse <- ev:
|
||||
idx++
|
||||
default:
|
||||
break Loop
|
||||
}
|
||||
}
|
||||
if idx != DelayedDNSResponseBufferSize {
|
||||
t.Fatal("invalid delayedDNSResponse channel buffer size")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("tcpConnect has the expected buffer size", func(t *testing.T) {
|
||||
ff := &testingx.FakeFiller{}
|
||||
var idx int
|
||||
Loop:
|
||||
|
|
@ -118,11 +137,11 @@ func TestNewTrace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
if idx != TCPConnectBufferSize {
|
||||
t.Fatal("invalid TCPConnect channel buffer size")
|
||||
t.Fatal("invalid tcpConnect channel buffer size")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("TLSHandshake has the expected buffer size", func(t *testing.T) {
|
||||
t.Run("tlsHandshake has the expected buffer size", func(t *testing.T) {
|
||||
ff := &testingx.FakeFiller{}
|
||||
var idx int
|
||||
Loop:
|
||||
|
|
@ -137,11 +156,11 @@ func TestNewTrace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
if idx != TLSHandshakeBufferSize {
|
||||
t.Fatal("invalid TLSHandshake channel buffer size")
|
||||
t.Fatal("invalid tlsHandshake channel buffer size")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("QUICHandshake has the expected buffer size", func(t *testing.T) {
|
||||
t.Run("quicHandshake has the expected buffer size", func(t *testing.T) {
|
||||
ff := &testingx.FakeFiller{}
|
||||
var idx int
|
||||
Loop:
|
||||
|
|
@ -156,7 +175,7 @@ func TestNewTrace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
if idx != QUICHandshakeBufferSize {
|
||||
t.Fatal("invalid QUICHandshake channel buffer size")
|
||||
t.Fatal("invalid quicHandshake channel buffer size")
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue