forked from gardener/gardener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpn_tlsauth_test.go
59 lines (49 loc) · 1.32 KB
/
vpn_tlsauth_test.go
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package secrets_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/gardener/gardener/pkg/utils/secrets"
)
var _ = Describe("VPN TLS Auth Secrets", func() {
Describe("VPN TLS Auth Secret Configuration", func() {
var vpnTLSAuthConfig *VPNTLSAuthConfig
BeforeEach(func() {
vpnTLSAuthConfig = &VPNTLSAuthConfig{
Name: "vpn-secret",
VPNTLSAuthKeyGenerator: func() ([]byte, error) {
return []byte("foo"), nil
},
}
})
Describe("#Generate", func() {
It("should properly generate VPNTLSAuth object", func() {
obj, err := vpnTLSAuthConfig.Generate()
Expect(err).NotTo(HaveOccurred())
vpnTLSAuth, ok := obj.(*VPNTLSAuth)
Expect(ok).To(BeTrue())
Expect(vpnTLSAuth.TLSAuthKey).ToNot(BeEmpty())
})
})
})
Describe("VPNTLSAuth Object", func() {
var (
vpnTLSAuth *VPNTLSAuth
)
BeforeEach(func() {
vpnTLSAuth = &VPNTLSAuth{
TLSAuthKey: []byte("foo"),
}
})
Describe("#SecretData", func() {
It("should properly return secret data", func() {
secretData := map[string][]byte{
DataKeyVPNTLSAuth: []byte("foo"),
}
Expect(vpnTLSAuth.SecretData()).To(Equal(secretData))
})
})
})
})