diff --git a/builtin/logical/pki/ca_test.go b/builtin/logical/pki/ca_test.go index 6ec791f6fd58..cda3b11da195 100644 --- a/builtin/logical/pki/ca_test.go +++ b/builtin/logical/pki/ca_test.go @@ -257,13 +257,13 @@ func runSteps(t *testing.T, rootB, intB *backend, client *api.Client, rootName, // Load CA cert/key in and ensure we can fetch it back in various formats, // unauthenticated { - // Attempt import but only provide one the cert + // Attempt import but only provide one the cert; this should work. { _, err := client.Logical().WriteWithContext(context.Background(), rootName+"config/ca", map[string]interface{}{ "pem_bundle": caCert, }) - if err == nil { - t.Fatal("expected error") + if err != nil { + t.Fatalf("unexpected error: %v", err) } } @@ -272,18 +272,18 @@ func runSteps(t *testing.T, rootB, intB *backend, client *api.Client, rootName, _, err := client.Logical().WriteWithContext(context.Background(), rootName+"config/ca", map[string]interface{}{ "pem_bundle": caKey, }) - if err == nil { - t.Fatal("expected error") + if err != nil { + t.Fatalf("unexpected error: %v", err) } } - // Import CA bundle + // Import entire CA bundle; this should work as well { _, err := client.Logical().WriteWithContext(context.Background(), rootName+"config/ca", map[string]interface{}{ "pem_bundle": strings.Join([]string{caKey, caCert}, "\n"), }) if err != nil { - t.Fatal(err) + t.Fatalf("unexpected error: %v", err) } } @@ -464,8 +464,8 @@ func runSteps(t *testing.T, rootB, intB *backend, client *api.Client, rootName, if err != nil { t.Fatal(err) } - if resp != nil { - t.Fatal("expected nil response") + if resp == nil { + t.Fatal("nil response") } } diff --git a/builtin/logical/pki/cert_util_test.go b/builtin/logical/pki/cert_util_test.go index 2d8dd04dd241..b3507613302e 100644 --- a/builtin/logical/pki/cert_util_test.go +++ b/builtin/logical/pki/cert_util_test.go @@ -92,13 +92,6 @@ func TestPki_FetchCertBySerial(t *testing.T) { Prefix string Serial string }{ - "ca": { - &logical.Request{ - Storage: storage, - }, - "", - "ca", - }, "crl": { &logical.Request{ Storage: storage,