MCPcopy
hub / github.com/cloudflare/cloudflared / TestConfigFileSettings

Function TestConfigFileSettings

config/configuration_test.go:13–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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 := `
31tunnel: config-file-test
32originRequest:
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
44ingress:
45 - hostname: tunnel1.example.com
46 path: /id
47 service: https://localhost:8000
48 - hostname: "*"
49 service: https://localhost:8001
50warp-routing:
51 enabled: true
52 connectTimeout: 2s
53 tcpKeepAlive: 10s
54
55retries: 5
56grace-period: 30s
57percentage: 3.14
58hostname: example.com
59tag:
60 - test
61 - central-1
62counters:
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)

Callers

nothing calls this directly

Calls 8

IntMethod · 0.95
DurationMethod · 0.95
Float64Method · 0.95
StringMethod · 0.95
StringSliceMethod · 0.95
IntSliceMethod · 0.95
EqualMethod · 0.65
UnmarshalMethod · 0.45

Tested by

no test coverage detected