minitest-distributed 0.1.1 → 0.1.2

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: 655c323406da3624b5c1a9aa6fb61fdb9b65816e4c440f08b03c7f6c90020082
4
- data.tar.gz: 0f1decd1f9c88803ee9abf766111b8902c74327f0d2ad287189c5fe72ba46464
3
+ metadata.gz: bfef30635f4dd487b913e94e04a1098f27d27278af1f1adbb794a1f91f54e880
4
+ data.tar.gz: cff09c3e45440e77a7f39dabcdc6faf3a99336cc05362ea1740c810c91bb227b
5
5
  SHA512:
6
- metadata.gz: 48ce33a0bc593730ee3ca28332ab831608cec1af4ab6c28bed0c6bf05dec625817cf595f59961afe683c184fd8ce7f0933c1e392ebb5c099329998494bc76bda
7
- data.tar.gz: fdea9c05ec72f5022be1d1a2c8a0a98da4f147624992ddb5ce8f5511da2f3f1a521110b3c126073370da2a1e570100cbd873d106c3d32af7dd430ae4380f9001
6
+ metadata.gz: b9a05e26c4b0a432d3b7c2d8aec342d141b0fc5b4a1b7a355b6e5e14609a85e834c60fde5d6bf32a85529d9678c0ce19e2a8e9feb1d6da49c761b77289c340b0
7
+ data.tar.gz: 430c1c0da35af7e4db05580676de9ae4d911ecb0673d99535b07c00a72f600dd71e3e279a127e254bba2be13352579d1867ff376edaf1b91fd241b5b6da0b408
@@ -11,25 +11,6 @@ AllCops:
11
11
  Exclude:
12
12
  - minitest-distributed.gemspec
13
13
 
14
- Style/MethodCallWithArgsParentheses:
15
- IgnoredMethods:
16
- - require
17
- - require_relative
18
- - raise
19
- - assert
20
- - refute
21
- - assert_equal
22
- - refute_equal
23
- - assert_nil
24
- - refute_nil
25
- - assert_predicate
26
- - refute_predicate
27
- - assert_empty
28
- - refute_empty
29
- - assert_includes
30
- - refute_includes
31
- - flunk
32
-
33
14
  ##### Sorbet cops
34
15
 
35
16
  Sorbet:
@@ -44,6 +25,9 @@ Sorbet:
44
25
  Sorbet/ValidSigil:
45
26
  Enabled: true
46
27
 
28
+ Sorbet/FalseSigil:
29
+ Enabled: false
30
+
47
31
  Sorbet/TrueSigil:
48
32
  Enabled: true
49
33
 
@@ -9,7 +9,7 @@ module Minitest
9
9
  class Configuration < T::Struct
10
10
  DEFAULT_BATCH_SIZE = 10
11
11
  DEFAULT_MAX_ATTEMPTS = 3
12
- DEFAULT_TEST_TIMEOUT = 30_000 # milliseconds
12
+ DEFAULT_TEST_TIMEOUT = 30.0 # seconds
13
13
 
14
14
  class << self
15
15
  extend T::Sig
@@ -20,7 +20,7 @@ module Minitest
20
20
  coordinator_uri: URI(env['MINITEST_COORDINATOR'] || 'memory:'),
21
21
  run_id: env['MINITEST_RUN_ID'] || SecureRandom.uuid,
22
22
  worker_id: env['MINITEST_WORKER_ID'] || SecureRandom.uuid,
23
- test_timeout: Integer(env['MINITEST_TEST_TIMEOUT'] || DEFAULT_TEST_TIMEOUT),
23
+ test_timeout: Float(env['MINITEST_TEST_TIMEOUT'] || DEFAULT_TEST_TIMEOUT),
24
24
  test_batch_size: Integer(env['MINITEST_TEST_BATCH_SIZE'] || DEFAULT_BATCH_SIZE),
25
25
  max_attempts: Integer(env['MINITEST_MAX_ATTEMPTS'] || DEFAULT_MAX_ATTEMPTS),
26
26
  )
@@ -32,7 +32,7 @@ module Minitest
32
32
  prop :coordinator_uri, URI::Generic, default: URI('memory:')
33
33
  prop :run_id, String, factory: -> { SecureRandom.uuid }
34
34
  prop :worker_id, String, factory: -> { SecureRandom.uuid }
35
- prop :test_timeout, Integer, default: DEFAULT_TEST_TIMEOUT
35
+ prop :test_timeout, Float, default: DEFAULT_TEST_TIMEOUT
36
36
  prop :test_batch_size, Integer, default: DEFAULT_BATCH_SIZE
37
37
  prop :max_attempts, Integer, default: DEFAULT_MAX_ATTEMPTS
38
38
 
@@ -250,7 +250,7 @@ module Minitest
250
250
  # Every test is allowed to take test_timeout milliseconds. Because we process tests in
