-
Notifications
You must be signed in to change notification settings - Fork 31
feat: getOptimizelyConfig API to get static experiments and features data #348
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
Conversation
b7c9c0a to
bea7c89
Compare
Pull Request Test Coverage Report for Build 1325
💛 - Coveralls |
core-api/src/main/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigService.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
jaeopt
left a comment
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.
Overall looks good! A few small changes required.
zashraf1985
left a comment
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
core-api/src/main/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigService.java
Show resolved
Hide resolved
jaeopt
left a comment
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.
A small change required
jaeopt
left a comment
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
mikecdavis
left a comment
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'm concerned with the test coverage. I think we should have more explicit test cases and scenarios. I would also like to see .stream() used as opposed to .forEach(...) when building the transformations. I provided an example where the method structure first addresses any pre-conditions then builds the response. I think that pattern can be applied to the other getters and will be cleaner overall.
core-api/src/main/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigService.java
Outdated
Show resolved
Hide resolved
core-api/src/main/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigService.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
mikecdavis
left a comment
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.
OptimizelyConfigService looks great. Thanks for making those changes, I just noted a few minor changes there.
I would have liked to see better unit test coverage of the individual methods: e.g.
- testGenerateFeatureKeyToVariablesMap
- testGetExperimentFeatureKey
- testGetExperimentsMap
- testGetVariationsMap
- testGetMergedVariablesMap
- testGetExperimentsMapForFeature
- testGetFeatureVariablesMap
- testGetFeaturesMap
The current approach is a higher level "integration" style test relying on validConfigJsonV4(). As a result the coverage feels more like a sanity check than a comprehensive intentional test suite. We also don't have explicit unit tests on the individual POJO constructors and getters. The coverage is assumed through the higher level testing, but again its implicit coverage not explicit.
|
@mikecdavis ... Thanks for your feedback... You are right about unit tests not looking like the way they should in java. I should have been more watchful about it. I have been juggling between reviewing and implementing optimizely config on multiple languages so may be i mostly leaned towards porting some or most of the stuff instead of totally rethinking how it should be implemented somewhat differently in different languages. This is valuable feedback for me both in context of the current feature and also for the future work. |
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.
Sorry to keep being a stickler about this, but we need more granular, explicit tests.
Must have:
- The model classes need tests for the constructors and getters.
Nice to have:
- The Service tests should not rely on
validConfigJsonV4(), this is a bad precedent that we need to try to break. Instead, construct explicit input and output. Our dependency onvalidConfigJsonV4()is brittle and lacks comprehension.
…fig json file and created hardcoded config
mikecdavis
left a comment
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.
A few typos, but LGTM.
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigServiceTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigServiceTest.java
Outdated
Show resolved
Hide resolved
core-api/src/test/java/com/optimizely/ab/optimizelyconfig/OptimizelyConfigServiceTest.java
Outdated
Show resolved
Hide resolved
|
@jaeopt can you please review and approve, as its blocked upon your change request |
jaeopt
left a comment
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
| @@ -1,5 +1,5 @@ | |||
| /**************************************************************************** | |||
| * Copyright 2016-2019, Optimizely, Inc. and contributors * | |||
| * Copyright 2020, Optimizely, Inc. and contributors * | |||
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.
@fayyazarshad this should be 2016-2020
Summary
Added
OptimizelyConfigServicewhich generatesOptimizelyConfigObject containing experiments and features data. This is the first step in the development ofgetOptimizelyConfigapi. This service always generates a newOptimzelyConfigobject for now. Next PR will contain caching implementation forOptimizelyConfigobject.Test plan
Added Unit Tests