From 206b6def1ed4f7d8e11bfb3d306e14f73d1d55f6 Mon Sep 17 00:00:00 2001 From: irbekrm Date: Thu, 4 May 2023 12:04:40 +0100 Subject: [PATCH 1/2] Make external DNS webhook tests importable again Signed-off-by: irbekrm --- test/{integration/acmedns => acme}/fixture.go | 2 +- test/{integration/acmedns => acme}/options.go | 0 test/{integration/acmedns => acme}/server/doc.go | 0 test/{integration/acmedns => acme}/server/rfc2136.go | 0 test/{integration/acmedns => acme}/server/server.go | 0 test/{integration/acmedns => acme}/suite.go | 0 test/{integration/acmedns => acme}/util.go | 0 test/{integration/internal => }/apiserver/apiserver.go | 2 ++ test/{integration/internal => }/apiserver/envs.go | 0 test/integration/ctl/install_framework/framework.go | 2 +- test/integration/framework/apiserver.go | 2 +- test/integration/rfc2136_dns01/provider_test.go | 4 ++-- test/integration/rfc2136_dns01/rfc2136_test.go | 2 +- 13 files changed, 8 insertions(+), 6 deletions(-) rename test/{integration/acmedns => acme}/fixture.go (97%) rename test/{integration/acmedns => acme}/options.go (100%) rename test/{integration/acmedns => acme}/server/doc.go (100%) rename test/{integration/acmedns => acme}/server/rfc2136.go (100%) rename test/{integration/acmedns => acme}/server/server.go (100%) rename test/{integration/acmedns => acme}/suite.go (100%) rename test/{integration/acmedns => acme}/util.go (100%) rename test/{integration/internal => }/apiserver/apiserver.go (94%) rename test/{integration/internal => }/apiserver/envs.go (100%) diff --git a/test/integration/acmedns/fixture.go b/test/acme/fixture.go similarity index 97% rename from test/integration/acmedns/fixture.go rename to test/acme/fixture.go index 517e972c3..28711ae80 100644 --- a/test/integration/acmedns/fixture.go +++ b/test/acme/fixture.go @@ -27,8 +27,8 @@ import ( "k8s.io/client-go/kubernetes" "sigs.k8s.io/controller-runtime/pkg/envtest" - "github.com/cert-manager/cert-manager/integration-tests/internal/apiserver" "github.com/cert-manager/cert-manager/pkg/acme/webhook" + "github.com/cert-manager/cert-manager/test/apiserver" ) func init() { diff --git a/test/integration/acmedns/options.go b/test/acme/options.go similarity index 100% rename from test/integration/acmedns/options.go rename to test/acme/options.go diff --git a/test/integration/acmedns/server/doc.go b/test/acme/server/doc.go similarity index 100% rename from test/integration/acmedns/server/doc.go rename to test/acme/server/doc.go diff --git a/test/integration/acmedns/server/rfc2136.go b/test/acme/server/rfc2136.go similarity index 100% rename from test/integration/acmedns/server/rfc2136.go rename to test/acme/server/rfc2136.go diff --git a/test/integration/acmedns/server/server.go b/test/acme/server/server.go similarity index 100% rename from test/integration/acmedns/server/server.go rename to test/acme/server/server.go diff --git a/test/integration/acmedns/suite.go b/test/acme/suite.go similarity index 100% rename from test/integration/acmedns/suite.go rename to test/acme/suite.go diff --git a/test/integration/acmedns/util.go b/test/acme/util.go similarity index 100% rename from test/integration/acmedns/util.go rename to test/acme/util.go diff --git a/test/integration/internal/apiserver/apiserver.go b/test/apiserver/apiserver.go similarity index 94% rename from test/integration/internal/apiserver/apiserver.go rename to test/apiserver/apiserver.go index 6d6233007..9520f0ac1 100644 --- a/test/integration/internal/apiserver/apiserver.go +++ b/test/apiserver/apiserver.go @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// package apiserver contains functionality to set up a Kubernetes control plane +// for tests. package apiserver import ( diff --git a/test/integration/internal/apiserver/envs.go b/test/apiserver/envs.go similarity index 100% rename from test/integration/internal/apiserver/envs.go rename to test/apiserver/envs.go diff --git a/test/integration/ctl/install_framework/framework.go b/test/integration/ctl/install_framework/framework.go index fe4ac15c1..8224e2ef0 100644 --- a/test/integration/ctl/install_framework/framework.go +++ b/test/integration/ctl/install_framework/framework.go @@ -24,7 +24,7 @@ import ( "k8s.io/client-go/rest" "sigs.k8s.io/controller-runtime/pkg/envtest" - "github.com/cert-manager/cert-manager/integration-tests/internal/apiserver" + "github.com/cert-manager/cert-manager/test/apiserver" ) type TestInstallApiServer struct { diff --git a/test/integration/framework/apiserver.go b/test/integration/framework/apiserver.go index c04cc59a3..494eb1508 100644 --- a/test/integration/framework/apiserver.go +++ b/test/integration/framework/apiserver.go @@ -38,11 +38,11 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" - "github.com/cert-manager/cert-manager/integration-tests/internal/apiserver" "github.com/cert-manager/cert-manager/internal/test/paths" "github.com/cert-manager/cert-manager/internal/webhook" "github.com/cert-manager/cert-manager/pkg/api" "github.com/cert-manager/cert-manager/pkg/webhook/handlers" + "github.com/cert-manager/cert-manager/test/apiserver" webhooktesting "github.com/cert-manager/cert-manager/webhook-binary/app/testing" ) diff --git a/test/integration/rfc2136_dns01/provider_test.go b/test/integration/rfc2136_dns01/provider_test.go index 8073febce..896f32339 100644 --- a/test/integration/rfc2136_dns01/provider_test.go +++ b/test/integration/rfc2136_dns01/provider_test.go @@ -22,12 +22,12 @@ import ( logtesting "github.com/go-logr/logr/testing" - dns "github.com/cert-manager/cert-manager/integration-tests/acmedns" - testserver "github.com/cert-manager/cert-manager/integration-tests/acmedns/server" cmacme "github.com/cert-manager/cert-manager/pkg/apis/acme/v1" cmmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1" "github.com/cert-manager/cert-manager/pkg/issuer/acme/dns/rfc2136" logf "github.com/cert-manager/cert-manager/pkg/logs" + dns "github.com/cert-manager/cert-manager/test/acme" + testserver "github.com/cert-manager/cert-manager/test/acme/server" ) func TestRunSuiteWithTSIG(t *testing.T) { diff --git a/test/integration/rfc2136_dns01/rfc2136_test.go b/test/integration/rfc2136_dns01/rfc2136_test.go index 93cab5736..019a1e682 100644 --- a/test/integration/rfc2136_dns01/rfc2136_test.go +++ b/test/integration/rfc2136_dns01/rfc2136_test.go @@ -33,9 +33,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - testserver "github.com/cert-manager/cert-manager/integration-tests/acmedns/server" "github.com/cert-manager/cert-manager/pkg/issuer/acme/dns/rfc2136" logf "github.com/cert-manager/cert-manager/pkg/logs" + testserver "github.com/cert-manager/cert-manager/test/acme/server" ) var ( From a45a8b3a39d32f703d83354c89cec7e8a0f07a67 Mon Sep 17 00:00:00 2001 From: irbekrm Date: Thu, 4 May 2023 12:53:50 +0100 Subject: [PATCH 2/2] Adds a package comment, fixes imports Signed-off-by: irbekrm --- test/acme/server/rfc2136.go | 4 ++-- test/acme/util.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/acme/server/rfc2136.go b/test/acme/server/rfc2136.go index 2a5bf4f0b..0f1b6ac93 100644 --- a/test/acme/server/rfc2136.go +++ b/test/acme/server/rfc2136.go @@ -21,10 +21,10 @@ import ( "sync" "time" - logf "github.com/cert-manager/cert-manager/pkg/logs" - "github.com/go-logr/logr" "github.com/miekg/dns" + + logf "github.com/cert-manager/cert-manager/pkg/logs" ) type rfc2136Handler struct { diff --git a/test/acme/util.go b/test/acme/util.go index 9caaf0a95..9b77ffce9 100644 --- a/test/acme/util.go +++ b/test/acme/util.go @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// package dns contains a framework for testing ACME DNS solver implementations. +// Used by both internal and external solvers. package dns import (