Skip to content

Commit b289b26

Browse files
committed
update unit tests
1 parent 4c5f48a commit b289b26

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

internal/mode/static/nginx/config/servers_test.go

+29-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ import (
1515
)
1616

1717
func TestExecuteServers(t *testing.T) {
18+
hrNsName := types.NamespacedName{Namespace: "test", Name: "route1"}
19+
fooGroup := dataplane.BackendGroup{
20+
Source: hrNsName,
21+
RuleIdx: 0,
22+
Backends: []dataplane.Backend{
23+
{
24+
UpstreamName: "test_foo_443",
25+
Valid: true,
26+
Weight: 1,
27+
VerifyTLS: &dataplane.VerifyTLS{
28+
CertBundleID: "test-foo",
29+
Hostname: "test-foo.example.com",
30+
},
31+
},
32+
},
33+
}
1834
conf := dataplane.Configuration{
1935
HTTPServers: []dataplane.VirtualServer{
2036
{
@@ -48,6 +64,18 @@ func TestExecuteServers(t *testing.T) {
4864
KeyPairID: "test-keypair",
4965
},
5066
Port: 8443,
67+
PathRules: []dataplane.PathRule{
68+
{
69+
Path: "/",
70+
PathType: dataplane.PathTypePrefix,
71+
MatchRules: []dataplane.MatchRule{
72+
{
73+
Match: dataplane.Match{},
74+
BackendGroup: fooGroup,
75+
},
76+
},
77+
},
78+
},
5179
},
5280
},
5381
}
@@ -61,7 +89,7 @@ func TestExecuteServers(t *testing.T) {
6189
"server_name cafe.example.com;": 2,
6290
"ssl_certificate /etc/nginx/secrets/test-keypair.pem;": 2,
6391
"ssl_certificate_key /etc/nginx/secrets/test-keypair.pem;": 2,
64-
"proxy_ssl_server_name on;": 2,
92+
"proxy_ssl_server_name on;": 1,
6593
}
6694
g := NewWithT(t)
6795
serverResults := executeServers(conf)

0 commit comments

Comments
 (0)