-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtls_test.go
More file actions
45 lines (40 loc) · 1.11 KB
/
tls_test.go
File metadata and controls
45 lines (40 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package loggregator_test
import (
"code.cloudfoundry.org/go-loggregator/v10"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("TLS", func() {
Describe("NewIngressTLSConfig", func() {
It("returns a valid TLS config with server name 'metron'", func() {
tlsConf, err := loggregator.NewIngressTLSConfig(
certs.CA(),
certs.Cert("test"),
certs.Key("test"),
)
Expect(err).NotTo(HaveOccurred())
Expect(tlsConf).NotTo(BeNil())
Expect(tlsConf.ServerName).To(Equal("metron"))
})
It("returns an error with an invalid cert path", func() {
_, err := loggregator.NewIngressTLSConfig(
certs.CA(),
"/invalid/cert/path",
certs.Key("test"),
)
Expect(err).To(HaveOccurred())
})
})
Describe("NewEgressTLSConfig", func() {
It("returns a valid TLS config with server name 'reverselogproxy'", func() {
tlsConf, err := loggregator.NewEgressTLSConfig(
certs.CA(),
certs.Cert("test"),
certs.Key("test"),
)
Expect(err).NotTo(HaveOccurred())
Expect(tlsConf).NotTo(BeNil())
Expect(tlsConf.ServerName).To(Equal("reverselogproxy"))
})
})
})