Add selfsigned issuer e2e test
This commit is contained in:
parent
6cfdc62f6b
commit
ae37efa7b7
@ -54,7 +54,7 @@ var _ = framework.CertManagerDescribe("CA Certificate", func() {
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
By("Creating a Certificate")
|
||||
cert, err := f.CertManagerClientSet.CertmanagerV1alpha1().Certificates(f.Namespace.Name).Create(util.NewCertManagerCACertificate(certificateName, certificateSecretName, issuerName, v1alpha1.IssuerKind))
|
||||
cert, err := f.CertManagerClientSet.CertmanagerV1alpha1().Certificates(f.Namespace.Name).Create(util.NewCertManagerBasicCertificate(certificateName, certificateSecretName, issuerName, v1alpha1.IssuerKind))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
f.WaitCertificateIssuedValid(cert)
|
||||
})
|
||||
|
||||
49
test/e2e/certificate/certificate_selfsigned.go
Normal file
49
test/e2e/certificate/certificate_selfsigned.go
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2017 Jetstack Ltd.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package certificate
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1"
|
||||
"github.com/jetstack/cert-manager/test/e2e/framework"
|
||||
"github.com/jetstack/cert-manager/test/util"
|
||||
)
|
||||
|
||||
var _ = framework.CertManagerDescribe("Self Signed Certificate", func() {
|
||||
f := framework.NewDefaultFramework("create-selfsigned-certificate")
|
||||
|
||||
issuerName := "test-selfsigned-issuer"
|
||||
certificateName := "test-selfsigned-certificate"
|
||||
certificateSecretName := "test-selfsigned-certificate"
|
||||
|
||||
It("should generate a signed keypair", func() {
|
||||
By("Creating an Issuer")
|
||||
_, err := f.CertManagerClientSet.CertmanagerV1alpha1().Issuers(f.Namespace.Name).Create(util.NewCertManagerSelfSignedIssuer(issuerName))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
By("Waiting for Issuer to become Ready")
|
||||
err = util.WaitForIssuerCondition(f.CertManagerClientSet.CertmanagerV1alpha1().Issuers(f.Namespace.Name),
|
||||
issuerName,
|
||||
v1alpha1.IssuerCondition{
|
||||
Type: v1alpha1.IssuerConditionReady,
|
||||
Status: v1alpha1.ConditionTrue,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
By("Creating a Certificate")
|
||||
cert, err := f.CertManagerClientSet.CertmanagerV1alpha1().Certificates(f.Namespace.Name).Create(util.NewCertManagerBasicCertificate(certificateName, certificateSecretName, issuerName, v1alpha1.IssuerKind))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
f.WaitCertificateIssuedValid(cert)
|
||||
})
|
||||
})
|
||||
@ -242,7 +242,7 @@ func NewCertManagerCAClusterIssuer(name, secretName string) *v1alpha1.ClusterIss
|
||||
}
|
||||
}
|
||||
|
||||
func NewCertManagerCACertificate(name, secretName, issuerName string, issuerKind string) *v1alpha1.Certificate {
|
||||
func NewCertManagerBasicCertificate(name, secretName, issuerName string, issuerKind string) *v1alpha1.Certificate {
|
||||
return &v1alpha1.Certificate{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
@ -376,6 +376,19 @@ func NewCertManagerCAIssuer(name, secretName string) *v1alpha1.Issuer {
|
||||
}
|
||||
}
|
||||
|
||||
func NewCertManagerSelfSignedIssuer(name string) *v1alpha1.Issuer {
|
||||
return &v1alpha1.Issuer{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
},
|
||||
Spec: v1alpha1.IssuerSpec{
|
||||
IssuerConfig: v1alpha1.IssuerConfig{
|
||||
SelfSigned: &v1alpha1.SelfSignedIssuer{},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func NewCertManagerVaultIssuerToken(name, vaultURL, vaultPath, vaultSecretToken string) *v1alpha1.Issuer {
|
||||
return &v1alpha1.Issuer{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user