-
Notifications
You must be signed in to change notification settings - Fork 36
Feature Toggle #102
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
Feature Toggle #102
Conversation
Can one of the admins verify this patch? |
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
@@ -109,7 +109,8 @@ def __init__(self, id, value, **kwards): | |||
self.id = id | |||
self.value = value | |||
|
|||
def __init__(self, id, key, variables=None, **kwargs): | |||
def __init__(self, id, key, featureEnabled=False, variables=None, **kwargs): |
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.
Actually, just realized this might not work. Only feature experiments will have this property. Regular experiment variations will omit this property and you will run into a situation where the variation comes in with just id, key, and variables
so you'd need to accommodate that scenario
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.
Shouldn't be an issue. generate_key_map in project_config calls as key,value arguments.
Still, have added a new test case to test the scenario.
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.
Looks good mostly, please address the remaining feedback.
@@ -973,6 +985,25 @@ def test_init__with_v4_datafile(self): | |||
self.assertEqual(expected_rollout_id_map, project_config.rollout_id_map) | |||
self.assertEqual(expected_variation_variable_usage_map, project_config.variation_variable_usage_map) | |||
|
|||
def test_variation_has_featureEnabled_false_if_prop_undefined(self): | |||
""" Test that featureEnabled property by default is set to False, when not given in the data file""" | |||
variation = { |
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.
Please indent this correctly
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.
Do you mean 4 space indent? The whole file right now is on a 2 space indent.
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.
Hmm github just shows it weird. See how line 1003 (the closing bracket) does not match the indentation of the opening bracket on line 990
tests/test_config.py
Outdated
}]} | ||
|
||
variation_entity = entities.Variation(**variation) | ||
self.assertFalse(variation_entity.featureEnabled) |
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.
Can you also assert that the rest of the properties are properly populated?
build |
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
build |
No description provided.