Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salonichf5 committed May 7, 2024
1 parent 4c5f48a commit b289b26
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion internal/mode/static/nginx/config/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ import (
)

func TestExecuteServers(t *testing.T) {
hrNsName := types.NamespacedName{Namespace: "test", Name: "route1"}
fooGroup := dataplane.BackendGroup{
Source: hrNsName,
RuleIdx: 0,
Backends: []dataplane.Backend{
{
UpstreamName: "test_foo_443",
Valid: true,
Weight: 1,
VerifyTLS: &dataplane.VerifyTLS{
CertBundleID: "test-foo",
Hostname: "test-foo.example.com",
},
},
},
}
conf := dataplane.Configuration{
HTTPServers: []dataplane.VirtualServer{
{
Expand Down Expand Up @@ -48,6 +64,18 @@ func TestExecuteServers(t *testing.T) {
KeyPairID: "test-keypair",
},
Port: 8443,
PathRules: []dataplane.PathRule{
{
Path: "/",
PathType: dataplane.PathTypePrefix,
MatchRules: []dataplane.MatchRule{
{
Match: dataplane.Match{},
BackendGroup: fooGroup,
},
},
},
},
},
},
}
Expand All @@ -61,7 +89,7 @@ func TestExecuteServers(t *testing.T) {
"server_name cafe.example.com;": 2,
"ssl_certificate /etc/nginx/secrets/test-keypair.pem;": 2,
"ssl_certificate_key /etc/nginx/secrets/test-keypair.pem;": 2,
"proxy_ssl_server_name on;": 2,
"proxy_ssl_server_name on;": 1,
}
g := NewWithT(t)
serverResults := executeServers(conf)
Expand Down

0 comments on commit b289b26

Please sign in to comment.