Skip to content

Commit

Permalink
Adjust unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
victorr committed Dec 23, 2024
1 parent 728af4b commit 5524f27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion builtin/credential/cert/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"os"
"path/filepath"
"reflect"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -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{}{
Expand Down
10 changes: 9 additions & 1 deletion command/agent/cert_end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -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{}{
Expand Down

0 comments on commit 5524f27

Please sign in to comment.