| 11 | ) |
| 12 | |
| 13 | func TestConfigFileSettings(t *testing.T) { |
| 14 | var ( |
| 15 | firstIngress = UnvalidatedIngressRule{ |
| 16 | Hostname: "tunnel1.example.com", |
| 17 | Path: "/id", |
| 18 | Service: "https://localhost:8000", |
| 19 | } |
| 20 | secondIngress = UnvalidatedIngressRule{ |
| 21 | Hostname: "*", |
| 22 | Path: "", |
| 23 | Service: "https://localhost:8001", |
| 24 | } |
| 25 | warpRouting = WarpRoutingConfig{ |
| 26 | ConnectTimeout: &CustomDuration{Duration: 2 * time.Second}, |
| 27 | TCPKeepAlive: &CustomDuration{Duration: 10 * time.Second}, |
| 28 | } |
| 29 | ) |
| 30 | rawYAML := ` |
| 31 | tunnel: config-file-test |
| 32 | originRequest: |
| 33 | ipRules: |
| 34 | - prefix: "10.0.0.0/8" |
| 35 | ports: |
| 36 | - 80 |
| 37 | - 8080 |
| 38 | allow: false |
| 39 | - prefix: "fc00::/7" |
| 40 | ports: |
| 41 | - 443 |
| 42 | - 4443 |
| 43 | allow: true |
| 44 | ingress: |
| 45 | - hostname: tunnel1.example.com |
| 46 | path: /id |
| 47 | service: https://localhost:8000 |
| 48 | - hostname: "*" |
| 49 | service: https://localhost:8001 |
| 50 | warp-routing: |
| 51 | enabled: true |
| 52 | connectTimeout: 2s |
| 53 | tcpKeepAlive: 10s |
| 54 | |
| 55 | retries: 5 |
| 56 | grace-period: 30s |
| 57 | percentage: 3.14 |
| 58 | hostname: example.com |
| 59 | tag: |
| 60 | - test |
| 61 | - central-1 |
| 62 | counters: |
| 63 | - 123 |
| 64 | - 456 |
| 65 | ` |
| 66 | var config configFileSettings |
| 67 | err := yaml.Unmarshal([]byte(rawYAML), &config) |
| 68 | assert.NoError(t, err) |
| 69 | |
| 70 | assert.Equal(t, "config-file-test", config.TunnelID) |