minitest-distributed 0.2.11 → 0.2.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3755320df95c6d8e5ba5e32b04b44351043588d43c309d4d746cc36f96567132
4
- data.tar.gz: 785503f39eadcfab72b7fc3df6e8f19d3ad0fbaea793e68f9f233ed08c4f6452
3
+ metadata.gz: 722ec2cc00da4f9c5f5efc0591e39c2becc2338ce7fe171c60339d284116242b
4
+ data.tar.gz: aa1d3c52afa3b16c649a0b12d27e83ccb19ae11dd80fb68d3e57a669e0a081e5
5
5
  SHA512:
6
- metadata.gz: fd42edc7fd402f38c08f22ff17fa8430b65cae6d1c53b27afa55446ab5cb6e90f0c0d8a92c6fa7a7665d7aba4a81768a52d9a5c1007da2ebf6407414c2538510
7
- data.tar.gz: e3b5119c06eaec10a7f8befacec8b3fde636e17eb9c8a4b539ae4aedf95d00217a97911ccf067e14f08850e1dbc3a6d072723811b565ea06aff46be8fb2607ae
6
+ metadata.gz: c2cfc291aeb202bb680b04a6e579272fd907efe47ef1d5e5ea2b66ca5ffe23967ded9ea38458e485e1e9b42609d84a2058fd2df3250217cf76a60272f3b3255c
7
+ data.tar.gz: cb0934c54f7c3bdcc76abe8c0593b08e2e7ddfacd9cf2c4e7ce3a71e586b2e75170be91ebe3ac8b520fb7c8c7e4e961ae4a9a218c582bf1301dc916f41427847
data/dev.yml CHANGED
@@ -5,3 +5,4 @@ type: ruby
5
5
  up:
6
6
  - ruby
7
7
  - bundler
8
+ - redis
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "redis"
5
5
  require "set"
6
+ require "logger"
6
7
 
7
8
  module Minitest
8
9
  module Distributed
@@ -268,7 +269,25 @@ module Minitest
268
269
 
269
270
  sig { returns(Redis) }
270
271
  def redis
271
- @redis ||= Redis.new(url: configuration.coordinator_uri.to_s)
272
+ @redis ||= Redis.new(
273
+ url: configuration.coordinator_uri.to_s,
274
+ middlewares: custom_middlewares,
275
+ custom: custom_config,
276
+ timeout: 2,
277
+ )
278
+ end
279
+
280
+ sig { returns(T.nilable(T::Array[Module])) }
281
+ def custom_middlewares
282
+ return unless ENV.key?("MINITEST_DISTRIBUTED_REDIS_LOG")
283
+
284
+ require_relative "redis_instrumentation_middleware"
285
+ [RedisInstrumentationMiddleware]
286
+ end
287
+
288
+ sig { returns(T.nilable(T::Hash[Symbol, File])) }
289
+ def custom_config
290
+ { log_file: logger }.compact
272
291
  end
273
292
 
274
293
  sig { returns(String) }
@@ -517,6 +536,13 @@ module Minitest
517
536
  adjust_combined_results(batch_result_aggregate)
518
537
  end
519
538
 
539
+ sig { returns(T.nilable(Logger)) }
540
+ def logger
541
+ return unless (log_path = ENV["MINITEST_DISTRIBUTED_REDIS_LOG"])
542
+
543
+ @logger ||= T.let(Logger.new(log_path), T.nilable(Logger))
544
+ end
545
+
520
546
  INITIAL_BACKOFF = 10 # milliseconds
521
547
  private_constant :INITIAL_BACKOFF
522
548
  end
@@ -0,0 +1,39 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "redis"
5
+
6
+ module Minitest
7
+ module Distributed
8
+ module Coordinators
9
+ # Redis middleware that logs all Redis commands to a file for debugging.
10
+ module RedisInstrumentationMiddleware
11
+ extend T::Sig
12
+
13
+ sig { params(command: T::Array[T.untyped], redis_config: T.untyped).returns(T.untyped) }
14
+ def call(command, redis_config)
15
+ log_file = redis_config.custom[:log_file]
16
+ log_file.info("EXEC: #{command.inspect}")
17
+ result = super
18
+ log_file.info("RESULT: #{result.inspect}")
19
+ result
20
+ rescue => e
21
+ log_file.info("ERROR: #{e.class}")
22
+ Kernel.raise
23
+ end
24
+
25
+ sig { params(commands: T::Array[T.untyped], redis_config: T.untyped).returns(T.untyped) }
26
+ def call_pipelined(commands, redis_config)
27
+ log_file = redis_config.custom[:log_file]
28
+ log_file.info("EXEC PIPELINED: #{commands.inspect}")
29
+ result = super
30
+ log_file.info("RESULT PIPELINED: #{result.inspect}")
31
+ result
32
+ rescue => e
33
+ log_file.info("ERROR PIPELINED: #{e.class}")
34
+ Kernel.raise
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Minitest
5
5
  module Distributed
6
- VERSION = "0.2.11"
6
+ VERSION = "0.2.12"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-distributed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -116,6 +115,7 @@ files:
116
115
  - lib/minitest/distributed/coordinators/coordinator_interface.rb
117
116
  - lib/minitest/distributed/coordinators/memory_coordinator.rb
118
117
  - lib/minitest/distributed/coordinators/redis_coordinator.rb
118
+ - lib/minitest/distributed/coordinators/redis_instrumentation_middleware.rb
119
119
  - lib/minitest/distributed/enqueued_runnable.rb
120
120
  - lib/minitest/distributed/filters/exclude_file_filter.rb
121
121
  - lib/minitest/distributed/filters/exclude_filter.rb
@@ -169,7 +169,6 @@ metadata:
169
169
  allowed_push_host: https://rubygems.org
170
170
  homepage_uri: https://github.com/Shopify/minitest-distributed
171
171
  source_code_uri: https://github.com/Shopify/minitest-distributed
172
- post_install_message:
173
172
  rdoc_options: []
174
173
  require_paths:
175
174
  - lib
@@ -184,8 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
183
  - !ruby/object:Gem::Version
185
184
  version: '0'
186
185
  requirements: []
187
- rubygems_version: 3.5.18
188
- signing_key:
186
+ rubygems_version: 3.7.2
189
187
  specification_version: 4
190
188
  summary: Distributed test executor plugin for Minitest
191
189
  test_files: []