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:
Simone Basso 2022-06-04 14:58:48 +02:00 committed by GitHub
commit d5249a6cf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 621 additions and 348 deletions

View 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")
}
})
}