From 1bbf71f3301f9d877671ea5c193d7c767fd38b07 Mon Sep 17 00:00:00 2001 From: Daniel Franz Date: Wed, 13 Aug 2025 17:00:16 +0900 Subject: [PATCH] Internalize test pkgs Moves the test utils package to internal/ Signed-off-by: Daniel Franz --- Makefile | 2 +- {test/utils => internal/shared/util/testutils}/artifacts.go | 2 +- {test/utils => internal/shared/util/testutils}/summary.go | 2 +- .../shared/util/testutils}/templates/alert.md.tmpl | 0 .../shared/util/testutils}/templates/mermaid_chart.md.tmpl | 0 .../shared/util/testutils}/templates/summary.md.tmpl | 0 {test/utils => internal/shared/util/testutils}/utils.go | 2 +- test/e2e/cluster_extension_install_test.go | 2 +- test/e2e/e2e_suite_test.go | 2 +- test/e2e/metrics_test.go | 2 +- test/e2e/network_policy_test.go | 2 +- test/experimental-e2e/experimental_e2e_test.go | 2 +- test/upgrade-e2e/post_upgrade_test.go | 2 +- 13 files changed, 10 insertions(+), 10 deletions(-) rename {test/utils => internal/shared/util/testutils}/artifacts.go (99%) rename {test/utils => internal/shared/util/testutils}/summary.go (99%) rename {test/utils => internal/shared/util/testutils}/templates/alert.md.tmpl (100%) rename {test/utils => internal/shared/util/testutils}/templates/mermaid_chart.md.tmpl (100%) rename {test/utils => internal/shared/util/testutils}/templates/summary.md.tmpl (100%) rename {test/utils => internal/shared/util/testutils}/utils.go (97%) diff --git a/Makefile b/Makefile index aad82d23b..53dd669b5 100644 --- a/Makefile +++ b/Makefile @@ -229,7 +229,7 @@ extension-developer-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) #EXHELP Run extension crea test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) ${LOCAL_REGISTRY_HOST} ${CLUSTER_REGISTRY_HOST} go test -count=1 -v ./test/extension-developer-e2e/... -UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/) +UNIT_TEST_DIRS := $(shell go list ./... | grep -vE "/test/|/testutils") COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit .PHONY: envtest-k8s-bins #HELP Uses setup-envtest to download and install the binaries required to run ENVTEST-test based locally at the project/bin directory. diff --git a/test/utils/artifacts.go b/internal/shared/util/testutils/artifacts.go similarity index 99% rename from test/utils/artifacts.go rename to internal/shared/util/testutils/artifacts.go index acb523ade..485128c83 100644 --- a/test/utils/artifacts.go +++ b/internal/shared/util/testutils/artifacts.go @@ -1,4 +1,4 @@ -package utils +package testutils import ( "context" diff --git a/test/utils/summary.go b/internal/shared/util/testutils/summary.go similarity index 99% rename from test/utils/summary.go rename to internal/shared/util/testutils/summary.go index f3830d30e..79328f9ef 100644 --- a/test/utils/summary.go +++ b/internal/shared/util/testutils/summary.go @@ -1,4 +1,4 @@ -package utils +package testutils import ( "context" diff --git a/test/utils/templates/alert.md.tmpl b/internal/shared/util/testutils/templates/alert.md.tmpl similarity index 100% rename from test/utils/templates/alert.md.tmpl rename to internal/shared/util/testutils/templates/alert.md.tmpl diff --git a/test/utils/templates/mermaid_chart.md.tmpl b/internal/shared/util/testutils/templates/mermaid_chart.md.tmpl similarity index 100% rename from test/utils/templates/mermaid_chart.md.tmpl rename to internal/shared/util/testutils/templates/mermaid_chart.md.tmpl diff --git a/test/utils/templates/summary.md.tmpl b/internal/shared/util/testutils/templates/summary.md.tmpl similarity index 100% rename from test/utils/templates/summary.md.tmpl rename to internal/shared/util/testutils/templates/summary.md.tmpl diff --git a/test/utils/utils.go b/internal/shared/util/testutils/utils.go similarity index 97% rename from test/utils/utils.go rename to internal/shared/util/testutils/utils.go index db6d25a7f..94eb2d5b3 100644 --- a/test/utils/utils.go +++ b/internal/shared/util/testutils/utils.go @@ -1,4 +1,4 @@ -package utils +package testutils import ( "os/exec" diff --git a/test/e2e/cluster_extension_install_test.go b/test/e2e/cluster_extension_install_test.go index 3c9dcbc2a..7c070cb44 100644 --- a/test/e2e/cluster_extension_install_test.go +++ b/test/e2e/cluster_extension_install_test.go @@ -25,7 +25,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ocv1 "github.com/operator-framework/operator-controller/api/v1" - "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) const ( diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 5fa87d6c1..0bf84bec8 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -16,7 +16,7 @@ import ( ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/operator-controller/scheme" - utils "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) var ( diff --git a/test/e2e/metrics_test.go b/test/e2e/metrics_test.go index 85908f4d5..a95f16c2c 100644 --- a/test/e2e/metrics_test.go +++ b/test/e2e/metrics_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/require" "k8s.io/apimachinery/pkg/util/rand" - "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) // TestOperatorControllerMetricsExportedEndpoint verifies that the metrics endpoint for the operator controller diff --git a/test/e2e/network_policy_test.go b/test/e2e/network_policy_test.go index 0f3979d23..00143df41 100644 --- a/test/e2e/network_policy_test.go +++ b/test/e2e/network_policy_test.go @@ -15,7 +15,7 @@ import ( "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) const ( diff --git a/test/experimental-e2e/experimental_e2e_test.go b/test/experimental-e2e/experimental_e2e_test.go index 8ead64e45..39c16e97f 100644 --- a/test/experimental-e2e/experimental_e2e_test.go +++ b/test/experimental-e2e/experimental_e2e_test.go @@ -27,7 +27,7 @@ import ( ocv1 "github.com/operator-framework/operator-controller/api/v1" "github.com/operator-framework/operator-controller/internal/operator-controller/scheme" - "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) const ( diff --git a/test/upgrade-e2e/post_upgrade_test.go b/test/upgrade-e2e/post_upgrade_test.go index 221182bb6..b196db356 100644 --- a/test/upgrade-e2e/post_upgrade_test.go +++ b/test/upgrade-e2e/post_upgrade_test.go @@ -19,7 +19,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ocv1 "github.com/operator-framework/operator-controller/api/v1" - "github.com/operator-framework/operator-controller/test/utils" + utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils" ) const (