diff --git a/test/e2e/framework/config/BUILD.bazel b/test/e2e/framework/config/BUILD.bazel index cd0d41f2b..8225446d2 100644 --- a/test/e2e/framework/config/BUILD.bazel +++ b/test/e2e/framework/config/BUILD.bazel @@ -13,7 +13,6 @@ go_library( "ingress_controller.go", "samplewebhook.go", "suite.go", - "tiller.go", "venafi.go", ], importpath = "github.com/jetstack/cert-manager/test/e2e/framework/config", diff --git a/test/e2e/framework/config/addons.go b/test/e2e/framework/config/addons.go index 4ef84f475..df97e0094 100644 --- a/test/e2e/framework/config/addons.go +++ b/test/e2e/framework/config/addons.go @@ -22,9 +22,6 @@ import ( // Addons contains global configuration for instances of addons type Addons struct { - // Tiller describes the global configuration values for the tiller addon - Tiller Tiller - // Helm describes the global configuration values for helm Helm Helm @@ -52,7 +49,6 @@ type Addons struct { } func (a *Addons) AddFlags(fs *flag.FlagSet) { - a.Tiller.AddFlags(fs) a.Helm.AddFlags(fs) a.ACMEServer.AddFlags(fs) a.IngressController.AddFlags(fs) @@ -64,7 +60,6 @@ func (a *Addons) AddFlags(fs *flag.FlagSet) { func (a *Addons) Validate() []error { var errs []error - errs = append(errs, a.Tiller.Validate()...) errs = append(errs, a.Helm.Validate()...) errs = append(errs, a.ACMEServer.Validate()...) errs = append(errs, a.IngressController.Validate()...) diff --git a/test/e2e/framework/config/tiller.go b/test/e2e/framework/config/tiller.go deleted file mode 100644 index 492430175..000000000 --- a/test/e2e/framework/config/tiller.go +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright 2020 The cert-manager Authors. - -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 config - -import ( - "flag" - "fmt" -) - -type Tiller struct { - // Tiller image repo to use when deploying - ImageRepo string - - // Tiller image tag to use when deploying - ImageTag string -} - -func (n *Tiller) AddFlags(fs *flag.FlagSet) { - fs.StringVar(&n.ImageRepo, "tiller-image-repo", "gcr.io/kubernetes-helm/tiller", "docker image repo for tiller-deploy") - fs.StringVar(&n.ImageTag, "tiller-image-tag", "bazel", "docker image tag for tiller-deploy") -} - -func (n *Tiller) Validate() []error { - var errs []error - if n.ImageRepo == "" { - errs = append(errs, fmt.Errorf("--tiller-image-repo must be specified")) - } - if n.ImageTag == "" { - errs = append(errs, fmt.Errorf("--tiller-image-tag must be specified")) - } - return errs -} diff --git a/test/e2e/framework/helper/BUILD.bazel b/test/e2e/framework/helper/BUILD.bazel index b4bf9b3a0..785b7ecdb 100644 --- a/test/e2e/framework/helper/BUILD.bazel +++ b/test/e2e/framework/helper/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "certificaterequests.go", "certificates.go", "certificatesigningrequests.go", + "describe.go", "helper.go", "kubectl.go", "pod_start.go", @@ -20,6 +21,7 @@ go_library( "//pkg/apis/certmanager/v1:go_default_library", "//pkg/apis/meta/v1:go_default_library", "//pkg/client/clientset/versioned:go_default_library", + "//pkg/client/clientset/versioned/scheme:go_default_library", "//pkg/client/clientset/versioned/typed/certmanager/v1:go_default_library", "//pkg/controller/certificatesigningrequests/util:go_default_library", "//pkg/util:go_default_library", @@ -34,8 +36,11 @@ go_library( "@io_k8s_api//core/v1:go_default_library", "@io_k8s_apimachinery//pkg/api/errors:go_default_library", "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library", + "@io_k8s_apimachinery//pkg/runtime:go_default_library", + "@io_k8s_apimachinery//pkg/runtime/serializer/json:go_default_library", "@io_k8s_apimachinery//pkg/util/wait:go_default_library", "@io_k8s_client_go//kubernetes:go_default_library", + "@io_k8s_client_go//kubernetes/scheme:go_default_library", ], ) diff --git a/test/e2e/framework/helper/certificates.go b/test/e2e/framework/helper/certificates.go index e6937bba5..c13dc52f7 100644 --- a/test/e2e/framework/helper/certificates.go +++ b/test/e2e/framework/helper/certificates.go @@ -71,15 +71,9 @@ func (h *Helper) waitForCertificateCondition(client clientset.CertificateInterfa if pollErr != nil && certificate != nil { log.Logf("Failed waiting for certificate %v: %v\n", name, pollErr.Error()) - if len(certificate.Status.Conditions) > 0 { - log.Logf("Observed certificate conditions:\n") - for _, cond := range certificate.Status.Conditions { - log.Logf("- Last Status: '%s' Reason: '%s', Message: '%s'\n", cond.Status, cond.Reason, cond.Message) - } - } + log.Logf("Certificate:\n") + h.describeCMObject(certificate) - log.Logf("Certificate description:\n") - h.Kubectl(certificate.Namespace).DescribeResource("certificate", name) log.Logf("Order and challenge descriptions:\n") h.Kubectl(certificate.Namespace).Describe("order", "challenge") @@ -124,6 +118,11 @@ func (h *Helper) WaitForCertificateReadyAndDoneIssuing(cert *cmapi.Certificate, return false } + if certificate.Status.NextPrivateKeySecretName != nil { + log.Logf("Expected Certificate %v 'next-private-key-secret-name' attribute to be empty but has: %v", certificate.Name, *certificate.Status.NextPrivateKeySecretName) + return false + } + return true }, timeout) } @@ -158,6 +157,11 @@ func (h *Helper) WaitForCertificateNotReadyAndDoneIssuing(cert *cmapi.Certificat return false } + if certificate.Status.NextPrivateKeySecretName != nil { + log.Logf("Expected Certificate %v 'next-private-key-secret-name' attribute to be empty but has: %v", certificate.Name, *certificate.Status.NextPrivateKeySecretName) + return false + } + return true }, timeout) } diff --git a/test/e2e/framework/helper/describe.go b/test/e2e/framework/helper/describe.go new file mode 100644 index 000000000..1a4e3e125 --- /dev/null +++ b/test/e2e/framework/helper/describe.go @@ -0,0 +1,43 @@ +/* +Copyright 2020 The cert-manager Authors. + +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 helper + +import ( + cmscheme "github.com/jetstack/cert-manager/pkg/client/clientset/versioned/scheme" + "k8s.io/apimachinery/pkg/runtime" + runtimejson "k8s.io/apimachinery/pkg/runtime/serializer/json" + kubescheme "k8s.io/client-go/kubernetes/scheme" + "os" +) + +func (h *Helper) describeKubeObject(object runtime.Object) error { + serializer := runtimejson.NewSerializerWithOptions(runtimejson.DefaultMetaFactory, kubescheme.Scheme, kubescheme.Scheme, runtimejson.SerializerOptions{ + Yaml: true, + Pretty: true, + }) + encoder := kubescheme.Codecs.WithoutConversion().EncoderForVersion(serializer, nil) + return encoder.Encode(object, os.Stdout) +} + +func (h *Helper) describeCMObject(object runtime.Object) error { + serializer := runtimejson.NewSerializerWithOptions(runtimejson.DefaultMetaFactory, cmscheme.Scheme, cmscheme.Scheme, runtimejson.SerializerOptions{ + Yaml: true, + Pretty: true, + }) + encoder := cmscheme.Codecs.WithoutConversion().EncoderForVersion(serializer, nil) + return encoder.Encode(object, os.Stdout) +} diff --git a/test/e2e/framework/helper/validate.go b/test/e2e/framework/helper/validate.go index 45b5b8e80..4d22f20ec 100644 --- a/test/e2e/framework/helper/validate.go +++ b/test/e2e/framework/helper/validate.go @@ -26,6 +26,7 @@ import ( "github.com/jetstack/cert-manager/test/e2e/framework/helper/validation" "github.com/jetstack/cert-manager/test/e2e/framework/helper/validation/certificates" "github.com/jetstack/cert-manager/test/e2e/framework/helper/validation/certificatesigningrequests" + "github.com/jetstack/cert-manager/test/e2e/framework/log" ) // ValidateCertificate retrieves the issued certificate and runs all validation functions @@ -42,6 +43,12 @@ func (h *Helper) ValidateCertificate(certificate *cmapi.Certificate, validations for _, fn := range validations { err := fn(certificate, secret) if err != nil { + log.Logf("Certificate:\n") + h.describeCMObject(certificate) + + log.Logf("Secret:\n") + h.describeKubeObject(secret) + return err } } diff --git a/test/e2e/suite/conformance/certificates/suite.go b/test/e2e/suite/conformance/certificates/suite.go index 653309bda..05b74c681 100644 --- a/test/e2e/suite/conformance/certificates/suite.go +++ b/test/e2e/suite/conformance/certificates/suite.go @@ -84,6 +84,8 @@ func (s *Suite) complete(f *framework.Framework) { s.DomainSuffix = f.Config.Addons.IngressController.Domain case "Gateway": s.DomainSuffix = f.Config.Addons.Gateway.Domain + default: + s.DomainSuffix = "example.com" } }