chore: improve testing and increase coverage (#794)
This diff improves testing and increases coverage inside the ./internal/netxlite and ./internal/tracex packages. See https://github.com/ooni/probe/issues/2121
This commit is contained in:
parent
464d03184e
commit
d5249a6cf7
11 changed files with 621 additions and 348 deletions
36
internal/tracex/event_test.go
Normal file
36
internal/tracex/event_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package tracex
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestUnusedEventsNames(t *testing.T) {
|
||||
// Tests that we don't break the names of events we're currently
|
||||
// not getting the name of directly even if they're saved.
|
||||
|
||||
t.Run("EventQUICHandshakeStart", func(t *testing.T) {
|
||||
ev := &EventQUICHandshakeStart{}
|
||||
if ev.Name() != "quic_handshake_start" {
|
||||
t.Fatal("invalid event name")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("EventQUICHandshakeDone", func(t *testing.T) {
|
||||
ev := &EventQUICHandshakeDone{}
|
||||
if ev.Name() != "quic_handshake_done" {
|
||||
t.Fatal("invalid event name")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("EventTLSHandshakeStart", func(t *testing.T) {
|
||||
ev := &EventTLSHandshakeStart{}
|
||||
if ev.Name() != "tls_handshake_start" {
|
||||
t.Fatal("invalid event name")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("EventTLSHandshakeDone", func(t *testing.T) {
|
||||
ev := &EventTLSHandshakeDone{}
|
||||
if ev.Name() != "tls_handshake_done" {
|
||||
t.Fatal("invalid event name")
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue