coverband 6.1.0 → 6.1.2.rc.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21e62f4add1bcd44cacd630e37e291a38ecfb924d8fa48698ecbe4ba69a99471
4
- data.tar.gz: 4cc4dfd1289bdf13f77c78a7deb399c18075ec53a835abb45fa11011d0815bd4
3
+ metadata.gz: 5432cf1cd61639c5d7cbf9e2821dd17ce3db882ef44694302b11b0c3f899a23d
4
+ data.tar.gz: abfd4a6cd427e46656e7d8bd33e7e97a26617e19d7868c03a10e8612b7a41ff3
5
5
  SHA512:
6
- metadata.gz: 2bcf294b5d07fc508b1468b0e3a2d993d15b1dae067bd147ca1d55ebc444cf6f7157fbd6e5afee205a7fa9e3648bee9fdab66cec6573ff31605c417346c858a3
7
- data.tar.gz: 282523aea85ea90943c6a8bbf595a3c135f7a95534ac2046ccfeb379cea252ad4889b3e31799de8917b3b989a9492f55fee032f302f8aa8a8c619e870941c79c
6
+ metadata.gz: 8c85138cc11053800b739780e69ea459473683f114b76319d3334ddbf6732287458948817e6f650a1dece4be57022f5b30385b24422c6de8d9bbb45077029de2
7
+ data.tar.gz: d9f8829248d15dd0159824c45eab9ffc3c286f2e357ef76665305db2dfca434c6f6c9184808dd9b8d421fd98c4ada3c6ee3ac5a1afba69d9f10f46608b42d61e
data/changes.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### Coverband 6.1.1
2
+
3
+ * Performance fix making paged report loading 10X faster
4
+
1
5
  ### Coverband 6.1.0
2
6
 
3
7
  This release has a number of smaller fixes and improvements. It includes a sizable refactoring around the UI which should simplify improvements going forward. This release is mostly targetting large projects with 6K+ ruby files, use the new `config.paged_reporting = true` option with the HashRedisStore to enable paged reporting for large projects. The HashRedisStore now also includes the last time a line in a file was executed.
data/coverband.gemspec CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "memory_profiler"
37
37
  # breaking change in minitest and mocha...
38
38
  # note: we are also adding 'spy' as mocha doesn't want us to spy on redis calls...
39
+ spec.add_development_dependency "spy"
39
40
  # ^^^ probably need a large test cleanup refactor
40
41
  spec.add_development_dependency "minitest", "= 5.18.1"
41
42
  spec.add_development_dependency "minitest-fork_executor"
@@ -231,14 +231,14 @@ module Coverband
231
231
  end
232
232
  end
233
233
 
234
+ # NOTE: This is kind of hacky, we find all the matching eager loading data
235
+ # for current page of runtime data.
234
236
  eager_key_pre = key_prefix(Coverband::EAGER_TYPE)
235
237
  runtime_key_pre = key_prefix(Coverband::RUNTIME_TYPE)
236
- matched_file_set = files_set(Coverband::EAGER_TYPE)
237
- .select do |eager_key, _val|
238
- runtime_file_set.any? do |runtime_key|
239
- (eager_key.sub(eager_key_pre, "") == runtime_key.sub(runtime_key_pre, ""))
240
- end
241
- end || []
238
+ matched_file_set = runtime_file_set.map do |runtime_key|
239
+ runtime_key.sub(runtime_key_pre, eager_key_pre)
240
+ end
241
+
242
242
  hash_data[Coverband::EAGER_TYPE] = matched_file_set.each_slice(page_size).flat_map do |key_batch|
243
243
  @redis.pipelined do |pipeline|
244
244
  key_batch.each do |key|
@@ -246,6 +246,7 @@ module Coverband
246
246
  end
247
247
  end
248
248
  end
249
+
249
250
  hash_data[Coverband::RUNTIME_TYPE] = hash_data[Coverband::RUNTIME_TYPE].each_with_object({}) do |data_from_redis, hash|
250
251
  add_coverage_for_file(data_from_redis, hash)
251
252
  end
@@ -5,5 +5,5 @@
5
5
  # use format "4.2.1.rc.1" ~> 4.2.1.rc to prerelease versions like v4.2.1.rc.2 and v4.2.1.rc.3
6
6
  ###
7
7
  module Coverband
8
- VERSION = "6.1.0"
8
+ VERSION = "6.1.2.rc.1"
9
9
  end
