This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
FF-3150 feat: allow passing initial_configuration #70
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3ace125
FF-3150 feat: allow passing initial_configuration
rasendubi 821ea36
FF-3150 feat: make configuration store track initialization
rasendubi 4dec34f
FF-3150 feat: allow disabling the poller
rasendubi f9f84e5
feat: re-export Configuration from eppo_client
rasendubi 18777e1
FF-3150 docs: update documentation for initialization options
rasendubi f29fe7a
chore: bump version
rasendubi 4fd588f
FF-3150 feat: add a method to update configuration of the running client
rasendubi c4a7cc2
check for None or 0
leoromanovsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from eppo_client.models import UfcResponse | ||
|
||
|
||
class Configuration: | ||
""" | ||
Client configuration fetched from the backend that dictates how to | ||
interpret feature flags. | ||
""" | ||
|
||
def __init__(self, flags_configuration: str): | ||
self._flags_configuration = UfcResponse.model_validate_json(flags_configuration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
import pydantic | ||
|
||
from eppo_client.configuration import Configuration | ||
|
||
|
||
def test_init_valid(): | ||
Configuration(flags_configuration='{"flags": {}}') | ||
|
||
|
||
def test_init_invalid_json(): | ||
with pytest.raises(pydantic.ValidationError): | ||
Configuration(flags_configuration="") | ||
|
||
|
||
def test_init_invalid_format(): | ||
with pytest.raises(pydantic.ValidationError): | ||
Configuration(flags_configuration='{"flags": []}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import eppo_client | ||
from eppo_client.config import Config | ||
from eppo_client.configuration import Configuration | ||
from eppo_client.assignment_logger import AssignmentLogger | ||
|
||
|
||
def test_without_initial_configuration(): | ||
client = eppo_client.init( | ||
Config( | ||
api_key="test", | ||
base_url="http://localhost:8378/api", | ||
assignment_logger=AssignmentLogger(), | ||
) | ||
) | ||
assert not client.is_initialized() | ||
|
||
|
||
def test_with_initial_configuration(): | ||
client = eppo_client.init( | ||
Config( | ||
api_key="test", | ||
base_url="http://localhost:8378/api", | ||
assignment_logger=AssignmentLogger(), | ||
initial_configuration=Configuration(flags_configuration='{"flags":{}}'), | ||
) | ||
) | ||
assert client.is_initialized() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nice - elegant.