turbo_tests2 4.0.1 → 4.0.3

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.
@@ -244,7 +244,10 @@ module TurboTests
244
244
  end
245
245
 
246
246
  # Inclusive ceiling on the worker pool when neither --count nor --workers
247
- # is passed. Explicit CLI counts always win. Two main uses:
247
+ # is passed. Explicit CLI counts always win. Accepts a positive integer
248
+ # (absolute ceiling) or a negative integer (relative offset subtracted from
249
+ # the default available processor count, clamped to a minimum of 1).
250
+ # Three main uses:
248
251
  #
249
252
  # 1. Outer orchestrators (kettle-family) budgeting a machine-wide process
250
253
  # pool across concurrent family jobs.
@@ -253,16 +256,19 @@ module TurboTests
253
256
  # the pool (typically 2) AND the per-worker heap (e.g. JRUBY_OPTS=
254
257
  # "-J-Xmx1280m") to stay under runner RAM. See README
255
258
  # "Resource-Constrained CI (JVM Engines)".
259
+ # 3. Local development, leaving N cores free for the machine (e.g.
260
+ # TURBO_TESTS2_MAX_PROCESSES=-2 uses available CPUs - 2, at least 1).
256
261
  def max_processes_from_environment
257
262
  value = ENV.fetch("TURBO_TESTS2_MAX_PROCESSES", "").strip
258
263
  return if value.empty?
259
264
 
260
265
  count = Integer(value, 10)
261
266
  return count if count.positive?
267
+ return [RuntimeGroups.process_count + count, 1].max if count.negative?
262
268
 
263
- raise OptionParser::InvalidArgument, "invalid TURBO_TESTS2_MAX_PROCESSES #{value.inspect}; expected a positive integer"
269
+ raise ArgumentError
264
270
  rescue ArgumentError
265
- raise OptionParser::InvalidArgument, "invalid TURBO_TESTS2_MAX_PROCESSES #{value.inspect}; expected a positive integer"
271
+ raise OptionParser::InvalidArgument, "invalid TURBO_TESTS2_MAX_PROCESSES #{value.inspect}; expected a non-zero integer"
266
272
  end
267
273
 
268
274
  def parse_parallel_args(args, parallel_options)
@@ -4,6 +4,7 @@ require "json"
4
4
  require "timeout"
5
5
  require "fileutils"
6
6
  require "runtime_groups"
7
+ require "kettle/ndjson"
7
8
  require "rspec/core"
8
9
  require "shellwords"
9
10
  require "tempfile"
@@ -250,6 +251,7 @@ module TurboTests
250
251
  @nice = opts[:nice]
251
252
  @use_runtime_info = opts[:use_runtime_info]
252
253
 
254
+ @progress = Kettle::Ndjson::TestProgress.from_env(io: $stdout, source: "turbo_tests2")
253
255
  @load_time = 0
254
256
  @load_count = 0
255
257
  @failure_count = 0
@@ -977,6 +979,7 @@ module TurboTests
977
979
  when "example_passed"
978
980
  example = FakeExample.from_obj(message[:example])
979
981
  @reporter.example_passed(example)
982
+ @progress&.record(:passed)
980
983
  when "group_started"
981
984
  @reporter.group_started(message[:group].to_struct)
982
985
  when "group_finished"
@@ -984,6 +987,7 @@ module TurboTests
984
987
  when "example_pending"
985
988
  example = FakeExample.from_obj(message[:example])
986
989
  @reporter.example_pending(example)
990
+ @progress&.record(:pending)
987
991
  when "load_summary"
988
992
  message = message[:summary]
989
993
  # NOTE: notifications order and content is not guaranteed hence the fetch
@@ -992,6 +996,11 @@ module TurboTests
992
996
  when "example_failed"
993
997
  example = FakeExample.from_obj(message[:example])
994
998
  @reporter.example_failed(example)
999
+ @progress&.record(
1000
+ :failed,
1001
+ location: message[:example][:location],
1002
+ description: message[:example][:full_description]
1003
+ )
995
1004
  @failure_count += 1
996
1005
  if fail_fast_met
997
1006
  report_unfinished_groups("Groups stopped by fail-fast")
@@ -1032,6 +1041,7 @@ module TurboTests
1032
1041
  $stdout.flush
1033
1042
  end
1034
1043
 
1044
+ @progress&.finish
1035
1045
  flush_deferred_run_options_messages
1036
1046
  rescue Interrupt
1037
1047
  end
@@ -4,7 +4,7 @@ module TurboTests
4
4
  # Version namespace for this gem.
5
5
  module Version
6
6
  # Current gem version.
7
- VERSION = "4.0.1"
7
+ VERSION = "4.0.3"
8
8
  end
9
9
  # Current gem version exposed at the traditional constant location.
10
10
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file