turbo_tests2 4.0.2 → 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,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.2"
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