-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add Audiences to OptimizelyConfig and expose in OptimizelyExperiment #342
Conversation
- assertRaisesRegexp -> assertRaisesRegex - assertEquals -> assertEqual - isAlive() -> is_alive() - Check added to base.py to confirm attribute assertRaisesRegex for backwards compatibility to Python2.7
…key and environment_key. Move decide tests to test_user_context from test_optimizely.
Looks like some CI issues pulling in python files... @msohailhussain is this part of what you were talking about with some failures? |
As draft for now (Used a label) But please take a look at let me know thoughts. |
Found the issue. Fixing shortly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some confusions about OptimizelyConfig entities and ProjectConfig entities. See my comments to clarify them.
optimizely/optimizely_config.py
Outdated
audiences_map[audience.get('id')] = audience.get('name') | ||
|
||
# Updating each OptimizelyExperiment based on the ID from entities.Experiment found in the experiment_key_map | ||
for ent_exp in project_config.experiment_key_map.values(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This covers "experiment" rules. We also need to do the same to experiments in rollout ("delivery" rules) as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delivery Rules added to OptimizelyConfig and test cases to cover
…utes list and events list.
… one operand and one ID, remove unneed get for delivery_rules.
optimizely/optimizely_config.py
Outdated
def get_delivery_rules(self): | ||
""" Get the delivery rules list associated with OptimizelyConfig | ||
|
||
Returns: | ||
List of OptimizelyExperiments as DeliveryRules from Rollouts. | ||
""" | ||
return self.delivery_rules | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function isnt needed, I meant to remove. Thanks for spotting!
tests/base.py
Outdated
'delivery_rules': [], | ||
'experiment_rules': [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testing in Python will fail if these are not there because it compares the expected_config which is a dict of the OptimizelyConfig with the actual_config, a dict of the actual OptimizelyConfig. Base.py homes other scenarios to create OptimizelyConfig which it compares those dicts directly with. If that makes sense. We can chat more if you like.
@jaeopt All changes and concerns addressed. Please see me comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes look good. We can discuss a couple of more issues tomorrow.
tests/base.py
Outdated
'delivery_rules': [], | ||
'experiment_rules': [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a wrong place to add them. We can discuss.
optimizely/optimizely_config.py
Outdated
def get_delivery_rules(self): | ||
""" Get the delivery rules list associated with OptimizelyConfig | ||
|
||
Returns: | ||
List of OptimizelyExperiments as DeliveryRules from Rollouts. | ||
""" | ||
return self.delivery_rules | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also have questions about other get functions other than get_datafile().
removed experiment_rules and delivery_rules from base.py and all good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes look good except that get functions not cleaned up yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes are fine. |
Prod Suite with updated test app not using getter for sdk_key and environment_key: https://travis-ci.com/github/optimizely/fullstack-prod-suite/builds/232876085 |
FSC Suite - Using updated Test App not using getts for sdk_key or environment_key: https://travis-ci.com/github/optimizely/fullstack-sdk-compatibility-suite/builds/232876040 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality looks good, just some minor suggestions.
…y for another edge case ['and'], changed method to combine typed_audiences and audiences from project_config to use lookup map rather than build a list and check length. Reduces time complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one nit.
The typed_audiences has higher precedence. | ||
''' | ||
|
||
typed_audiences = project_config.typed_audiences[:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@The-inside-man Minor, but we don't mutate typed_audiences and thus can do a reference copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks for catching that!
Summary
The “why”, or other context.
Test plan
Issues