launchdarkly-server-sdk 6.2.3 → 6.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/ldclient-rb/config.rb +81 -4
- data/lib/ldclient-rb/evaluation_detail.rb +67 -8
- data/lib/ldclient-rb/file_data_source.rb +9 -300
- data/lib/ldclient-rb/impl/big_segments.rb +117 -0
- data/lib/ldclient-rb/impl/evaluator.rb +80 -28
- data/lib/ldclient-rb/impl/integrations/dynamodb_impl.rb +82 -18
- data/lib/ldclient-rb/impl/integrations/file_data_source.rb +212 -0
- data/lib/ldclient-rb/impl/integrations/redis_impl.rb +84 -31
- data/lib/ldclient-rb/impl/integrations/test_data/test_data_source.rb +40 -0
- data/lib/ldclient-rb/impl/repeating_task.rb +47 -0
- data/lib/ldclient-rb/impl/util.rb +4 -1
- data/lib/ldclient-rb/integrations/consul.rb +7 -0
- data/lib/ldclient-rb/integrations/dynamodb.rb +47 -2
- data/lib/ldclient-rb/integrations/file_data.rb +108 -0
- data/lib/ldclient-rb/integrations/redis.rb +41 -1
- data/lib/ldclient-rb/integrations/test_data/flag_builder.rb +438 -0
- data/lib/ldclient-rb/integrations/test_data.rb +209 -0
- data/lib/ldclient-rb/integrations/util/store_wrapper.rb +5 -0
- data/lib/ldclient-rb/integrations.rb +2 -51
- data/lib/ldclient-rb/interfaces.rb +152 -2
- data/lib/ldclient-rb/ldclient.rb +21 -7
- data/lib/ldclient-rb/polling.rb +22 -41
- data/lib/ldclient-rb/util.rb +1 -1
- data/lib/ldclient-rb/version.rb +1 -1
- metadata +31 -132
- data/.circleci/config.yml +0 -40
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -37
- data/.github/ISSUE_TEMPLATE/config.yml +0 -5
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- data/.github/pull_request_template.md +0 -21
- data/.gitignore +0 -16
- data/.hound.yml +0 -2
- data/.ldrelease/build-docs.sh +0 -18
- data/.ldrelease/circleci/linux/execute.sh +0 -18
- data/.ldrelease/circleci/mac/execute.sh +0 -18
- data/.ldrelease/circleci/template/build.sh +0 -29
- data/.ldrelease/circleci/template/publish.sh +0 -23
- data/.ldrelease/circleci/template/set-gem-home.sh +0 -7
- data/.ldrelease/circleci/template/test.sh +0 -10
- data/.ldrelease/circleci/template/update-version.sh +0 -8
- data/.ldrelease/circleci/windows/execute.ps1 +0 -19
- data/.ldrelease/config.yml +0 -29
- data/.rspec +0 -2
- data/.rubocop.yml +0 -600
- data/.simplecov +0 -4
- data/CHANGELOG.md +0 -367
- data/CODEOWNERS +0 -1
- data/CONTRIBUTING.md +0 -37
- data/Gemfile +0 -3
- data/azure-pipelines.yml +0 -51
- data/docs/Makefile +0 -26
- data/docs/index.md +0 -9
- data/launchdarkly-server-sdk.gemspec +0 -45
- data/spec/config_spec.rb +0 -63
- data/spec/diagnostic_events_spec.rb +0 -165
- data/spec/evaluation_detail_spec.rb +0 -135
- data/spec/event_sender_spec.rb +0 -197
- data/spec/event_summarizer_spec.rb +0 -63
- data/spec/events_spec.rb +0 -607
- data/spec/expiring_cache_spec.rb +0 -76
- data/spec/feature_store_spec_base.rb +0 -213
- data/spec/file_data_source_spec.rb +0 -283
- data/spec/fixtures/feature.json +0 -37
- data/spec/fixtures/feature1.json +0 -36
- data/spec/fixtures/user.json +0 -9
- data/spec/flags_state_spec.rb +0 -81
- data/spec/http_util.rb +0 -132
- data/spec/impl/evaluator_bucketing_spec.rb +0 -216
- data/spec/impl/evaluator_clause_spec.rb +0 -55
- data/spec/impl/evaluator_operators_spec.rb +0 -141
- data/spec/impl/evaluator_rule_spec.rb +0 -128
- data/spec/impl/evaluator_segment_spec.rb +0 -125
- data/spec/impl/evaluator_spec.rb +0 -349
- data/spec/impl/evaluator_spec_base.rb +0 -75
- data/spec/impl/event_factory_spec.rb +0 -108
- data/spec/impl/model/serialization_spec.rb +0 -41
- data/spec/in_memory_feature_store_spec.rb +0 -12
- data/spec/integrations/consul_feature_store_spec.rb +0 -40
- data/spec/integrations/dynamodb_feature_store_spec.rb +0 -103
- data/spec/integrations/store_wrapper_spec.rb +0 -276
- data/spec/launchdarkly-server-sdk_spec.rb +0 -13
- data/spec/launchdarkly-server-sdk_spec_autoloadtest.rb +0 -9
- data/spec/ldclient_end_to_end_spec.rb +0 -157
- data/spec/ldclient_spec.rb +0 -635
- data/spec/newrelic_spec.rb +0 -5
- data/spec/polling_spec.rb +0 -120
- data/spec/redis_feature_store_spec.rb +0 -121
- data/spec/requestor_spec.rb +0 -209
- data/spec/segment_store_spec_base.rb +0 -95
- data/spec/simple_lru_cache_spec.rb +0 -24
- data/spec/spec_helper.rb +0 -9
- data/spec/store_spec.rb +0 -10
- data/spec/stream_spec.rb +0 -45
- data/spec/user_filter_spec.rb +0 -91
- data/spec/util_spec.rb +0 -17
- data/spec/version_spec.rb +0 -7
data/spec/user_filter_spec.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe LaunchDarkly::UserFilter do
|
4
|
-
subject { LaunchDarkly::UserFilter }
|
5
|
-
|
6
|
-
let(:base_config) { LaunchDarkly::Config.new }
|
7
|
-
let(:config_with_all_attrs_private) { LaunchDarkly::Config.new({ all_attributes_private: true })}
|
8
|
-
let(:config_with_some_attrs_private) { LaunchDarkly::Config.new({ private_attribute_names: ['firstName', 'bizzle'] })}
|
9
|
-
|
10
|
-
# users to serialize
|
11
|
-
|
12
|
-
let(:user) {
|
13
|
-
{ key: 'abc', firstName: 'Sue', custom: { bizzle: 'def', dizzle: 'ghi' }}
|
14
|
-
}
|
15
|
-
|
16
|
-
let(:user_specifying_own_private_attr) {
|
17
|
-
u = user.clone
|
18
|
-
u[:privateAttributeNames] = [ 'dizzle', 'unused' ]
|
19
|
-
u
|
20
|
-
}
|
21
|
-
|
22
|
-
let(:user_with_unknown_top_level_attrs) {
|
23
|
-
{ key: 'abc', firstName: 'Sue', species: 'human', hatSize: 6, custom: { bizzle: 'def', dizzle: 'ghi' }}
|
24
|
-
}
|
25
|
-
|
26
|
-
let(:anon_user) {
|
27
|
-
{ key: 'abc', anonymous: 'true', custom: { bizzle: 'def', dizzle: 'ghi' }}
|
28
|
-
}
|
29
|
-
|
30
|
-
# expected results from serializing user
|
31
|
-
|
32
|
-
let(:user_with_all_attrs_hidden) {
|
33
|
-
{ key: 'abc', custom: { }, privateAttrs: [ 'bizzle', 'dizzle', 'firstName' ]}
|
34
|
-
}
|
35
|
-
|
36
|
-
let(:user_with_some_attrs_hidden) {
|
37
|
-
{ key: 'abc', custom: { dizzle: 'ghi' }, privateAttrs: [ 'bizzle', 'firstName' ]}
|
38
|
-
}
|
39
|
-
|
40
|
-
let(:user_with_own_specified_attr_hidden) {
|
41
|
-
{ key: 'abc', firstName: 'Sue', custom: { bizzle: 'def' }, privateAttrs: [ 'dizzle' ]}
|
42
|
-
}
|
43
|
-
|
44
|
-
let(:anon_user_with_all_attrs_hidden) {
|
45
|
-
{ key: 'abc', anonymous: 'true', custom: { }, privateAttrs: [ 'bizzle', 'dizzle' ]}
|
46
|
-
}
|
47
|
-
|
48
|
-
describe "serialize_events" do
|
49
|
-
it "includes all user attributes by default" do
|
50
|
-
uf = LaunchDarkly::UserFilter.new(base_config)
|
51
|
-
result = uf.transform_user_props(user)
|
52
|
-
expect(result).to eq user
|
53
|
-
end
|
54
|
-
|
55
|
-
it "hides all except key if all_attributes_private is true" do
|
56
|
-
uf = LaunchDarkly::UserFilter.new(config_with_all_attrs_private)
|
57
|
-
result = uf.transform_user_props(user)
|
58
|
-
expect(result).to eq user_with_all_attrs_hidden
|
59
|
-
end
|
60
|
-
|
61
|
-
it "hides some attributes if private_attribute_names is set" do
|
62
|
-
uf = LaunchDarkly::UserFilter.new(config_with_some_attrs_private)
|
63
|
-
result = uf.transform_user_props(user)
|
64
|
-
expect(result).to eq user_with_some_attrs_hidden
|
65
|
-
end
|
66
|
-
|
67
|
-
it "hides attributes specified in per-user privateAttrs" do
|
68
|
-
uf = LaunchDarkly::UserFilter.new(base_config)
|
69
|
-
result = uf.transform_user_props(user_specifying_own_private_attr)
|
70
|
-
expect(result).to eq user_with_own_specified_attr_hidden
|
71
|
-
end
|
72
|
-
|
73
|
-
it "looks at both per-user privateAttrs and global config" do
|
74
|
-
uf = LaunchDarkly::UserFilter.new(config_with_some_attrs_private)
|
75
|
-
result = uf.transform_user_props(user_specifying_own_private_attr)
|
76
|
-
expect(result).to eq user_with_all_attrs_hidden
|
77
|
-
end
|
78
|
-
|
79
|
-
it "strips out any unknown top-level attributes" do
|
80
|
-
uf = LaunchDarkly::UserFilter.new(base_config)
|
81
|
-
result = uf.transform_user_props(user_with_unknown_top_level_attrs)
|
82
|
-
expect(result).to eq user
|
83
|
-
end
|
84
|
-
|
85
|
-
it "leaves the anonymous attribute as is" do
|
86
|
-
uf = LaunchDarkly::UserFilter.new(config_with_all_attrs_private)
|
87
|
-
result = uf.transform_user_props(anon_user)
|
88
|
-
expect(result).to eq anon_user_with_all_attrs_hidden
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
data/spec/util_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe LaunchDarkly::Util do
|
4
|
-
describe 'log_exception' do
|
5
|
-
let(:logger) { double() }
|
6
|
-
|
7
|
-
it "logs error data" do
|
8
|
-
expect(logger).to receive(:error)
|
9
|
-
expect(logger).to receive(:debug)
|
10
|
-
begin
|
11
|
-
raise StandardError.new 'asdf'
|
12
|
-
rescue StandardError => exn
|
13
|
-
LaunchDarkly::Util.log_exception(logger, "message", exn)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|