Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ linters:
alias: ctrl
- pkg: github.com/blang/semver/v4
alias: bsemver
- pkg: ^github.com/operator-framework/operator-controller/internal/util/([^/]+)$
- pkg: ^github.com/operator-framework/operator-controller/internal/shared/util/([^/]+)$
alias: ${1}util
exclusions:
generated: lax
Expand Down
4 changes: 2 additions & 2 deletions internal/catalogd/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/component-base/featuregate"

fgutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
featuregatesutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
)

const (
Expand All @@ -24,5 +24,5 @@ func init() {

// LogFeatureGateStates logs the state of all known feature gates for catalogd
func LogFeatureGateStates(log logr.Logger, fg featuregate.FeatureGate) {
fgutil.LogFeatureGateStates(log, "catalogd feature gate status", fg, catalogdFeatureGates)
featuregatesutil.LogFeatureGateStates(log, "catalogd feature gate status", fg, catalogdFeatureGates)
}
4 changes: 2 additions & 2 deletions internal/operator-controller/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/component-base/featuregate"

fgutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
featuregatesutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
)

const (
Expand Down Expand Up @@ -90,5 +90,5 @@ func init() {

// LogFeatureGateStates logs the state of all known feature gates.
func LogFeatureGateStates(log logr.Logger, fg featuregate.FeatureGate) {
fgutil.LogFeatureGateStates(log, "feature gate status", fg, operatorControllerFeatureGates)
featuregatesutil.LogFeatureGateStates(log, "feature gate status", fg, operatorControllerFeatureGates)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package testutils
package test

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package testutils
package test

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package testutils
package test

import (
"os/exec"
Expand Down
24 changes: 12 additions & 12 deletions test/e2e/cluster_extension_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"k8s.io/utils/ptr"

ocv1 "github.com/operator-framework/operator-controller/api/v1"
utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
. "github.com/operator-framework/operator-controller/test/helpers"
)

Expand Down Expand Up @@ -59,7 +59,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {

clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestClusterExtensionInstallRegistryDynamic(t *testing.T) {

clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) {
require.NoError(t, err)

defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
defer func(cat *ocv1.ClusterCatalog) {
require.NoError(t, c.Delete(context.Background(), cat))
require.Eventually(t, func() bool {
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) {

clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating an ClusterExtension at a specified version")
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {

clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating an ClusterExtension at a specified version")
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Expand Down Expand Up @@ -362,7 +362,7 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) {
t.Log("When resolving upgrade edges")
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating an ClusterExtension at a specified version")
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Expand Down Expand Up @@ -408,7 +408,7 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) {
t.Log("It resolves again when a catalog is patched with new ImageRef")
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -495,7 +495,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
sa, err := CreateServiceAccount(context.Background(), types.NamespacedName{Name: clusterExtensionName, Namespace: ns.Name}, clusterExtensionName)
require.NoError(t, err)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -553,7 +553,7 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T
t.Log("It resolves again when managed content is changed")
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -607,7 +607,7 @@ func TestClusterExtensionRecoversFromNoNamespaceWhenFailureFixed(t *testing.T) {
clusterExtension, extensionCatalog := TestInitClusterExtensionClusterCatalog(t)

defer TestCleanup(t, extensionCatalog, clusterExtension, nil, nil)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down Expand Up @@ -682,7 +682,7 @@ func TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed(t *testi
clusterExtension, extensionCatalog, sa, ns := TestInit(t)

defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/cluster_extension_revision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

ocv1 "github.com/operator-framework/operator-controller/api/v1"
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
. "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
. "github.com/operator-framework/operator-controller/internal/shared/util/test"
. "github.com/operator-framework/operator-controller/test/helpers"
)

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
)

var (
Expand Down Expand Up @@ -45,7 +45,7 @@ func TestMain(m *testing.M) {
if path == "" {
fmt.Printf("Note: E2E_SUMMARY_OUTPUT is unset; skipping summary generation")
} else {
err = utils.PrintSummary(path)
err = testutil.PrintSummary(path)
if err != nil {
// Fail the run if alerts are found
fmt.Printf("%v", err)
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import (
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/util/rand"

utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
)

// TestOperatorControllerMetricsExportedEndpoint verifies that the metrics endpoint for the operator controller
func TestOperatorControllerMetricsExportedEndpoint(t *testing.T) {
client := utils.FindK8sClient(t)
client := testutil.FindK8sClient(t)
curlNamespace := createRandomNamespace(t, client)
componentNamespace := getComponentNamespace(t, client, "control-plane=operator-controller-controller-manager")
metricsURL := fmt.Sprintf("https://operator-controller-service.%s.svc.cluster.local:8443/metrics", componentNamespace)
Expand All @@ -50,7 +50,7 @@ func TestOperatorControllerMetricsExportedEndpoint(t *testing.T) {

// TestCatalogdMetricsExportedEndpoint verifies that the metrics endpoint for catalogd
func TestCatalogdMetricsExportedEndpoint(t *testing.T) {
client := utils.FindK8sClient(t)
client := testutil.FindK8sClient(t)
curlNamespace := createRandomNamespace(t, client)
componentNamespace := getComponentNamespace(t, client, "control-plane=catalogd-controller-manager")
metricsURL := fmt.Sprintf("https://catalogd-service.%s.svc.cluster.local:7443/metrics", componentNamespace)
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/network_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
)

const (
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestNetworkPolicyJustifications(t *testing.T) {
}
}

clientForComponent := utils.FindK8sClient(t)
clientForComponent := testutil.FindK8sClient(t)

operatorControllerNamespace := getComponentNamespace(t, clientForComponent, operatorManagerSelector)
catalogDNamespace := getComponentNamespace(t, clientForComponent, catalogdManagerSelector)
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/single_namespace_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/utils/ptr"

ocv1 "github.com/operator-framework/operator-controller/api/v1"
utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
. "github.com/operator-framework/operator-controller/test/helpers"
)

Expand All @@ -29,7 +29,7 @@ const (
func TestClusterExtensionSingleNamespaceSupport(t *testing.T) {
SkipIfFeatureGateDisabled(t, soNsFlag)
t.Log("Test support for cluster extension config")
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating install namespace, watch namespace and necessary rbac resources")
namespace := corev1.Namespace{
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestClusterExtensionSingleNamespaceSupport(t *testing.T) {
func TestClusterExtensionOwnNamespaceSupport(t *testing.T) {
SkipIfFeatureGateDisabled(t, soNsFlag)
t.Log("Test support for cluster extension with OwnNamespace install mode support")
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating install namespace, watch namespace and necessary rbac resources")
namespace := corev1.Namespace{
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestClusterExtensionVersionUpdate(t *testing.T) {

clusterExtension, extensionCatalog, sa, ns := TestInit(t)
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

t.Log("By creating an ClusterExtension at a specified version")
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/webhook_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"k8s.io/utils/ptr"

ocv1 "github.com/operator-framework/operator-controller/api/v1"
utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
. "github.com/operator-framework/operator-controller/test/helpers"
)

Expand All @@ -29,7 +29,7 @@ var dynamicClient dynamic.Interface
func TestWebhookSupport(t *testing.T) {
SkipIfFeatureGateDisabled(t, "WebhookProviderCertManager")
t.Log("Test support for bundles with webhooks")
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

if dynamicClient == nil {
var err error
Expand Down
4 changes: 2 additions & 2 deletions test/upgrade-e2e/post_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

ocv1 "github.com/operator-framework/operator-controller/api/v1"
utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
)

const (
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestClusterCatalogUnpacking(t *testing.T) {
func TestClusterExtensionAfterOLMUpgrade(t *testing.T) {
t.Log("Starting checks after OLM upgrade")
ctx := context.Background()
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)

// wait for catalogd deployment to finish
t.Log("Wait for catalogd deployment to be ready")
Expand Down
Loading