package host import "testing" func TestTunnelEnvComplete(t *testing.T) { env := map[string]string{"CARLOS_TUNNEL_URL": "https://t", "CARLOS_TUNNEL_TOKEN": "x", "CARLOS_TUNNEL_NAME": "n"} get := func(k string) string { return env[k] } if !tunnelEnvComplete(get) { t.Fatal("complete env") } delete(env, "CARLOS_TUNNEL_NAME") if tunnelEnvComplete(get) { t.Fatal("incomplete env must not make a tunnel client (tunnelLoop would not run)") } } func TestGeoIPStateNilBeforeTheEdgeIsReady(t *testing.T) { if geoIPState() != nil { t.Fatal("no edge published yet must mean no GeoIP block") } }