-
Notifications
You must be signed in to change notification settings - Fork 2
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(ruby): add offline initialization and Configuration API #39
Conversation
337d1b4
to
707bc82
Compare
454df8b
to
4e93251
Compare
4e93251
to
3797d11
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.
Thanks for doing this! Would love some explicit testing now hat happens if they give it a garbage initial config, but otherwise it's looking great 🚀
|
||
# require 'eppo_client' | ||
|
||
RSpec.describe EppoClient::Configuration do |
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.
🙌
end | ||
end | ||
|
||
describe "bandits_configuration()" do |
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.
🔥
end | ||
end | ||
|
||
it "can be reinstantiated from own configuration" do |
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.
💪
expect(config1.flags_configuration).to eq(config2.flags_configuration) | ||
expect(config1.bandits_configuration).to eq(config2.bandits_configuration) |
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.
🔥
# guarantee. We're using it here because serialization order of | ||
# bandits is not guaranteed. | ||
expect(JSON.parse(config1.bandits_configuration)).to eq(JSON.parse(config2.bandits_configuration)) | ||
end |
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 wonder if we should test what happens if it's initialized with an invalid JSON configuration (e.g., an empty file). I'm thinking we want the SDK to boot but with no pre-initialized flags, perhaps logging a warning?
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.
There's a test for that. It will fail to create a Configuration
.
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 for missing this
}.to raise_error TypeError | ||
end | ||
|
||
it "throws on parse error" do |
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 I missed this 🤦
This PR adds the ability to initialize Ruby SDK in offline mode by passing
poll_interval_seconds: nil
and getting/setting configuration by usingconfiguration
/configuration=
methods onEppoClient
.