Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Unpack conditions #929

Open
varshaprasad96 opened this issue Jun 12, 2024 · 2 comments
Open

Use of Unpack conditions #929

varshaprasad96 opened this issue Jun 12, 2024 · 2 comments

Comments

@varshaprasad96
Copy link
Member

varshaprasad96 commented Jun 12, 2024

The direct registry client during unpacking exits only when it is successful or when it encounters an error: https://github.com/operator-framework/rukpak/blob/352d42f1e390177aed8fedf0cfb0212d5e71bc71/pkg/source/image_registry.go#L34. Which means the Unpacking and UnpackPending statuses would never be reached.

These were added initially, to update the client with the status when an unpack pod was being created (https://github.com/operator-framework/rukpak/blob/352d42f1e390177aed8fedf0cfb0212d5e71bc71/pkg/source/image.go#L54-L65). Given that implementation is no longer being used, having these statuses can also be technically removed.

However the caveat here is that having the pending status with a non-error nil return during reconcile, is extremely useful in unit-tests, where we use a mock unpacker and return with a pending state (

cl, reconciler := newClientAndReconciler(t, nil)
mockUnpacker := unpacker.(*MockUnpacker)
// Set up the Unpack method to return a result with StateUnpacked
mockUnpacker.On("Unpack", mock.Anything, mock.AnythingOfType("*v1alpha2.BundleDeployment")).Return(&source.Result{
State: source.StatePending,
). Removing this, would force us to go through the next steps in reconcile, and implement a mock storer and loader.

#928 removes the Unpacking state, leaving UnpackPending behind. It would be helpful to evaluate its requirements, and if needed modify the tests to mock other steps in the reconciler.

@joelanford
Copy link
Member

Removing this, would force us to go through the next steps in reconcile, and implement a mock storer and loader.

But I think we need to do that if we actually want to fully unit test our Reconciler, right?

@varshaprasad96
Copy link
Member Author

varshaprasad96 commented Jun 13, 2024

But I think we need to do that if we actually want to fully unit test our Reconciler, right?

Yes definitely. Which is why this issue to fix the unit tests and remove unpackPending status.

I just wanted to explain why I didn't remove it in #928

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants