From d960199caa2018d5c1d074e747efcdbe57342a85 Mon Sep 17 00:00:00 2001 From: Maartje Eyskens Date: Wed, 30 Sep 2020 16:04:23 +0200 Subject: [PATCH] Make tests work Signed-off-by: Maartje Eyskens --- test/e2e/framework/helper/validate.go | 5 ---- .../helper/validations/certificates.go | 28 ++++++++++--------- .../certificates/venaficloud/cloud.go | 1 + 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/test/e2e/framework/helper/validate.go b/test/e2e/framework/helper/validate.go index cf17f2938..72367f890 100644 --- a/test/e2e/framework/helper/validate.go +++ b/test/e2e/framework/helper/validate.go @@ -37,14 +37,10 @@ func (h *Helper) DefaultValidationSet() []ValidationFunc { validations.ExpectValidAnnotations, validations.ExpectValidPrivateKeyData, validations.ExpectValidCertificate, - //validations.ExpectCertificateOrganizationToMatch, validations.ExpectCertificateDNSNamesToMatch, validations.ExpectCertificateURIsToMatch, validations.ExpectValidCommonName, validations.ExpectValidNotAfterDate, - validations.ExpectKeyUsageExtKeyUsageServerAuth, - validations.ExpectKeyUsageExtKeyUsageClientAuth, - validations.ExpectKeyUsageKeyUsageKeyAgreement, validations.ExpectEmailsToMatch, } } @@ -60,7 +56,6 @@ func (h *Helper) ValidationSetForUnsupportedFeatureSet(fs featureset.FeatureSet) validations.ExpectCertificateDNSNamesToMatch, validations.ExpectValidCommonName, validations.ExpectValidNotAfterDate, - validations.ExpectKeyUsageKeyUsageKeyAgreement, } if !fs.Contains(featureset.URISANsFeature) { diff --git a/test/e2e/framework/helper/validations/certificates.go b/test/e2e/framework/helper/validations/certificates.go index dc132f599..5428bc559 100644 --- a/test/e2e/framework/helper/validations/certificates.go +++ b/test/e2e/framework/helper/validations/certificates.go @@ -65,20 +65,22 @@ func ExpectValidPrivateKeyData(certificate *cmapi.Certificate, secret *corev1.Se } // validate private key is of the correct type (rsa or ecdsa) - switch certificate.Spec.PrivateKey.Algorithm { - case cmapi.PrivateKeyAlgorithm(""), - cmapi.RSAKeyAlgorithm: - _, ok := key.(*rsa.PrivateKey) - if !ok { - return fmt.Errorf("Expected private key of type RSA, but it was: %T", key) + if certificate.Spec.PrivateKey != nil { + switch certificate.Spec.PrivateKey.Algorithm { + case cmapi.PrivateKeyAlgorithm(""), + cmapi.RSAKeyAlgorithm: + _, ok := key.(*rsa.PrivateKey) + if !ok { + return fmt.Errorf("Expected private key of type RSA, but it was: %T", key) + } + case cmapi.ECDSAKeyAlgorithm: + _, ok := key.(*ecdsa.PrivateKey) + if !ok { + return fmt.Errorf("Expected private key of type ECDSA, but it was: %T", key) + } + default: + return fmt.Errorf("unrecognised requested private key algorithm %q", certificate.Spec.PrivateKey.Algorithm) } - case cmapi.ECDSAKeyAlgorithm: - _, ok := key.(*ecdsa.PrivateKey) - if !ok { - return fmt.Errorf("Expected private key of type ECDSA, but it was: %T", key) - } - default: - return fmt.Errorf("unrecognised requested private key algorithm %q", certificate.Spec.PrivateKey.Algorithm) } // TODO: validate private key KeySize diff --git a/test/e2e/suite/conformance/certificates/venaficloud/cloud.go b/test/e2e/suite/conformance/certificates/venaficloud/cloud.go index f3dcb2d72..954252b1e 100644 --- a/test/e2e/suite/conformance/certificates/venaficloud/cloud.go +++ b/test/e2e/suite/conformance/certificates/venaficloud/cloud.go @@ -46,6 +46,7 @@ var _ = framework.ConformanceDescribe("Certificates", func() { featureset.CommonNameFeature, featureset.IPAddressFeature, featureset.URISANsFeature, + featureset.OnlySAN, ) provisioner := new(venafiProvisioner)