carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import "testing"
4
5func TestTunnelEnvComplete(t *testing.T) {
6 env := map[string]string{"CARLOS_TUNNEL_URL": "https://t", "CARLOS_TUNNEL_TOKEN": "x", "CARLOS_TUNNEL_NAME": "n"}
7 get := func(k string) string { return env[k] }
8 if !tunnelEnvComplete(get) {
9 t.Fatal("complete env")
10 }
11 delete(env, "CARLOS_TUNNEL_NAME")
12 if tunnelEnvComplete(get) {
13 t.Fatal("incomplete env must not make a tunnel client (tunnelLoop would not run)")
14 }
15}
16
17func TestGeoIPStateNilBeforeTheEdgeIsReady(t *testing.T) {
18 if geoIPState() != nil {
19 t.Fatal("no edge published yet must mean no GeoIP block")
20 }
21}
22