@@ -1,4 +1,4 @@
1
- $(document).ready(function() {
1
+ $(document).ready(function () {
2
2
  // remove the url params like notice=message so they don't stick around
3
3
  window.history.replaceState(
4
4
  "object or string",
@@ -9,7 +9,7 @@ $(document).ready(function() {
9
9
  .delay(3000)
10
10
  .fadeOut("slow");
11
11
 
12
- $(".del").click(function() {
12
+ $(".del").click(function () {
13
13
  if (!confirm("Do you want to delete")) {
14
14
  return false;
15
15
  }
@@ -42,7 +42,7 @@ $(document).ready(function() {
42
42
  var total_rows = 0;
43
43
  var page = 1;
44
44
  var all_data = [];
45
-
45
+
46
46
  // load and render page content before we start the loop
47
47
  // perhaps move this into a datatable ready event
48
48
  $(".dataTables_empty").html("loading...");
@@ -55,14 +55,14 @@ $(document).ready(function() {
55
55
  url: `${$(".file_list").data("coverageurl")}/report_json?page=${page}`,
56
56
  type: 'GET',
57
57
  dataType: 'json',
58
- success: function(data) {
58
+ success: function (data) {
59
59
  total_rows = data["iTotalRecords"];
60
60
  all_data = all_data.concat(data["aaData"]);
61
61
  $(".dataTables_empty").html("loading... on " + all_data.length + " of " + total_rows + " files");
62
62
  page += 1;
63
- ;
64
- // the page less than 100 is to stop infinite loop in case of folks never clearing out old coverage reports
65
- if (page < 50 && all_data.length < total_rows) {
63
+
64
+ // the page less than 50 is to stop infinite loop in case of folks never clearing out old coverage reports
65
+ if (page < 50 && all_data.length <= total_rows && data["aaData"].length > 0) {
66
66
  setTimeout(() => {
67
67
  get_page(page);
68
68
  }, 10);
@@ -81,28 +81,28 @@ $(document).ready(function() {
81
81
  }
82
82
 
83
83
  src_link_click = (trigger_element) => {
84
- var loader_url = $(trigger_element).attr("data-loader-url");
85
- auto_click_anchor = null;
86
- $(trigger_element).colorbox(jQuery.extend(colorbox_options, { href: loader_url}));
87
- };
84
+ var loader_url = $(trigger_element).attr("data-loader-url");
85
+ auto_click_anchor = null;
86
+ $(trigger_element).colorbox(jQuery.extend(colorbox_options, { href: loader_url }));
87
+ };
88
88
 
89
89
  var colorbox_options = {
90
90
  transition: "none",
91
91
  opacity: 1,
92
92
  width: "95%",
93
93
  height: "95%",
94
- onLoad: function() {
94
+ onLoad: function () {
95
95
  // If not highlighted yet, do it!
96
96
  var source_table = $(".shared_source_table");
97
97
  if (!source_table.hasClass("highlighted")) {
98
- source_table.find("pre code").each(function(i, e) {
98
+ source_table.find("pre code").each(function (i, e) {
99
99
  hljs.highlightBlock(e, " ");
100
100
  });
101
101
  source_table.addClass("highlighted");
102
102
  }
103
103
  window.location.hash = this.href.split("#")[1];
104
104
  },
105
- onCleanup: function() {
105
+ onCleanup: function () {
106
106
  window.location.hash = $(".group_tabs a:first").attr("href");
107
107
  }
108
108
  }
@@ -112,7 +112,7 @@ $(document).ready(function() {
112
112
  $(".file_list_container").hide();
113
113
 
114
114
  // Add tabs based upon existing file_list_containers
115
- $(".file_list_container h2").each(function() {
115
+ $(".file_list_container h2").each(function () {
116
116
  var container_id = $(this)
117
117
  .parent()
118
118
  .attr("id");
@@ -132,16 +132,16 @@ $(document).ready(function() {
132
132
 
133
133
  $(".group_tabs").append(
134
134
  '<li><a href="#' +
135
- container_id +
136
- '">' +
137
- group_name +
138
- " " +
139
- covered_percent +
140
- "</a></li>"
135
+ container_id +
136
+ '">' +
137
+ group_name +
138
+ " " +
139
+ covered_percent +
140
+ "</a></li>"
141
141
  );
142
142
  });
143
143
 
144
- $(".group_tabs a").each(function() {
144
+ $(".group_tabs a").each(function () {
145
145
  $(this).addClass(
146
146
  $(this)
147
147
  .attr("href")
@@ -150,12 +150,12 @@ $(document).ready(function() {
150
150
  });
151
151
 
152
152
  // Make sure tabs don't get ugly focus borders when active
153
- $(".group_tabs a").live("focus", function() {
153
+ $(".group_tabs a").live("focus", function () {
154
154
  $(this).blur();
155
155
  });
156
156
 
157
157
  var favicon_path = $('link[rel="shortcut icon"]').attr("href");
158
- $(".group_tabs a").live("click", function() {
158
+ $(".group_tabs a").live("click", function () {
159
159
  if (
160
160
  !$(this)
161
161
  .parent()
@@ -169,7 +169,7 @@ $(document).ready(function() {
169
169
  .addClass("active");
170
170
  }
171
171
  $(".file_list_container").hide();
172
- $(".file_list_container" + $(this).attr("href")).show(function() {
172
+ $(".file_list_container" + $(this).attr("href")).show(function () {
173
173
  // If we have an anchor to click, click it
174
174
  // allow rendering to complete before we click the anchor
175
175
  setTimeout(() => {
@@ -186,14 +186,14 @@ $(document).ready(function() {
186
186
  .attr("href")
187
187
  .replace("#", "#_");
188
188
  }
189
-
189
+
190
190
  // Force favicon reload - otherwise the location change containing anchor would drop the favicon...
191
191
  // Works only on firefox, but still... - Anyone know a better solution to force favicon on local relative file path?
192
192
  $('link[rel="shortcut icon"]').remove();
193
193
  $("head").append(
194
194
  '<link rel="shortcut icon" type="image/png" href="' +
195
- favicon_path +
196
- '" />'
195
+ favicon_path +
196
+ '" />'
197
197
  );
198
198
  return false;
199
199
  });
@@ -242,4 +242,52 @@ class HashRedisStoreTest < Minitest::Test
242
242
  @store.coverage["./dog.rb"]
243
243
  )
244
244
  end
245
+
246
+ def test_split_coverage
247
+ @store = Coverband::Adapters::HashRedisStore.new(
248
+ @redis,
249
+ redis_namespace: "coverband_test",
250
+ relative_file_converter: MockRelativeFileConverter
251
+ )
252
+
253
+ mock_file_hash
254
+ yesterday = DateTime.now.prev_day.to_time
255
+ mock_time(yesterday)
256
+
257
+ @store.type = :eager_loading
258
+ data = {
259
+ "app_path/dog.rb" => [0, nil, 1]
260
+ }
261
+ @store.save_report(data)
262
+
263
+ @store.type = :runtime
264
+ @store.save_report(
265
+ "app_path/dog.rb" => [0, 1, 2]
266
+ )
267
+ redis_pipelined = Spy.on(@redis, :pipelined).and_call_through
268
+ assert_equal(
269
+ {
270
+ runtime: {
271
+ "./dog.rb" => {
272
+ "first_updated_at" => yesterday.to_i,
273
+ "last_updated_at" => yesterday.to_i,
274
+ "file_hash" => "abcd",
275
+ "data" => [0, 1, 2],
276
+ "timedata" => [nil, Time.at(yesterday.to_i), Time.at(yesterday.to_i)]
277
+ }
278
+ },
279
+ eager_loading: {
280
+ "./dog.rb" => {
281
+ "first_updated_at" => yesterday.to_i,
282
+ "last_updated_at" => nil,
283
+ "file_hash" => "abcd",
284
+ "data" => [0, nil, 1],
285
+ "timedata" => [nil, nil, Time.at(yesterday.to_i)]
286
+ }
287
+ }
288
+ },
289
+ @store.split_coverage([Coverband::RUNTIME_TYPE, Coverband::EAGER_TYPE], {}, {page: 1})
290
+ )
291
+ assert_equal 2, redis_pipelined.calls.count
292
+ end
245
293
  end
data/test/test_helper.rb CHANGED
@@ -35,6 +35,7 @@ require "coverband/utils/results"
35
35
  require "coverband/reporters/html_report"
36
36
  require "coverband/reporters/json_report"
37
37
  require "webmock/minitest"
38
+ require "spy/integration"
38
39
 
39
40
  require_relative "unique_files"
40
41
  $VERBOSE = original_verbosity
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.2.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-04-21 00:00:00.000000000 Z
12
+ date: 2024-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: benchmark-ips
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: spy
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: minitest
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -510,9 +524,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
510
524
  version: '2.7'
511
525
  required_rubygems_version: !ruby/object:Gem::Requirement
512
526
  requirements:
513
- - - ">="
527
+ - - ">"
514
528
  - !ruby/object:Gem::Version
515
- version: '0'
529
+ version: 1.3.1
516
530
  requirements: []
517
531
  rubygems_version: 3.4.10
518
532
  signing_key: