Skip to content

Commit c2c8289

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

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

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

+43-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: types.NamespacedName{Namespace: "test", Name: "route1"},
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,32 @@ 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: dataplane.BackendGroup{
75+
Source: types.NamespacedName{Namespace: "test", Name: "route1"},
76+
RuleIdx: 0,
77+
Backends: []dataplane.Backend{
78+
{
79+
UpstreamName: "test_foo_443",
80+
Valid: true,
81+
Weight: 1,
82+
VerifyTLS: &dataplane.VerifyTLS{
83+
CertBundleID: "test-foo",
84+
Hostname: "test-foo.example.com",
85+
},
86+
},
87+
},
88+
},
89+
},
90+
},
91+
},
92+
},
5193
},
5294
},
5395
}
@@ -61,7 +103,7 @@ func TestExecuteServers(t *testing.T) {
61103
"server_name cafe.example.com;": 2,
62104
"ssl_certificate /etc/nginx/secrets/test-keypair.pem;": 2,
63105
"ssl_certificate_key /etc/nginx/secrets/test-keypair.pem;": 2,
64-
"proxy_ssl_server_name on;": 2,
106+
"proxy_ssl_server_name on;": 1,
65107
}
66108
g := NewWithT(t)
67109
serverResults := executeServers(conf)

0 commit comments

Comments
 (0)