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 +4 -4
- data/.rubocop.yml +3 -19
- data/lib/minitest/distributed/configuration.rb +3 -3
- data/lib/minitest/distributed/coordinators/redis_coordinator.rb +2 -2
- data/lib/minitest/distributed/result_type.rb +2 -0
- data/lib/minitest/distributed/version.rb +1 -1
- data/lib/minitest/distributed_plugin.rb +13 -7
- data/minitest-distributed.gemspec +1 -1
- data/sorbet/rbi/rails.rbi +4 -0
- data/sorbet/rbi/winsize.rbi +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfef30635f4dd487b913e94e04a1098f27d27278af1f1adbb794a1f91f54e880
|
4
|
+
data.tar.gz: cff09c3e45440e77a7f39dabcdc6faf3a99336cc05362ea1740c810c91bb227b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9a05e26c4b0a432d3b7c2d8aec342d141b0fc5b4a1b7a355b6e5e14609a85e834c60fde5d6bf32a85529d9678c0ce19e2a8e9feb1d6da49c761b77289c340b0
|
7
|
+
data.tar.gz: 430c1c0da35af7e4db05580676de9ae4d911ecb0673d99535b07c00a72f600dd71e3e279a127e254bba2be13352579d1867ff376edaf1b91fd241b5b6da0b408
|
data/.rubocop.yml
CHANGED
@@ -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 =
|
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:
|
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,
|
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}
|
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.
|
@@ -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 =
|
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
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
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
|
data/sorbet/rbi/winsize.rbi
CHANGED
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.
|
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-
|
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.
|
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.
|
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
|