Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
ainghazal committed Jul 31, 2024
1 parent d07741a commit a05eeac
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions internal/experiment/openvpn/targets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,37 @@ func Test_resolveTarget(t *testing.T) {
}

_, err := resolveTarget("google.com")

if err != nil {
if err.Error() == "connection_refused" {
// connection_refused is raised when running this test
// on the restricted network for coverage tests.
// so we bail out
return
}
t.Fatal("should be able to resolve the target")
}

_, err = resolveTarget("nothing.corp")
if err == nil {
t.Fatal("should be able to resolve the target")
t.Fatal("should not be able to resolve the target")
}

_, err = resolveTarget("asfasfasfasfasfafs.ooni.io")
if err == nil {
t.Fatal("should be able to resolve the target")
t.Fatal("should not be able to resolve the target")
}
}

func Test_defaultOONIOpenVPNTargetUDP(t *testing.T) {
url, err := defaultOONIOpenVPNTargetUDP()
if err != nil {
if err.Error() == "connection_refused" {
// connection_refused is raised when running this test
// on the restricted network for coverage tests.
// so we bail out
return
}
t.Fatal("unexpected error")
}
expected := "openvpn://oonivpn.corp/?address=37.218.243.98:1194&transport=udp"
Expand All @@ -42,6 +55,12 @@ func Test_defaultOONIOpenVPNTargetUDP(t *testing.T) {
func Test_defaultOONIOpenVPNTargetTCP(t *testing.T) {
url, err := defaultOONIOpenVPNTargetTCP()
if err != nil {
if err.Error() == "connection_refused" {
// connection_refused is raised when running this test
// on the restricted network for coverage tests.
// so we bail out
return
}
t.Fatal("unexpected error")
}
expected := "openvpn://oonivpn.corp/?address=37.218.243.98:1194&transport=tcp"
Expand Down

0 comments on commit a05eeac

Please sign in to comment.