ooni-probe-cli/internal/engine/geolocate/ipconfig_test.go
Arturo Filastò 70d7c1a22c
Add signal to the im test group (#259)
* Add signal to the im test group

* fix(ipconfig_test.go): disable when running in CI

Reference issue: https://github.com/ooni/probe/issues/1418

* fix(geolocate): remove unused variable

Came across this while looking into this issue with the CI that
is now failing. Guess fixing it here comes across as leaving the
camp slightly less in a bad shape than how I found it.

Co-authored-by: Simone Basso <bassosimone@gmail.com>
2021-03-22 14:31:50 +01:00

33 lines
684 B
Go

package geolocate
import (
"context"
"net"
"net/http"
"os"
"testing"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/engine/httpheader"
)
func TestIPLookupWorksUsingIPConfig(t *testing.T) {
if os.Getenv("CI") == "true" {
// See https://github.com/ooni/probe-cli/pull/259/checks?check_run_id=2166066881#step:5:123
// as well as https://github.com/ooni/probe/issues/1418.
t.Skip("This test does not work with GitHub Actions")
}
ip, err := ipConfigIPLookup(
context.Background(),
http.DefaultClient,
log.Log,
httpheader.UserAgent(),
)
if err != nil {
t.Fatal(err)
}
if net.ParseIP(ip) == nil {
t.Fatalf("not an IP address: '%s'", ip)
}
}