From 5524f2729ff7e39f187261514f5edbd0a54c1674 Mon Sep 17 00:00:00 2001 From: Victor Rodriguez Date: Mon, 23 Dec 2024 19:54:11 +0100 Subject: [PATCH] Adjust unit tests. --- builtin/credential/cert/backend_test.go | 10 +++++++++- command/agent/cert_end_to_end_test.go | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/builtin/credential/cert/backend_test.go b/builtin/credential/cert/backend_test.go index fb9eb8ca5a311..eec277136da49 100644 --- a/builtin/credential/cert/backend_test.go +++ b/builtin/credential/cert/backend_test.go @@ -25,6 +25,7 @@ import ( "os" "path/filepath" "reflect" + "strings" "testing" "time" @@ -319,7 +320,14 @@ func TestBackend_PermittedDNSDomainsIntermediateCA(t *testing.T) { if err != nil { t.Fatal(err) } - intermediateCertPEM := secret.Data["certificate"].(string) + var intermediateCertPEM string + { + var certs []string + for _, cert := range secret.Data["ca_chain"].([]interface{}) { + certs = append(certs, cert.(string)) + } + intermediateCertPEM = strings.Join(certs, "\n") + } // Configure the intermediate cert as the CA in /pki2 _, err = client.Logical().Write("pki2/intermediate/set-signed", map[string]interface{}{ diff --git a/command/agent/cert_end_to_end_test.go b/command/agent/cert_end_to_end_test.go index 41275f860ce0a..e5e08d85b0ccf 100644 --- a/command/agent/cert_end_to_end_test.go +++ b/command/agent/cert_end_to_end_test.go @@ -9,6 +9,7 @@ import ( "fmt" "io/ioutil" "os" + "strings" "testing" "time" @@ -373,7 +374,14 @@ func TestCertEndToEnd_CertsInConfig(t *testing.T) { if err != nil { t.Fatal(err) } - intermediateCertPEM := secret.Data["certificate"].(string) + var intermediateCertPEM string + { + var certs []string + for _, cert := range secret.Data["ca_chain"].([]interface{}) { + certs = append(certs, cert.(string)) + } + intermediateCertPEM = strings.Join(certs, "\n") + } // Configure the intermediate cert as the CA in /pki2 _, err = client.Logical().Write("pki2/intermediate/set-signed", map[string]interface{}{