Download this file
| 1 | package host |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func 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 | |
| 17 | func TestGeoIPStateNilBeforeTheEdgeIsReady(t *testing.T) { |
| 18 | if geoIPState() != nil { |
| 19 | t.Fatal("no edge published yet must mean no GeoIP block") |
| 20 | } |
| 21 | } |
| 22 | |