coverband-service-client 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/coverband-service-client.gemspec +1 -1
- data/lib/coverband-service-client.rb +33 -22
- data/lib/coverband/service/client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bbda63a9e7eacfee67d03b5e0b08f9a4a2ef31d4eea06fcb3901730b81fad95
|
4
|
+
data.tar.gz: bab021109fc8d6a785f273c35a7e39c9da4cf78f65d3a2b3a52105d2c9c00333
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9b9fa656753664c2e6dd37670274d9bd9231dea30c071c8735c406f234649e9c1758804da33239889ad6e7636c4652ac8e8d6c851d2eb87b74bb62683d40cc8
|
7
|
+
data.tar.gz: 52f461ebbfdbd5b379c7e8a48661c89aada386cca21e85f60aee3b075bb9291b6a9397503063117c33b850c933562339d57dd5910727f6713240fe57ce84e12e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coverband-service-client (0.0.
|
4
|
+
coverband-service-client (0.0.6)
|
5
5
|
coverband (~> 4.2.4)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
coverband (4.2.4)
|
11
11
|
redis
|
12
12
|
minitest (5.14.0)
|
13
|
-
rake (
|
13
|
+
rake (13.0.1)
|
14
14
|
redis (4.1.3)
|
15
15
|
|
16
16
|
PLATFORMS
|
@@ -20,7 +20,7 @@ DEPENDENCIES
|
|
20
20
|
bundler (~> 2.0)
|
21
21
|
coverband-service-client!
|
22
22
|
minitest (~> 5.0)
|
23
|
-
rake (~>
|
23
|
+
rake (~> 13.0)
|
24
24
|
|
25
25
|
BUNDLED WITH
|
26
26
|
2.0.2
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
31
|
spec.add_development_dependency "minitest", "~> 5.0"
|
32
32
|
spec.add_runtime_dependency "coverband", "~> 4.2.4"
|
33
33
|
end
|
@@ -6,6 +6,7 @@ require 'securerandom'
|
|
6
6
|
COVERBAND_ENV = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || (defined?(Rails) ? Rails.env : 'unknown')
|
7
7
|
COVERBAND_SERVICE_URL = ENV['COVERBAND_URL'] ||
|
8
8
|
((COVERBAND_ENV == 'development') ? 'http://127.0.0.1:3456' : 'https://coverband-service.herokuapp.com')
|
9
|
+
COVERBAND_TIMEOUT = (COVERBAND_ENV == 'development') ? 5 : 1
|
9
10
|
|
10
11
|
module Coverband
|
11
12
|
|
@@ -68,19 +69,21 @@ module Coverband
|
|
68
69
|
|
69
70
|
# TODO: do we need dup
|
70
71
|
# TODO: remove timestamps, server will track first_seen
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
72
|
+
Thread.new do
|
73
|
+
data = expand_report(report.dup)
|
74
|
+
full_package = {
|
75
|
+
collection_type: 'coverage_delta',
|
76
|
+
collection_data: {
|
77
|
+
tags: {
|
78
|
+
process_type: process_type,
|
79
|
+
app_loading: type == Coverband::EAGER_TYPE,
|
80
|
+
runtime_env: runtime_env
|
81
|
+
},
|
82
|
+
file_coverage: data
|
83
|
+
}
|
81
84
|
}
|
82
|
-
|
83
|
-
|
85
|
+
save_coverage(full_package)
|
86
|
+
end&.join
|
84
87
|
end
|
85
88
|
|
86
89
|
def raw_store
|
@@ -91,10 +94,19 @@ module Coverband
|
|
91
94
|
|
92
95
|
def save_coverage(data)
|
93
96
|
uri = URI("#{coverband_url}/api/collector")
|
94
|
-
req = Net::HTTP::Post.new(uri,
|
95
|
-
|
97
|
+
req = Net::HTTP::Post.new(uri,
|
98
|
+
'Content-Type' => 'application/json',
|
99
|
+
'Coverband-Token' => ENV['COVERBAND_API_KEY'])
|
100
|
+
# puts "sending #{data}"
|
96
101
|
req.body = { remote_uuid: SecureRandom.uuid, data: data }.to_json
|
97
|
-
res = Net::HTTP.start(
|
102
|
+
res = Net::HTTP.start(
|
103
|
+
uri.hostname,
|
104
|
+
uri.port,
|
105
|
+
open_timeout: COVERBAND_TIMEOUT,
|
106
|
+
read_timeout: COVERBAND_TIMEOUT,
|
107
|
+
ssl_timeout: COVERBAND_TIMEOUT,
|
108
|
+
use_ssl: uri.scheme == 'https'
|
109
|
+
) do |http|
|
98
110
|
http.request(req)
|
99
111
|
end
|
100
112
|
rescue StandardError => e
|
@@ -150,7 +162,7 @@ module Coverband
|
|
150
162
|
tracked_views: views
|
151
163
|
}
|
152
164
|
}
|
153
|
-
puts "sending #{data}"
|
165
|
+
# puts "sending #{data}"
|
154
166
|
req.body = { remote_uuid: SecureRandom.uuid, data: data }.to_json
|
155
167
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
156
168
|
http.request(req)
|
@@ -163,18 +175,17 @@ module Coverband
|
|
163
175
|
end
|
164
176
|
|
165
177
|
Coverband.configure do |config|
|
166
|
-
# toggle store type
|
167
|
-
|
168
|
-
# redis_url = ENV['REDIS_URL']
|
169
|
-
# Normal Coverband Setup
|
170
|
-
# config.store = Coverband::Adapters::HashRedisStore.new(Redis.new(url: redis_url))
|
171
|
-
|
172
178
|
# Use The Test Service Adapter
|
173
179
|
config.store = Coverband::Adapters::Service.new(COVERBAND_SERVICE_URL)
|
174
180
|
|
175
181
|
# default to tracking views true
|
176
182
|
config.track_views = ENV['COVERBAND_ENABLE_VIEW_TRACKER'] ? true : false
|
177
183
|
|
184
|
+
# report every 10m by default
|
185
|
+
config.background_reporting_sleep_seconds = COVERBAND_ENV == 'production' ? 600 : 60
|
186
|
+
# add a wiggle to avoid service stampede
|
187
|
+
config.reporting_wiggle = COVERBAND_ENV == 'production' ? 90 : 6
|
188
|
+
|
178
189
|
if COVERBAND_ENV == 'test'
|
179
190
|
config.background_reporting_enabled = false
|
180
191
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coverband-service-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-02
|
12
|
+
date: 2020-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '13.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '13.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: minitest
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|