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
10 changes: 5 additions & 5 deletions internal/operator-controller/applier/boxcutter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/labels"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
testutils "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/bundlefs"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/clusterserviceversion"
)

func Test_RegistryV1BundleRenderer_Render_Success(t *testing.T) {
Expand All @@ -57,8 +57,8 @@ func Test_RegistryV1BundleRenderer_Render_Success(t *testing.T) {
}
bundleFS := bundlefs.Builder().
WithPackageName("some-package").
WithCSV(testutils.MakeCSV(testutils.WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces))).Build()

WithCSV(clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).Build()).
Build()
objs, err := r.Render(bundleFS, &ocv1.ClusterExtension{
Spec: ocv1.ClusterExtensionSpec{
Namespace: "some-namespace",
Expand All @@ -81,8 +81,8 @@ func Test_RegistryV1BundleRenderer_Render_Failure(t *testing.T) {
}
bundleFS := bundlefs.Builder().
WithPackageName("some-package").
WithCSV(testutils.MakeCSV(testutils.WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces))).Build()

WithCSV(clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).Build()).
Build()
objs, err := r.Render(bundleFS, &ocv1.ClusterExtension{
Spec: ocv1.ClusterExtensionSpec{
Namespace: "some-namespace",
Expand Down
31 changes: 15 additions & 16 deletions internal/operator-controller/applier/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle/source"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
. "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/clusterserviceversion"
)

func Test_RegistryV1HelmChartProvider_Get_ReturnsBundleSourceFailures(t *testing.T) {
Expand Down Expand Up @@ -51,7 +52,7 @@ func Test_RegistryV1HelmChartProvider_Get_ReturnsBundleRendererFailures(t *testi

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces)),
CSV: clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).Build(),
},
)

Expand All @@ -70,7 +71,7 @@ func Test_RegistryV1HelmChartProvider_Get_NoAPIServiceDefinitions(t *testing.T)

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithOwnedAPIServiceDescriptions(v1alpha1.APIServiceDescription{})),
CSV: clusterserviceversion.Builder().WithOwnedAPIServiceDescriptions(v1alpha1.APIServiceDescription{}).Build(),
},
)

Expand All @@ -91,7 +92,7 @@ func Test_RegistryV1HelmChartProvider_Get_SingleOwnNamespace(t *testing.T) {

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithInstallModeSupportFor(v1alpha1.InstallModeTypeOwnNamespace)),
CSV: clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeOwnNamespace).Build(),
},
)

Expand All @@ -114,7 +115,7 @@ func Test_RegistryV1HelmChartProvider_Get_SingleOwnNamespace(t *testing.T) {

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithInstallModeSupportFor(v1alpha1.InstallModeTypeSingleNamespace)),
CSV: clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeSingleNamespace).Build(),
},
)

Expand Down Expand Up @@ -142,7 +143,7 @@ func Test_RegistryV1HelmChartProvider_Get_SingleOwnNamespace(t *testing.T) {

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithInstallModeSupportFor(v1alpha1.InstallModeTypeOwnNamespace)),
CSV: clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeOwnNamespace).Build(),
},
)

Expand All @@ -164,7 +165,7 @@ func Test_RegistryV1HelmChartProvider_Get_NoWebhooksWithoutCertProvider(t *testi

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithWebhookDefinitions(v1alpha1.WebhookDescription{})),
CSV: clusterserviceversion.Builder().WithWebhookDefinitions(v1alpha1.WebhookDescription{}).Build(),
},
)

Expand All @@ -186,7 +187,7 @@ func Test_RegistryV1HelmChartProvider_Get_WebhooksSupportDisabled(t *testing.T)

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithWebhookDefinitions(v1alpha1.WebhookDescription{})),
CSV: clusterserviceversion.Builder().WithWebhookDefinitions(v1alpha1.WebhookDescription{}).Build(),
},
)

Expand All @@ -209,10 +210,9 @@ func Test_RegistryV1HelmChartProvider_Get_WebhooksWithCertProvider(t *testing.T)

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces),
WithWebhookDefinitions(v1alpha1.WebhookDescription{}),
),
CSV: clusterserviceversion.Builder().
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).
WithWebhookDefinitions(v1alpha1.WebhookDescription{}).Build(),
},
)

Expand Down Expand Up @@ -245,7 +245,7 @@ func Test_RegistryV1HelmChartProvider_Get_BundleRendererIntegration(t *testing.T

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces, v1alpha1.InstallModeTypeSingleNamespace)),
CSV: clusterserviceversion.Builder().WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces, v1alpha1.InstallModeTypeSingleNamespace).Build(),
},
)

Expand Down Expand Up @@ -315,10 +315,9 @@ func Test_RegistryV1HelmChartProvider_Get_Success(t *testing.T) {

b := source.FromBundle(
bundle.RegistryV1{
CSV: MakeCSV(
WithAnnotations(map[string]string{"foo": "bar"}),
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces),
),
CSV: clusterserviceversion.Builder().
WithAnnotations(map[string]string{"foo": "bar"}).
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).Build(),
Others: []unstructured.Unstructured{
*ToUnstructuredT(t, &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/bundle/source"
testutils "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/bundlefs"
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util/testing/clusterserviceversion"
)

const (
Expand All @@ -34,13 +34,13 @@ func Test_FromFS_Success(t *testing.T) {
bundleFS := bundlefs.Builder().
WithPackageName("test").
WithBundleProperty("from-file-key", "from-file-value").
WithBundleResource("csv.yaml", ptr.To(testutils.MakeCSV(
testutils.WithName("test.v1.0.0"),
testutils.WithAnnotations(map[string]string{
WithBundleResource("csv.yaml", ptr.To(clusterserviceversion.Builder().
WithName("test.v1.0.0").
WithAnnotations(map[string]string{
"olm.properties": `[{"type":"from-csv-annotations-key", "value":"from-csv-annotations-value"}]`,
}),
testutils.WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces)),
)).Build()
}).
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces).Build())).
Build()

rv1, err := source.FromFS(bundleFS).GetBundle()
require.NoError(t, err)
Expand Down Expand Up @@ -72,12 +72,12 @@ func Test_FromFS_Fails(t *testing.T) {
name: "bundle missing metadata/annotations.yaml",
FS: bundlefs.Builder().
WithBundleProperty("foo", "bar").
WithBundleResource("csv.yaml", ptr.To(testutils.MakeCSV())).Build(),
WithBundleResource("csv.yaml", ptr.To(clusterserviceversion.Builder().Build())).Build(),
}, {
name: "metadata/annotations.yaml missing package name annotation",
FS: bundlefs.Builder().
WithBundleProperty("foo", "bar").
WithBundleResource("csv.yaml", ptr.To(testutils.MakeCSV())).Build(),
WithBundleResource("csv.yaml", ptr.To(clusterserviceversion.Builder().Build())).Build(),
}, {
name: "bundle missing manifests directory",
FS: bundlefs.Builder().
Expand Down
Loading
Loading