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

fix(subscriptions): ensure that manually added subscriptions work correctly in all deployments #3182

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

matthewelwell
Copy link
Contributor

Changes

This PR ensures that manually added subscriptions work in all settings. Currently it is only possible to add a subscription manually if you define the subscription_id value as "trial". This PR will mean that manually added subscriptions will not factor in the subscription id.

Another approach that I considered here was to have other, pre-defined constants that should be set as the subscription id in different scenarios.

Finally, this is a stop gap improvement until we can use license files to better handle on premise deployments.

How did you test this code?

Added / updated tests.

@matthewelwell matthewelwell requested review from a team and zachaysan and removed request for a team December 18, 2023 20:44
Copy link

vercel bot commented Dec 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2023 0:07am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2023 0:07am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2023 0:07am

Copy link
Contributor

github-actions bot commented Dec 18, 2023

Uffizzi Preview deployment-43134 was deleted.

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

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

I think I understand this and I couldn't find any obvious problems with the code or tests so I'm approving it, but I'm just confused about how the change will rollout to our customers. Also, we'll need to add ./SAAS to at least staging and production, right? Also, for working with things locally, we'd have to add one of the two paths to get subscription metadata outside of the free plan as well?

Comment on lines +446 to +458
def test_get_subscription_metadata_for_self_hosted_open_source(
organisation: Organisation, mocker: MockerFixture
) -> None:
"""
Open source should ignore the details provided in the
subscription and always return the free plan metadata.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I understand this correctly, we would want all our enterprise customers to add ./ENTERPRISE_VERSION before merging this code into their copy, correct? Or did I misunderstand?

Copy link
Contributor Author

@matthewelwell matthewelwell Dec 20, 2023

Choose a reason for hiding this comment

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

Nope, that is already done in the docker builds here and here (this one needs merging still - I will do that now).

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (65fd590) 96.00% compared to head (bc1071f) 96.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3182   +/-   ##
=======================================
  Coverage   96.00%   96.00%           
=======================================
  Files        1062     1062           
  Lines       32200    32241   +41     
=======================================
+ Hits        30914    30954   +40     
- Misses       1286     1287    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthewelwell matthewelwell force-pushed the fix/3140/allow-manual-subscriptions branch from c509219 to 61fbee9 Compare December 20, 2023 11:55
@matthewelwell
Copy link
Contributor Author

I think I understand this and I couldn't find any obvious problems with the code or tests so I'm approving it, but I'm just confused about how the change will rollout to our customers. Also, we'll need to add ./SAAS to at least staging and production, right?

Yep, this is done here.

Also, for working with things locally, we'd have to add one of the two paths to get subscription metadata outside of the free plan as well?

Yes, that's true, but I think that's a necessary step here. If it proves to be super painful then we can revisit and see if there's a way we can work around it for local development, but obviously for testing it's super easy to mock those util functions (we may even want to create fixtures to mock them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants