Skip to content

Commit

Permalink
Added test to make sure service uses static certificate manager when …
Browse files Browse the repository at this point in the history
…configured
  • Loading branch information
kpumuk committed Sep 24, 2024
1 parent fb10634 commit 3643d9e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/server/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ func TestService_RedirectToHTTPWhenTLSRequired(t *testing.T) {
require.Equal(t, http.StatusOK, w.Result().StatusCode)
}

func TestService_UseStaticTLSCertificateWhenConfigured(t *testing.T) {
service := testCreateService(
t,
ServiceOptions{
TLSHostname: "example.com",
TLSCertificatePath: "cert.pem",
TLSPrivateKeyPath: "key.pem",
},
defaultTargetOptions,
)

require.True(t, service.options.RequireTLS())
require.NotNil(t, service.certManager.(*StaticCertManager))
}

func TestService_RejectTLSRequestsWhenNotConfigured(t *testing.T) {
service := testCreateService(t, defaultServiceOptions, defaultTargetOptions)

Expand Down

0 comments on commit 3643d9e

Please sign in to comment.