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

Fixes #38055 - Fix future-dated subscriptions #11243

Conversation

jeremylenz
Copy link
Member

@jeremylenz jeremylenz commented Dec 2, 2024

What are the changes introduced in this pull request?

Problem 1:
Candlepin's GET owners/{owner_key}/products endpoint, called by Katello::Resources::Candlepin::Product.all, recently added a new param, active. When the param is not included, it apparently causes Candlepin to omit (some?) products with future-dated subscriptions. Sending the param active=include should restore the previous behavior. This affects Candlepin version 4.4.15 and above.

Problem 2:
The "Add Subscriptions" page does not display future-dated subscriptions, e.g. subscriptions whose start date is in the future. Sending the add_future param should fix that.

Considerations taken when implementing this change?

I don't think this should break anything, since the param would just be ignored on previous CP versions.

What are the testing steps for this pull request?

  1. Obtain a manifest with a future-dated subscription and no other subscriptions

  2. Import into a new organization

Without this PR: Manifest import fails with

Validation failed: Subscription can't be blank

From another org with a valid manifest imported, the "Add Subscriptions" page does not show any future-dated subscriptions available to add.

After:
Manifest import succeeds
You can see any future-dated subscriptions on the Add Subscriptions page. Compare with access.redhat.com > Subscription allocations > your manifest > Add subscriptions. The available subscriptions in Satellite should include future-dated ones just like this page does.

@jeremylenz jeremylenz changed the title Fixes #38055 - Send active=include for Product.all Fixes #38055 - Fix future-dated subscriptions Dec 2, 2024
assert_equal 9, @org.product_contents.length
assert_equal 342, @org.products.length
assert_equal 9597, @org.product_contents.length
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what made tests pass locally for me. But I am not sure if this test is correct or not. It does make sense that the number of imported products would vary now that I'm sending include=active, but I wouldn't expect numbers this big. I looked inside the fixture manifest files and didn't see 342 of anything..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qcjames53 is getting completely different numbers. Maybe it's a difference between what's in our test databases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The product length and content length assertions have a habit of changing every couple times I record VCR. I reset and seeded the test db on master and noticed the same behavior. So the good news is that this at least isn't a regression.

Thinking about this a little, I'm happy to push the test through since this import test is just for our manifest handling, not Candlepin's handling of our API calls. Even without the inconsistency it's a good practice to VCR candlepin's output.

@jeremylenz jeremylenz force-pushed the 38055-product-all-active-include-what-now branch from 6d4255f to 2aec5eb Compare December 3, 2024 14:41
@jeremylenz jeremylenz force-pushed the 38055-product-all-active-include-what-now branch from 2aec5eb to 8e2423d Compare December 3, 2024 15:58
@jeremylenz jeremylenz force-pushed the 38055-product-all-active-include-what-now branch from acca93a to 6c0d720 Compare December 4, 2024 17:29
Copy link
Contributor

@qcjames53 qcjames53 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to confirm that during manifest import the active=include string works on Candlepin version 4.4.19 and allows inclusion of future-dated subscriptions. As mentioned in another comment, the manifest import test seems to produce inconsistent results from Candlepin depending on the run; this behavior was observed in the existing test so it is not a regression. I asked the team for input on this and we deemed it okay because testing Candlepin API responses is outside of the scope of this test.

Jeremy, you're clear to merge after pushing the smaller recordings. ACKed

@sjha4 thank you for taking a look at this :)

@jeremylenz jeremylenz merged commit 74241a4 into Katello:master Dec 4, 2024
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants