launchdarkly-server-sdk 5.6.2 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +4 -6
- data/launchdarkly-server-sdk.gemspec +1 -2
- data/lib/ldclient-rb/config.rb +64 -0
- data/lib/ldclient-rb/events.rb +94 -86
- data/lib/ldclient-rb/flags_state.rb +1 -1
- data/lib/ldclient-rb/impl/diagnostic_events.rb +130 -0
- data/lib/ldclient-rb/impl/event_sender.rb +72 -0
- data/lib/ldclient-rb/impl/util.rb +19 -0
- data/lib/ldclient-rb/ldclient.rb +17 -4
- data/lib/ldclient-rb/requestor.rb +1 -2
- data/lib/ldclient-rb/stream.rb +18 -5
- data/lib/ldclient-rb/version.rb +1 -1
- data/spec/diagnostic_events_spec.rb +163 -0
- data/spec/evaluation_spec.rb +1 -1
- data/spec/event_sender_spec.rb +179 -0
- data/spec/events_spec.rb +437 -524
- data/spec/file_data_source_spec.rb +1 -1
- data/spec/http_util.rb +15 -2
- data/spec/integrations/consul_feature_store_spec.rb +0 -2
- data/spec/integrations/dynamodb_feature_store_spec.rb +0 -2
- data/spec/ldclient_spec.rb +1 -1
- data/spec/polling_spec.rb +1 -1
- data/spec/redis_feature_store_spec.rb +0 -3
- data/spec/requestor_spec.rb +20 -4
- data/spec/spec_helper.rb +3 -0
- metadata +11 -19
- data/Rakefile +0 -5
data/spec/http_util.rb
CHANGED
@@ -52,6 +52,13 @@ class StubHTTPServer
|
|
52
52
|
@server.mount_proc(uri_path, action)
|
53
53
|
end
|
54
54
|
|
55
|
+
def setup_status_response(uri_path, status, headers={})
|
56
|
+
setup_response(uri_path) do |req, res|
|
57
|
+
res.status = status
|
58
|
+
headers.each { |n, v| res[n] = v }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
55
62
|
def setup_ok_response(uri_path, body, content_type=nil, headers={})
|
56
63
|
setup_response(uri_path) do |req, res|
|
57
64
|
res.status = 200
|
@@ -63,11 +70,17 @@ class StubHTTPServer
|
|
63
70
|
|
64
71
|
def record_request(req, res)
|
65
72
|
@requests.push(req)
|
66
|
-
@requests_queue << req
|
73
|
+
@requests_queue << [req, req.body]
|
67
74
|
end
|
68
75
|
|
69
76
|
def await_request
|
70
|
-
@requests_queue.pop
|
77
|
+
r = @requests_queue.pop
|
78
|
+
r[0]
|
79
|
+
end
|
80
|
+
|
81
|
+
def await_request_with_body
|
82
|
+
r = @requests_queue.pop
|
83
|
+
return r[0], r[1]
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
@@ -6,8 +6,6 @@ require "spec_helper"
|
|
6
6
|
$table_name = 'LD_DYNAMODB_TEST_TABLE'
|
7
7
|
$endpoint = 'http://localhost:8000'
|
8
8
|
$my_prefix = 'testprefix'
|
9
|
-
$null_log = ::Logger.new($stdout)
|
10
|
-
$null_log.level = ::Logger::FATAL
|
11
9
|
|
12
10
|
$dynamodb_opts = {
|
13
11
|
credentials: Aws::Credentials.new("key", "secret"),
|
data/spec/ldclient_spec.rb
CHANGED
@@ -461,7 +461,7 @@ describe LaunchDarkly::LDClient do
|
|
461
461
|
end
|
462
462
|
|
463
463
|
describe 'with send_events: true' do
|
464
|
-
let(:config_with_events) { LaunchDarkly::Config.new({offline: false, send_events: true, data_source: null_data}) }
|
464
|
+
let(:config_with_events) { LaunchDarkly::Config.new({offline: false, send_events: true, diagnostic_opt_out: true, data_source: null_data}) }
|
465
465
|
let(:client_with_events) { subject.new("secret", config_with_events) }
|
466
466
|
|
467
467
|
it "does not use a NullEventProcessor" do
|
data/spec/polling_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe LaunchDarkly::PollingProcessor do
|
|
6
6
|
let(:requestor) { double() }
|
7
7
|
|
8
8
|
def with_processor(store)
|
9
|
-
config = LaunchDarkly::Config.new(feature_store: store)
|
9
|
+
config = LaunchDarkly::Config.new(feature_store: store, logger: $null_log)
|
10
10
|
processor = subject.new(config, requestor)
|
11
11
|
begin
|
12
12
|
yield processor
|
data/spec/requestor_spec.rb
CHANGED
@@ -4,10 +4,13 @@ require "spec_helper"
|
|
4
4
|
$sdk_key = "secret"
|
5
5
|
|
6
6
|
describe LaunchDarkly::Requestor do
|
7
|
-
def with_requestor(base_uri)
|
8
|
-
r = LaunchDarkly::Requestor.new($sdk_key, LaunchDarkly::Config.new(base_uri: base_uri))
|
9
|
-
|
10
|
-
|
7
|
+
def with_requestor(base_uri, opts = {})
|
8
|
+
r = LaunchDarkly::Requestor.new($sdk_key, LaunchDarkly::Config.new({ base_uri: base_uri }.merge(opts)))
|
9
|
+
begin
|
10
|
+
yield r
|
11
|
+
ensure
|
12
|
+
r.stop
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
describe "request_all_flags" do
|
@@ -56,6 +59,19 @@ describe LaunchDarkly::Requestor do
|
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
62
|
+
it "sends wrapper header if configured" do
|
63
|
+
with_server do |server|
|
64
|
+
with_requestor(server.base_uri.to_s, { wrapper_name: 'MyWrapper', wrapper_version: '1.0' }) do |requestor|
|
65
|
+
server.setup_ok_response("/", "{}")
|
66
|
+
requestor.request_all_data()
|
67
|
+
expect(server.requests.count).to eq 1
|
68
|
+
expect(server.requests[0].header).to include({
|
69
|
+
"x-launchdarkly-wrapper" => [ "MyWrapper/1.0" ]
|
70
|
+
})
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
59
75
|
it "can reuse cached data" do
|
60
76
|
etag = "xyz"
|
61
77
|
expected_data = { flags: { x: { key: "x" } } }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchdarkly-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 2.1.2
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '10.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '10.0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: rspec_junit_formatter
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,14 +204,14 @@ dependencies:
|
|
218
204
|
requirements:
|
219
205
|
- - '='
|
220
206
|
- !ruby/object:Gem::Version
|
221
|
-
version: 1.0.
|
207
|
+
version: 1.0.2
|
222
208
|
type: :runtime
|
223
209
|
prerelease: false
|
224
210
|
version_requirements: !ruby/object:Gem::Requirement
|
225
211
|
requirements:
|
226
212
|
- - '='
|
227
213
|
- !ruby/object:Gem::Version
|
228
|
-
version: 1.0.
|
214
|
+
version: 1.0.2
|
229
215
|
description: Official LaunchDarkly SDK for Ruby
|
230
216
|
email:
|
231
217
|
- team@launchdarkly.com
|
@@ -252,7 +238,6 @@ files:
|
|
252
238
|
- Gemfile.lock
|
253
239
|
- LICENSE.txt
|
254
240
|
- README.md
|
255
|
-
- Rakefile
|
256
241
|
- azure-pipelines.yml
|
257
242
|
- ext/mkrf_conf.rb
|
258
243
|
- launchdarkly-server-sdk.gemspec
|
@@ -267,12 +252,15 @@ files:
|
|
267
252
|
- lib/ldclient-rb/file_data_source.rb
|
268
253
|
- lib/ldclient-rb/flags_state.rb
|
269
254
|
- lib/ldclient-rb/impl.rb
|
255
|
+
- lib/ldclient-rb/impl/diagnostic_events.rb
|
270
256
|
- lib/ldclient-rb/impl/event_factory.rb
|
257
|
+
- lib/ldclient-rb/impl/event_sender.rb
|
271
258
|
- lib/ldclient-rb/impl/integrations/consul_impl.rb
|
272
259
|
- lib/ldclient-rb/impl/integrations/dynamodb_impl.rb
|
273
260
|
- lib/ldclient-rb/impl/integrations/redis_impl.rb
|
274
261
|
- lib/ldclient-rb/impl/store_client_wrapper.rb
|
275
262
|
- lib/ldclient-rb/impl/store_data_set_sorter.rb
|
263
|
+
- lib/ldclient-rb/impl/util.rb
|
276
264
|
- lib/ldclient-rb/in_memory_store.rb
|
277
265
|
- lib/ldclient-rb/integrations.rb
|
278
266
|
- lib/ldclient-rb/integrations/consul.rb
|
@@ -295,7 +283,9 @@ files:
|
|
295
283
|
- scripts/gendocs.sh
|
296
284
|
- scripts/release.sh
|
297
285
|
- spec/config_spec.rb
|
286
|
+
- spec/diagnostic_events_spec.rb
|
298
287
|
- spec/evaluation_spec.rb
|
288
|
+
- spec/event_sender_spec.rb
|
299
289
|
- spec/event_summarizer_spec.rb
|
300
290
|
- spec/events_spec.rb
|
301
291
|
- spec/expiring_cache_spec.rb
|
@@ -351,7 +341,9 @@ specification_version: 4
|
|
351
341
|
summary: LaunchDarkly SDK for Ruby
|
352
342
|
test_files:
|
353
343
|
- spec/config_spec.rb
|
344
|
+
- spec/diagnostic_events_spec.rb
|
354
345
|
- spec/evaluation_spec.rb
|
346
|
+
- spec/event_sender_spec.rb
|
355
347
|
- spec/event_summarizer_spec.rb
|
356
348
|
- spec/events_spec.rb
|
357
349
|
- spec/expiring_cache_spec.rb
|