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

feat: Added new getFeatureVariableJson and getAllFeatureVariables Apis #251

Merged
merged 13 commits into from
May 13, 2020

Conversation

zashraf1985
Copy link
Contributor

Summary

Added new getFeatureVariableJson and getAllFeatureVariables Apis

Test plan

Added Unit tests

@coveralls
Copy link

coveralls commented May 6, 2020

Coverage Status

Coverage decreased (-0.02%) to 99.491% when pulling 95b0de1 on zeeshan/feature-json into 8c14502 on master.

@zashraf1985 zashraf1985 closed this May 6, 2020
@zashraf1985 zashraf1985 reopened this May 6, 2020
@zashraf1985 zashraf1985 closed this May 6, 2020
@zashraf1985 zashraf1985 reopened this May 6, 2020
@zashraf1985 zashraf1985 removed the WIP Work in progress label May 8, 2020
@zashraf1985 zashraf1985 marked this pull request as ready for review May 8, 2020 22:52
@zashraf1985 zashraf1985 requested a review from a team as a code owner May 8, 2020 22:52
@zashraf1985 zashraf1985 removed their assignment May 8, 2020
Copy link
Contributor

@oakbani oakbani left a comment

Choose a reason for hiding this comment

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

Looks good.

variable.delete('subType')
end
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than putting the same manipulation code here. Can you directly access the two new variables that you have added and modify their type. Just a matter of preference, you may keep it this way.

Choose a reason for hiding this comment

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

I have also noticed that, not sure why it has to be done in both places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oakbani @pawels-optimizely i changed it to only alter the ones that need to be altered.

Copy link

@pawels-optimizely pawels-optimizely left a comment

Choose a reason for hiding this comment

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

are there tests for get_feature_variable_json with notification or I missed it ?
get_all_feature_variables tests look good.

@zashraf1985
Copy link
Contributor Author

@pawels-optimizely added notification listener tests for get_feature_variable_json

Copy link
Contributor

@thomaszurkan-optimizely thomaszurkan-optimizely left a comment

Choose a reason for hiding this comment

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

Can we add a all variables source FEATURE_TEST? I think that would expose a scope problem on your source_info. I am just looking at the PR and haven't loaded into an IDE so correct me if I'm wrong on the source_info scope. But, I still think we should add the test.


source_string = Optimizely::DecisionService::DECISION_SOURCES['ROLLOUT']
if decision && decision['source'] == Optimizely::DecisionService::DECISION_SOURCES['FEATURE_TEST']
source_info = {
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this out of scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. It was decided to add a notification for all-feature-variables later. This is bein added in all the sdks now

feature_flag['variables'].each do |variable|
if variable['type'] == 'string' && variable['subType'] == 'json'
variable['type'] = 'json'
variable.delete('subType')
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize why. I just :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah i agree. it looks ugly.

'feature', 'test_user', {'browser_type' => 'firefox'},
feature_enabled: false,
feature_key: 'json_single_variable_feature',
source: 'rollout',
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a feature_test test. so, that you also show the proper values in source_info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added source info to one of the tests

Copy link

@pawels-optimizely pawels-optimizely left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@thomaszurkan-optimizely thomaszurkan-optimizely left a comment

Choose a reason for hiding this comment

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

For the source_info, I was more asking why you didn't just do:
source_info = {}
and then set it if the it is a feature test and eliminate source_info || {}

LGTM

@thomaszurkan-optimizely thomaszurkan-optimizely merged commit c1d0cb7 into master May 13, 2020
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.

6 participants