Skip to content

Commit f864421

Browse files
committed
Unskip all clusterextension_registryv1_validation_test.go
Still failing tests (up|down)grade should err b/c we don't have an installedBundle to check against Signed-off-by: Brett Tofel <[email protected]>
1 parent f9240c2 commit f864421

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

internal/controllers/clusterextension_registryv1_validation_test.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
"github.com/stretchr/testify/assert"
10+
"github.com/stretchr/testify/mock"
1011
"github.com/stretchr/testify/require"
1112
apimeta "k8s.io/apimachinery/pkg/api/meta"
1213
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -16,6 +17,7 @@ import (
1617

1718
"github.com/operator-framework/operator-registry/alpha/declcfg"
1819
"github.com/operator-framework/operator-registry/alpha/property"
20+
"github.com/operator-framework/rukpak/pkg/source"
1921

2022
ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
2123
"github.com/operator-framework/operator-controller/internal/catalogmetadata"
@@ -31,7 +33,6 @@ func TestClusterExtensionRegistryV1DisallowDependencies(t *testing.T) {
3133
name string
3234
bundle *catalogmetadata.Bundle
3335
wantErr string
34-
skip bool
3536
}{
3637
{
3738
name: "package with no dependencies",
@@ -46,9 +47,6 @@ func TestClusterExtensionRegistryV1DisallowDependencies(t *testing.T) {
4647
},
4748
CatalogName: "fake-catalog",
4849
},
49-
// Skipping the happy path, since it requires us to mock unpacker, store and the
50-
// entire installation. This should be handled in an e2e instead.
51-
skip: true,
5250
},
5351
{
5452
name: "package with olm.package.required property",
@@ -103,16 +101,20 @@ func TestClusterExtensionRegistryV1DisallowDependencies(t *testing.T) {
103101
defer func() {
104102
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1alpha1.ClusterExtension{}))
105103
}()
106-
107-
if tt.skip {
108-
return
109-
}
110-
111104
fakeCatalogClient := testutil.NewFakeCatalogClient([]*catalogmetadata.Bundle{tt.bundle})
105+
mockUnpacker := unpacker.(*MockUnpacker)
106+
// Verify if mockUnpacker is correctly set
107+
t.Log("MockUnpacker set to:", mockUnpacker)
108+
// Set up the Unpack method to return a result with StatePending
109+
mockUnpacker.On("Unpack", mock.Anything, mock.AnythingOfType("*v1alpha2.BundleDeployment")).Return(&source.Result{
110+
State: source.StatePending,
111+
}, nil)
112+
112113
reconciler := &controllers.ClusterExtensionReconciler{
113114
Client: cl,
114115
BundleProvider: &fakeCatalogClient,
115116
ActionClientGetter: helmClientGetter,
117+
Unpacker: unpacker,
116118
}
117119

118120
installNamespace := fmt.Sprintf("test-ns-%s", rand.String(8))

0 commit comments

Comments
 (0)