Files
go-otel/internal/geoip/geoip_test.go
T
mats 8824af8699
Build and Publish / Metadata (push) Successful in 2s
Build and Publish / BuildAndDeployAmd64 (push) Failing after 4s
fixes
2026-09-20 09:52:49 +02:00

26 lines
657 B
Go

package geoip
import (
"net/netip"
"testing"
)
func TestLookupWithoutDB(t *testing.T) {
var l *Lookup
if r := l.Lookup(netip.MustParseAddr("8.8.8.8")); r.Configured || r.Country != "" {
t.Fatalf("unexpected result %+v", r)
}
if r := l.Lookup(netip.MustParseAddr("10.1.2.3")); r.Scope != "private" {
t.Fatalf("want private scope, got %+v", r)
}
if r := l.Lookup(netip.MustParseAddr("::ffff:127.0.0.1")); r.Scope != "loopback" || r.IP != "127.0.0.1" {
t.Fatalf("want unmapped loopback, got %+v", r)
}
}
func TestOpenEmpty(t *testing.T) {
if l, err := Open("", ""); l != nil || err != nil {
t.Fatalf("want nil,nil got %v,%v", l, err)
}
}