launchdarkly-server-sdk 5.6.2 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,7 +95,7 @@ EOF
95
95
  let(:bad_file_path) { "no-such-file" }
96
96
 
97
97
  before do
98
- @config = LaunchDarkly::Config.new
98
+ @config = LaunchDarkly::Config.new(logger: $null_log)
99
99
  @store = @config.feature_store
100
100
  @tmp_dir = Dir.mktmpdir
101
101
  end
@@ -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
 
@@ -4,8 +4,6 @@ require "spec_helper"
4
4
 
5
5
 
6
6
  $my_prefix = 'testprefix'
7
- $null_log = ::Logger.new($stdout)
8
- $null_log.level = ::Logger::FATAL
9
7
 
10
8
  $consul_base_opts = {
11
9
  prefix: $my_prefix,
@@ -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"),
@@ -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
@@ -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
@@ -4,10 +4,7 @@ require "redis"
4
4
  require "spec_helper"
5
5
 
6
6
 
7
-
8
7
  $my_prefix = 'testprefix'
9
- $null_log = ::Logger.new($stdout)
10
- $null_log.level = ::Logger::FATAL
11
8
 
12
9
  $base_opts = {
13
10
  prefix: $my_prefix,
@@ -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
- yield r
10
- r.stop
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" } } }
@@ -3,6 +3,9 @@ CodeClimate::TestReporter.start
3
3
 
4
4
  require "ldclient-rb"
5
5
 
6
+ $null_log = ::Logger.new($stdout)
7
+ $null_log.level = ::Logger::FATAL
8
+
6
9
  RSpec.configure do |config|
7
10
  config.before(:each) do
8
11
  end
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.6.2
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-01-15 00:00:00.000000000 Z
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.1
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.1
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
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- require "rspec/core/rake_task"
4
- RSpec::Core::RakeTask.new(:spec)
5
- task default: :spec