-
Notifications
You must be signed in to change notification settings - Fork 35
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: isolate interfaces from SDK to improve testability #268
feat: isolate interfaces from SDK to improve testability #268
Conversation
0e316a3
to
10e29be
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #268 +/- ##
==========================================
+ Coverage 81.74% 81.92% +0.17%
==========================================
Files 10 10
Lines 964 979 +15
==========================================
+ Hits 788 802 +14
Misses 156 156
- Partials 20 21 +1 ☔ View full report in Codecov by Sentry. |
efeff46
to
57db4d6
Compare
57db4d6
to
24041fa
Compare
a6c2c55
to
1af6cf0
Compare
76d0a50
to
275a505
Compare
64f0598
to
30e3e4e
Compare
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
30e3e4e
to
c7ede79
Compare
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 makes sense to me, and we've made similar choices regarding the interfaces in other implementations. I'm approving but I think others with more Go experience than me should also have their input (thanks to @hairyhenderson for his feedback so far 🙏 )
sorry for the slow response on this, and thanks for merging it! |
This PR
Partially address #266 by providing interface contracts for the SDK. There are no breaking changes in this change
I have introduced
IEvaluation
interface, which represents the general OpenFeatuer API layer [1]. Before this change, there was no such interface so mocking API interactions was impossible. To obtain the singleton instance ofIEvaluation
interface, I have introducedGetApiInstance()
helper.Consider the example below,
In the future, we can update our documentation to make API instance based operations the preferred interaction method.
Further,
IEvaluation
exposes client creation methodsGetClient()
&GetNamedClient(clientName string)
(similar to spec [2]). These methods returnIClient
instances, making it easy to test OpenFeature client related operations.[1] - https://openfeature.dev/specification/sections/flag-evaluation
[2] - https://openfeature.dev/specification/sections/flag-evaluation#creating-clients