diff --git a/experiment/sniblocking/sniblocking_test.go b/experiment/sniblocking/sniblocking_test.go index 3fc6a7ce..f26243e4 100644 --- a/experiment/sniblocking/sniblocking_test.go +++ b/experiment/sniblocking/sniblocking_test.go @@ -191,9 +191,48 @@ func TestUnitMeasureoneCancelledContext(t *testing.T) { if *result.Failure != modelx.FailureGenericTimeoutError { t.Fatal("unexpected failure") } + if result.Agent != "" { + t.Fatal("not the expected Agent") + } + if result.BootstrapTime != 0.0 { + t.Fatal("not the expected BootstrapTime") + } + if result.DNSCache != nil { + t.Fatal("not the expected DNSCache") + } + if result.FailedOperation != nil { + t.Fatal("not the expected FailedOperation") + } + if result.Failure == nil || *result.Failure != modelx.FailureGenericTimeoutError { + t.Fatal("not the expected failure") + } + if result.NetworkEvents != nil { + t.Fatal("not the expected NetworkEvents") + } + if result.Queries != nil { + t.Fatal("not the expected Queries") + } + if result.Requests != nil { + t.Fatal("not the expected Requests") + } + if result.SOCKSProxy != "" { + t.Fatal("not the expected SOCKSProxy") + } + if result.TCPConnect != nil { + t.Fatal("not the expected TCPConnect") + } + if result.TLSHandshakes != nil { + t.Fatal("not the expected TLSHandshakes") + } + if result.Tunnel != "" { + t.Fatal("not the expected Tunnel") + } if result.SNI != "kernel.org" { t.Fatal("unexpected SNI") } + if result.THAddress != "example.com:443" { + t.Fatal("unexpected THAddress") + } } func TestUnitMeasureoneSuccess(t *testing.T) { @@ -204,12 +243,48 @@ func TestUnitMeasureoneSuccess(t *testing.T) { "kernel.org", "example.com:443", ) - if *result.Failure != modelx.FailureSSLInvalidHostname { + if result.Agent != "redirect" { + t.Fatal("not the expected Agent") + } + if result.BootstrapTime != 0.0 { + t.Fatal("not the expected BootstrapTime") + } + if result.DNSCache != nil { + t.Fatal("not the expected DNSCache") + } + if result.FailedOperation == nil || *result.FailedOperation != modelx.TLSHandshakeOperation { + t.Fatal("not the expected FailedOperation") + } + if result.Failure == nil || *result.Failure != modelx.FailureSSLInvalidHostname { t.Fatal("unexpected failure") } + if len(result.NetworkEvents) < 1 { + t.Fatal("not the expected NetworkEvents") + } + if len(result.Queries) < 1 { + t.Fatal("not the expected Queries") + } + if result.Requests != nil { + t.Fatal("not the expected Requests") + } + if result.SOCKSProxy != "" { + t.Fatal("not the expected SOCKSProxy") + } + if len(result.TCPConnect) < 1 { + t.Fatal("not the expected TCPConnect") + } + if len(result.TLSHandshakes) < 1 { + t.Fatal("not the expected TLSHandshakes") + } + if result.Tunnel != "" { + t.Fatal("not the expected Tunnel") + } if result.SNI != "kernel.org" { t.Fatal("unexpected SNI") } + if result.THAddress != "example.com:443" { + t.Fatal("unexpected THAddress") + } } func TestUnitMeasureonewithcacheWorks(t *testing.T) { diff --git a/experiment/urlgetter/urlgetter.go b/experiment/urlgetter/urlgetter.go index be7a5a1a..e0e9d6ed 100644 --- a/experiment/urlgetter/urlgetter.go +++ b/experiment/urlgetter/urlgetter.go @@ -42,8 +42,8 @@ type TestKeys struct { NetworkEvents []archival.NetworkEvent `json:"network_events"` Queries []archival.DNSQueryEntry `json:"queries"` Requests []archival.RequestEntry `json:"requests"` - TCPConnect []archival.TCPConnectEntry `json:"tcp_connect"` SOCKSProxy string `json:"socksproxy,omitempty"` + TCPConnect []archival.TCPConnectEntry `json:"tcp_connect"` TLSHandshakes []archival.TLSHandshake `json:"tls_handshakes"` Tunnel string `json:"tunnel,omitempty"`