kubernetes: sort and uniq TLS secrets
This commit is contained in:
parent
60b5286f8c
commit
a0b1d54012
2 changed files with 85 additions and 38 deletions
|
@ -2830,7 +2830,7 @@ func TestGetTLS(t *testing.T) {
|
|||
desc string
|
||||
ingress *extensionsv1beta1.Ingress
|
||||
client Client
|
||||
result []*tls.Configuration
|
||||
result map[string]*tls.Configuration
|
||||
errResult string
|
||||
}{
|
||||
{
|
||||
|
@ -2910,11 +2910,21 @@ func TestGetTLS(t *testing.T) {
|
|||
),
|
||||
iTLSes(
|
||||
iTLS("test-secret"),
|
||||
iTLS("test-secret"),
|
||||
iTLS("test-secret2"),
|
||||
),
|
||||
),
|
||||
client: clientMock{
|
||||
secrets: []*corev1.Secret{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-secret2",
|
||||
Namespace: "testing",
|
||||
},
|
||||
Data: map[string][]byte{
|
||||
"tls.crt": []byte("tls-crt"),
|
||||
"tls.key": []byte("tls-key"),
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-secret",
|
||||
|
@ -2927,14 +2937,14 @@ func TestGetTLS(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
result: []*tls.Configuration{
|
||||
{
|
||||
result: map[string]*tls.Configuration{
|
||||
"testing/test-secret": {
|
||||
Certificate: &tls.Certificate{
|
||||
CertFile: tls.FileOrContent("tls-crt"),
|
||||
KeyFile: tls.FileOrContent("tls-key"),
|
||||
},
|
||||
},
|
||||
{
|
||||
"testing/test-secret2": {
|
||||
Certificate: &tls.Certificate{
|
||||
CertFile: tls.FileOrContent("tls-crt"),
|
||||
KeyFile: tls.FileOrContent("tls-key"),
|
||||
|
@ -2964,9 +2974,9 @@ func TestGetTLS(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
result: []*tls.Configuration{
|
||||
{
|
||||
EntryPoints: []string{"https", "api-secure"},
|
||||
result: map[string]*tls.Configuration{
|
||||
"testing/test-secret": {
|
||||
EntryPoints: []string{"api-secure", "https"},
|
||||
Certificate: &tls.Certificate{
|
||||
CertFile: tls.FileOrContent("tls-crt"),
|
||||
KeyFile: tls.FileOrContent("tls-key"),
|
||||
|
@ -2981,7 +2991,8 @@ func TestGetTLS(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tlsConfigs, err := getTLS(test.ingress, test.client)
|
||||
tlsConfigs := map[string]*tls.Configuration{}
|
||||
err := getTLS(test.ingress, test.client, tlsConfigs)
|
||||
|
||||
if test.errResult != "" {
|
||||
assert.EqualError(t, err, test.errResult)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue