minitest-distributed 0.2.8 → 0.2.9

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +16 -4
  3. data/Gemfile +1 -0
  4. data/docker-compose.yml +5 -0
  5. data/lib/minitest/distributed/configuration.rb +5 -0
  6. data/lib/minitest/distributed/reporters/test_order_reporter.rb +36 -0
  7. data/lib/minitest/distributed/test_selector.rb +11 -1
  8. data/lib/minitest/distributed/version.rb +1 -1
  9. data/lib/minitest/test_order_plugin.rb +21 -0
  10. data/minitest-distributed.gemspec +1 -1
  11. data/sorbet/config +1 -0
  12. data/sorbet/rbi/gems/ast.rbi +49 -0
  13. data/sorbet/rbi/gems/connection_pool.rbi +55 -0
  14. data/sorbet/rbi/gems/minitest-distributed.rbi +15 -0
  15. data/sorbet/rbi/gems/minitest.rbi +426 -0
  16. data/sorbet/rbi/gems/parallel.rbi +86 -0
  17. data/sorbet/rbi/gems/parser.rbi +1477 -0
  18. data/sorbet/rbi/gems/rainbow.rbi +122 -0
  19. data/sorbet/rbi/gems/rake.rbi +647 -0
  20. data/sorbet/rbi/gems/redis-client.rbi +311 -0
  21. data/sorbet/rbi/gems/redis.rbi +409 -0
  22. data/sorbet/rbi/gems/regexp_parser.rbi +984 -0
  23. data/sorbet/rbi/gems/rexml.rbi +599 -0
  24. data/sorbet/rbi/gems/rubocop-ast.rbi +1398 -0
  25. data/sorbet/rbi/gems/rubocop-minitest.rbi +406 -0
  26. data/sorbet/rbi/gems/rubocop-rake.rbi +85 -0
  27. data/sorbet/rbi/gems/rubocop-sorbet.rbi +218 -0
  28. data/sorbet/rbi/gems/rubocop.rbi +9351 -0
  29. data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
  30. data/sorbet/rbi/gems/toxiproxy.rbi +112 -0
  31. data/sorbet/rbi/gems/unicode-display_width.rbi +23 -0
  32. data/sorbet/rbi/minitest.rbi +5 -1
  33. data/sorbet/rbi/rails.rbi +1 -0
  34. data/sorbet/rbi/rbconfig.rbi +1 -1
  35. metadata +26 -5
  36. data/sorbet/rbi/redis.rbi +0 -106
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c348812d40ad3e74d8ec854264225eb4f444e3b4a8736c25272bade733a5affc
4
- data.tar.gz: 2be00ebffab4e0df5b71f29d22917fb69cad0177a77f676c5fc6b512147d9784
3
+ metadata.gz: 1dc9ad4333958d6197869544c8fd47f6bc0f6ccdb5fe2203fe4af1ed348164ed
4
+ data.tar.gz: fad3b8564ad602cf2209ebff92b1ddeef601f2ae3ccdfc94d67820e077a05943
5
5
  SHA512:
6
- metadata.gz: 1ae5332ea20d9cd9f8e9fbed8e3c111a653ea7684f98953cdd174cd34e287a8b453a9401eeafa8a9508c15b49a3ad1f36b236a4d075c2d50ad8fa14e9ada57ae
7
- data.tar.gz: 44461dbf7adfbde8dc6ae9736ee459a1fc1b9ca35ba36f07f592d0482b3be10ca705bd176902b9866e1e1aa39babea8f9f1108d9ab14af505a564111cb1b2cfe
6
+ metadata.gz: 833c450f354affcdab9f7d3939dd5ac5de52de2a586758cf46b8b21a60073712dca466d2847aa6a918eea2e68d8013e6d53dee1fc335fc7dcca97edca7785cce
7
+ data.tar.gz: 6d35405c22570d2c9c9628e35330ce2e198d77ec8610e88568d07e7b3d7453323872db88e7b99de11148e396e56487be3c98c540110127cbaaa53ab21307da0a
@@ -17,6 +17,8 @@ jobs:
17
17
  services:
18
18
  redis:
19
19
  image: redis
20
+ toxiproxy:
21
+ image: ghcr.io/shopify/toxiproxy:2.5.0
20
22
 
21
23
  steps:
22
24
  - uses: actions/checkout@v2
@@ -25,7 +27,8 @@ jobs:
25
27
  - name: Run tests
26
28
  run: bin/rake test
27
29
  env:
28
- REDIS_URL: redis://redis:6379
30
+ REDIS_URL: redis://toxiproxy:22220
31
+ TOXIPROXY_HOST: http://toxiproxy:8474
29
32
 
30
33
  test_31:
31
34
  runs-on: shopify-ubuntu-latest
@@ -34,6 +37,8 @@ jobs:
34
37
  services:
35
38
  redis:
36
39
  image: redis
40
+ toxiproxy:
41
+ image: ghcr.io/shopify/toxiproxy:2.5.0
37
42
 
38
43
  steps:
39
44
  - uses: actions/checkout@v2
@@ -42,7 +47,8 @@ jobs:
42
47
  - name: Run tests
43
48
  run: bin/rake test
44
49
  env:
45
- REDIS_URL: redis://redis:6379
50
+ REDIS_URL: redis://toxiproxy:22220
51
+ TOXIPROXY_HOST: http://toxiproxy:8474
46
52
 
47
53
  test_30:
48
54
  runs-on: shopify-ubuntu-latest
@@ -51,6 +57,8 @@ jobs:
51
57
  services:
52
58
  redis:
53
59
  image: redis
60
+ toxiproxy:
61
+ image: ghcr.io/shopify/toxiproxy:2.5.0
54
62
 
55
63
  steps:
56
64
  - uses: actions/checkout@v2
@@ -59,7 +67,8 @@ jobs:
59
67
  - name: Run tests
60
68
  run: bin/rake test
61
69
  env:
62
- REDIS_URL: redis://redis:6379
70
+ REDIS_URL: redis://toxiproxy:22220
71
+ TOXIPROXY_HOST: http://toxiproxy:8474
63
72
 
64
73
  test_27:
65
74
  runs-on: shopify-ubuntu-latest
@@ -68,6 +77,8 @@ jobs:
68
77
  services:
69
78
  redis:
70
79
  image: redis
80
+ toxiproxy:
81
+ image: ghcr.io/shopify/toxiproxy:2.5.0
71
82
 
72
83
  steps:
73
84
  - uses: actions/checkout@v2
@@ -76,7 +87,8 @@ jobs:
76
87
  - name: Run tests
77
88
  run: bin/rake test
78
89
  env:
79
- REDIS_URL: redis://redis:6379
90
+ REDIS_URL: redis://toxiproxy:22220
91
+ TOXIPROXY_HOST: http://toxiproxy:8474
80
92
 
81
93
  typecheck:
82
94
  runs-on: shopify-ubuntu-latest
data/Gemfile CHANGED
@@ -13,3 +13,4 @@ gem "rubocop-shopify"
13
13
  gem "rubocop-sorbet"
14
14
  gem "rubocop-minitest"
15
15
  gem "rubocop-rake"
16
+ gem "toxiproxy"
data/docker-compose.yml CHANGED
@@ -4,3 +4,8 @@ services:
4
4
  image: redis:latest
5
5
  ports:
6
6
  - "6379:6379"
7
+ toxi-proxy:
8
+ image: ghcr.io/shopify/toxiproxy:2.5.0
9
+ ports:
10
+ - "8474:8474"
11
+ - "22220:22220"
@@ -79,6 +79,10 @@ module Minitest
79
79
  configuration.include_file = file_path
80
80
  end
81
81
 
82
+ opts.on("--[no-]shuffle-suites", "Shuffle test suites as well") do |enabled|
83
+ configuration.shuffle_suites = enabled
84
+ end
85
+
82
86
  configuration
83
87
  end
84
88
  end
@@ -97,6 +101,7 @@ module Minitest
97
101
  prop :progress, T::Boolean, default: false
98
102
  prop :exclude_file, T.nilable(String)
99
103
  prop :include_file, T.nilable(String)
104
+ prop :shuffle_suites, T::Boolean, default: true
100
105
 
101
106
  sig { returns(Coordinators::CoordinatorInterface) }
102
107
  def coordinator
@@ -0,0 +1,36 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Minitest
5
+ module Distributed
6
+ module Reporters
7
+ class TestOrderReporter < Minitest::Reporter
8
+ extend T::Sig
9
+
10
+ sig { params(io: IO, options: T::Hash[Symbol, T.untyped]).void }
11
+ def initialize(io, options)
12
+ super
13
+ @path = T.let(options.fetch(:test_order_file), String)
14
+ @file = T.let(nil, T.nilable(File))
15
+ end
16
+
17
+ sig { void }
18
+ def start
19
+ @file = File.open(@path, "w+")
20
+ super
21
+ end
22
+
23
+ sig { override.params(klass: Class, name: String).void }
24
+ def prerecord(klass, name)
25
+ T.must(@file).puts("#{klass}##{name}")
26
+ T.must(@file).flush
27
+ end
28
+
29
+ sig { override.void }
30
+ def report
31
+ T.must(@file).close
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -36,11 +36,21 @@ module Minitest
36
36
 
37
37
  sig { returns(T::Array[Minitest::Runnable]) }
38
38
  def discover_tests
39
- Minitest::Runnable.runnables.flat_map do |runnable|
39
+ runnables.flat_map do |runnable|
40
40
  runnable.runnable_methods.map { |method_name| runnable.new(method_name) }
41
41
  end
42
42
  end
43
43
 
44
+ sig { returns(T::Array[T.class_of(Minitest::Runnable)]) }
45
+ def runnables
46
+ if options[:distributed].shuffle_suites
47
+ srand(Minitest.seed)
48
+ Minitest::Runnable.runnables.shuffle
49
+ else
50
+ Minitest::Runnable.runnables
51
+ end
52
+ end
53
+
44
54
  sig { params(tests: T::Array[Minitest::Runnable]).returns(T::Array[Minitest::Runnable]) }
45
55
  def select_tests(tests)
46
56
  return tests if filters.empty?
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Minitest
5
5
  module Distributed
6
- VERSION = "0.2.8"
6
+ VERSION = "0.2.9"
7
7
  end
8
8
  end
@@ -0,0 +1,21 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Minitest
5
+ class << self
6
+ def plugin_test_order_options(opts, options)
7
+ options[:test_order_file] = ENV["MINITEST_TEST_ORDER"]
8
+
9
+ opts.on("--test_order=PATH", "Log order of tests executed to provided file.") do |path|
10
+ options[:test_order_file] = path
11
+ end
12
+ end
13
+
14
+ def plugin_test_order_init(options)
15
+ return if options[:test_order_file].nil?
16
+
17
+ require_relative "distributed/reporters/test_order_reporter"
18
+ reporter << Minitest::Distributed::Reporters::TestOrderReporter.new(options[:io], options)
19
+ end
20
+ end
21
+ 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.2', '< 6')
48
+ spec.add_dependency('redis', '>= 5.0.6', '< 6')
49
49
  spec.add_dependency('sorbet-runtime')
50
50
  end
data/sorbet/config CHANGED
@@ -1,2 +1,3 @@
1
1
  --dir
2
2
  .
3
+ --ignore=vendor
@@ -0,0 +1,49 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi gems
3
+
4
+ # typed: strict
5
+ #
6
+ # If you would like to make changes to this file, great! Please create the gem's shim here:
7
+ #
8
+ # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/ast/all/ast.rbi
9
+ #
10
+ # ast-2.4.2
11
+
12
+ module AST
13
+ end
14
+ class AST::Node
15
+ def +(array); end
16
+ def <<(element); end
17
+ def ==(other); end
18
+ def append(element); end
19
+ def assign_properties(properties); end
20
+ def children; end
21
+ def clone; end
22
+ def concat(array); end
23
+ def deconstruct; end
24
+ def dup; end
25
+ def eql?(other); end
26
+ def fancy_type; end
27
+ def hash; end
28
+ def initialize(type, children = nil, properties = nil); end
29
+ def inspect(indent = nil); end
30
+ def original_dup; end
31
+ def to_a; end
32
+ def to_ast; end
33
+ def to_s(indent = nil); end
34
+ def to_sexp(indent = nil); end
35
+ def to_sexp_array; end
36
+ def type; end
37
+ def updated(type = nil, children = nil, properties = nil); end
38
+ end
39
+ class AST::Processor
40
+ include AST::Processor::Mixin
41
+ end
42
+ module AST::Processor::Mixin
43
+ def handler_missing(node); end
44
+ def process(node); end
45
+ def process_all(nodes); end
46
+ end
47
+ module AST::Sexp
48
+ def s(type, *children); end
49
+ end
@@ -0,0 +1,55 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi gems
3
+
4
+ # typed: strict
5
+ #
6
+ # If you would like to make changes to this file, great! Please create the gem's shim here:
7
+ #
8
+ # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/connection_pool/all/connection_pool.rbi
9
+ #
10
+ # connection_pool-2.3.0
11
+
12
+ class ConnectionPool
13
+ def available; end
14
+ def checkin; end
15
+ def checkout(options = nil); end
16
+ def initialize(options = nil, &block); end
17
+ def reload(&block); end
18
+ def self.wrap(options, &block); end
19
+ def shutdown(&block); end
20
+ def size; end
21
+ def then(options = nil); end
22
+ def with(options = nil); end
23
+ end
24
+ class ConnectionPool::TimedStack
25
+ def <<(obj, options = nil); end
26
+ def connection_stored?(options = nil); end
27
+ def current_time; end
28
+ def empty?; end
29
+ def fetch_connection(options = nil); end
30
+ def initialize(size = nil, &block); end
31
+ def length; end
32
+ def max; end
33
+ def pop(timeout = nil, options = nil); end
34
+ def push(obj, options = nil); end
35
+ def shutdown(reload: nil, &block); end
36
+ def shutdown_connections(options = nil); end
37
+ def store_connection(obj, options = nil); end
38
+ def try_create(options = nil); end
39
+ end
40
+ class ConnectionPool::Wrapper < BasicObject
41
+ def initialize(options = nil, &block); end
42
+ def method_missing(name, *args, **kwargs, &block); end
43
+ def pool_available; end
44
+ def pool_shutdown(&block); end
45
+ def pool_size; end
46
+ def respond_to?(id, *args); end
47
+ def with(&block); end
48
+ def wrapped_pool; end
49
+ end
50
+ class ConnectionPool::Error < RuntimeError
51
+ end
52
+ class ConnectionPool::PoolShuttingDownError < ConnectionPool::Error
53
+ end
54
+ class ConnectionPool::TimeoutError < Timeout::Error
55
+ end
@@ -0,0 +1,15 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi gems
3
+
4
+ # typed: strict
5
+ #
6
+ # If you would like to make changes to this file, great! Please create the gem's shim here:
7
+ #
8
+ # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/minitest-distributed/all/minitest-distributed.rbi
9
+ #
10
+ # minitest-distributed-0.2.8
11
+
12
+ module Minitest
13
+ def self.plugin_junitxml_init(options); end
14
+ def self.plugin_junitxml_options(opts, options); end
15
+ end