251
251
  # batches, they should never be pending for TEST_TIMEOUT * BATCH_SIZE milliseconds.
252
252
  # So, only try to claim messages older than that, with a bit of jitter.
253
- max_idle_time = configuration.test_timeout * configuration.test_batch_size
253
+ max_idle_time = Integer(configuration.test_timeout * configuration.test_batch_size * 1000)
254
254
  max_idle_time_with_jitter = max_idle_time * rand(1.0...1.2)
255
255
  to_claim = pending.each_with_object({}) do |message, hash|
256
256
  if message['elapsed'] > max_idle_time_with_jitter
@@ -291,7 +291,7 @@ module Minitest
291
291
  sig { params(er: EnqueuedRunnable).void }
292
292
  def mark_runnable_to_fail_immediately(er)
293
293
  assertion = Minitest::Assertion.new(<<~EOM.chomp)
294
- This test takes too long to run (> #{configuration.test_timeout}ms).
294
+ This test takes too long to run (> #{configuration.test_timeout}s).
295
295
 
296
296
  We have tried running this test #{configuration.max_attempts} on different workers, but every time the worker has not reported back a result within #{configuration.test_timeout}ms.
297
297
  Try to make the test faster, or increase the test timeout.
@@ -4,6 +4,8 @@
4
4
  module Minitest
5
5
  module Distributed
6
6
  class ResultType < T::Enum
7
+ extend T::Sig
8
+
7
9
  enums do
8
10
  Passed = new
9
11
  Failed = new
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Minitest
5
5
  module Distributed
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.2"
7
7
  end
8
8
  end
@@ -19,7 +19,7 @@ module Minitest
19
19
  end
20
20
 
21
21
  opts.on('--test-timeout=TIMEOUT', "The maximum run time for a single test in seconds") do |timeout|
22
- options[:distributed].test_timeout = Integer(timeout)
22
+ options[:distributed].test_timeout = Float(timeout)
23
23
  end
24
24
 
25
25
  opts.on('--max-attempts=ATTEMPTS', "The maximum number of attempts to run a test") do |attempts|
@@ -43,15 +43,21 @@ module Minitest
43
43
  return if options[:disable_distributed]
44
44
 
45
45
  Minitest.singleton_class.prepend(Minitest::Distributed::TestRunnerPatch)
46
+
47
+ remove_reporter(::Rails::TestUnitReporter) if defined?(::Rails::TestUnitReporter)
48
+ remove_reporter(Minitest::ProgressReporter)
49
+ remove_reporter(Minitest::SummaryReporter)
50
+
46
51
  options[:distributed].coordinator.register_reporters(reporter: reporter, options: options)
47
52
 
48
- if reporter.reporters.reject! { |reporter| reporter.is_a?(Minitest::ProgressReporter) }
49
- reporter << Minitest::Distributed::Reporters::DistributedPogressReporter.new(options[:io], options)
50
- end
53
+ reporter << Minitest::Distributed::Reporters::DistributedPogressReporter.new(options[:io], options)
54
+ reporter << Minitest::Distributed::Reporters::DistributedSummaryReporter.new(options[:io], options)
55
+ end
51
56
 
52
- if reporter.reporters.reject! { |reporter| reporter.is_a?(Minitest::SummaryReporter) }
53
- reporter << Minitest::Distributed::Reporters::DistributedSummaryReporter.new(options[:io], options)
54
- end
57
+ private
58
+
59
+ def remove_reporter(reporter_class)
60
+ reporter.reporters.reject! { |reporter| reporter.is_a?(reporter_class) }
55
61
  end
56
62
  end
57
63
  end
@@ -45,6 +45,6 @@ Gem::Specification.new do |spec|
45
45
  spec.require_paths = ["lib"]
46
46
 
47
47
  spec.add_dependency('minitest', '~> 5.12')
48
- spec.add_dependency('redis', '~> 4.1')
48
+ spec.add_dependency('redis', '~> 4.2')
49
49
  spec.add_dependency('sorbet-runtime')
50
50
  end
@@ -0,0 +1,4 @@
1
+ module Rails
2
+ class TestUnitReporter < Minitest::StatisticsReporter
3
+ end
4
+ end
@@ -1,3 +1,5 @@
1
+ # typed: strict
2
+
1
3
  class IO
2
4
  sig { returns([Integer, Integer]) }
3
5
  def winsize; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-distributed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-17 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.1'
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.1'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sorbet-runtime
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,7 @@ files:
109
109
  - minitest-distributed.gemspec
110
110
  - sorbet/config
111
111
  - sorbet/rbi/minitest.rbi
112
+ - sorbet/rbi/rails.rbi
112
113
  - sorbet/rbi/rbconfig.rbi
113
114
  - sorbet/rbi/redis.rbi
114
115
  - sorbet/rbi/winsize.rbi