Remove & update unit test fixture generation packages

Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
James Munnelly 2019-09-19 12:58:24 +01:00
parent 87fbfebe5f
commit b35551fcb1
8 changed files with 0 additions and 253 deletions

View File

@ -63,7 +63,6 @@ filegroup(
"//test/e2e:all-srcs",
"//test/unit/gen:all-srcs",
"//test/unit/listers:all-srcs",
"//test/util:all-srcs",
"//third_party:all-srcs",
"//vendor:all-srcs",
],

View File

@ -105,12 +105,6 @@ func SetCertificateRenewBefore(renewBefore time.Duration) CertificateModifier {
}
}
func SetCertificateACMEConfig(cfg v1alpha1.ACMECertificateConfig) CertificateModifier {
return func(crt *v1alpha1.Certificate) {
crt.Spec.ACME = &cfg
}
}
func SetCertificateStatusCondition(c v1alpha1.CertificateCondition) CertificateModifier {
return func(crt *v1alpha1.Certificate) {
if len(crt.Status.Conditions) == 0 {

View File

@ -88,9 +88,3 @@ func SetOrderNamespace(namespace string) OrderModifier {
crt.ObjectMeta.Namespace = namespace
}
}
func SetOrderDomainSolverConfig(cfg []v1alpha1.DomainSolverConfig) OrderModifier {
return func(crt *v1alpha1.Order) {
crt.Spec.Config = cfg
}
}

View File

@ -1,16 +0,0 @@
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//test/util/generate:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -1,30 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"certificate.go",
"clusterissuer.go",
"issuer.go",
],
importpath = "github.com/jetstack/cert-manager/test/util/generate",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/certmanager/v1alpha1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -1,72 +0,0 @@
/*
Copyright 2019 The Jetstack cert-manager contributors.
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 generate
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1"
)
type CertificateConfig struct {
// metadata
Name, Namespace string
// common parameters
IssuerName, IssuerKind string
SecretName string
CommonName string
DNSNames []string
Duration *metav1.Duration
RenewBefore *metav1.Duration
// ACME parameters
SolverConfig *v1alpha1.SolverConfig
}
func Certificate(cfg CertificateConfig) *v1alpha1.Certificate {
var a *v1alpha1.ACMECertificateConfig
if cfg.SolverConfig != nil {
a = &v1alpha1.ACMECertificateConfig{
Config: []v1alpha1.DomainSolverConfig{
{
Domains: cfg.DNSNames,
SolverConfig: *cfg.SolverConfig,
},
},
}
}
return &v1alpha1.Certificate{
ObjectMeta: metav1.ObjectMeta{
Name: cfg.Name,
Namespace: cfg.Namespace,
},
Spec: v1alpha1.CertificateSpec{
Duration: cfg.Duration,
RenewBefore: cfg.RenewBefore,
SecretName: cfg.SecretName,
IssuerRef: v1alpha1.ObjectReference{
Name: cfg.IssuerName,
Kind: cfg.IssuerKind,
},
CommonName: cfg.CommonName,
DNSNames: cfg.DNSNames,
ACME: a,
},
Status: v1alpha1.CertificateStatus{},
}
}

View File

@ -1,60 +0,0 @@
/*
Copyright 2019 The Jetstack cert-manager contributors.
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 generate
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1"
)
type ClusterIssuerConfig struct {
Name, Namespace string
ACMESkipTLSVerify bool
ACMEServer, ACMEEmail, ACMEPrivateKeyName string
HTTP01 *v1alpha1.ACMEIssuerHTTP01Config
DNS01 *v1alpha1.ACMEIssuerDNS01Config
}
func ClusterIssuer(cfg ClusterIssuerConfig) *v1alpha1.ClusterIssuer {
return &v1alpha1.ClusterIssuer{
TypeMeta: metav1.TypeMeta{
Kind: "ClusterIssuer",
},
ObjectMeta: metav1.ObjectMeta{
Name: cfg.Name,
Namespace: cfg.Namespace,
},
Spec: v1alpha1.IssuerSpec{
IssuerConfig: v1alpha1.IssuerConfig{
ACME: &v1alpha1.ACMEIssuer{
SkipTLSVerify: cfg.ACMESkipTLSVerify,
Server: cfg.ACMEServer,
Email: cfg.ACMEEmail,
PrivateKey: v1alpha1.SecretKeySelector{
LocalObjectReference: v1alpha1.LocalObjectReference{
Name: cfg.ACMEPrivateKeyName,
},
},
HTTP01: cfg.HTTP01,
DNS01: cfg.DNS01,
},
},
},
}
}

View File

@ -1,62 +0,0 @@
/*
Copyright 2019 The Jetstack cert-manager contributors.
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 generate
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1"
)
type IssuerConfig struct {
Name, Namespace string
ACMESkipTLSVerify bool
ACMEServer, ACMEEmail, ACMEPrivateKeyName string
HTTP01 *v1alpha1.ACMEIssuerHTTP01Config
DNS01 *v1alpha1.ACMEIssuerDNS01Config
Solvers []v1alpha1.ACMEChallengeSolver
}
func Issuer(cfg IssuerConfig) *v1alpha1.Issuer {
return &v1alpha1.Issuer{
TypeMeta: metav1.TypeMeta{
Kind: "Issuer",
},
ObjectMeta: metav1.ObjectMeta{
Name: cfg.Name,
Namespace: cfg.Namespace,
},
Spec: v1alpha1.IssuerSpec{
IssuerConfig: v1alpha1.IssuerConfig{
ACME: &v1alpha1.ACMEIssuer{
SkipTLSVerify: cfg.ACMESkipTLSVerify,
Server: cfg.ACMEServer,
Email: cfg.ACMEEmail,
PrivateKey: v1alpha1.SecretKeySelector{
LocalObjectReference: v1alpha1.LocalObjectReference{
Name: cfg.ACMEPrivateKeyName,
},
},
Solvers: cfg.Solvers,
HTTP01: cfg.HTTP01,
DNS01: cfg.DNS01,
},
},
},
}
}