flatware 2.1.0 → 2.2.1

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: be982f16b4df388c97477397adb054108e1d5f9ffc15340a699af012558c2b0f
4
- data.tar.gz: e83100e4ac368304b484e6cf5f72bc6cc5a0a572463e0393d9b3e09275a01b9c
3
+ metadata.gz: 278612d774eb619a0548544e33650c8f73b4fa1b88de900027aba730a46c51bd
4
+ data.tar.gz: a1ac3e33ff822f2cac88fe24914d1034bffd40872ca0e10791e8019a60f64d68
5
5
  SHA512:
6
- metadata.gz: 64d1c4b1cbf137706e6b88d4701963f855f8caf177ea94b9e113bf27a2326fb55aa6dacfc93cc6b6e5777207249b50185b64c589ad313f33a03f3641b1a52ed9
7
- data.tar.gz: '0508df27695bbb2e91d9f8ddde1f88d8bb97028b9c5f873cd902622f6631cb5f138bb69f045a59c9c0025c2e86aa3852302effa0061658bfa98e933a451356fc'
6
+ metadata.gz: 48e11bc65e1e0423567b21175a313766aeb1949aa3f7f168e005c3657f9a189da5003aea4c8f50230969875dc6363fe5e8eacebb0c594d4fdea28c3775082791
7
+ data.tar.gz: 1f6abcc7d6b8d1e29e8c588e27dd077b8af754fb7c3b057f648d595974591c5069f147fe6b3f43768655add6553a090b240312180773f58db5d0b23f74e76cdc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Flatware [![Code Climate][code-climate-badge]][code-climate]
2
2
 
3
- [code-climate-badge]: https://codeclimate.com/github/briandunn/flatware.png
3
+ [code-climate-badge]: https://codeclimate.com/github/briandunn/flatware.svg
4
4
  [code-climate]: https://codeclimate.com/github/briandunn/flatware
5
5
 
6
6
  Flatware parallelizes your test suite to significantly reduce test time.
@@ -106,6 +106,11 @@ Flatware has a couple lifecycle callbacks that you can use to avoid booting your
106
106
  over again on every core. One way to take advantage of this via a `spec/flatware_helper.rb` file like so:
107
107
 
108
108
  ```ruby
109
+ ##
110
+ # uncomment if you get a segmentation fault from the "pg" gem
111
+ # @see https://github.com/ged/ruby-pg/issues/311#issuecomment-1609970533
112
+ # ENV["PGGSSENCMODE"] = "disable"
113
+
109
114
  Flatware.configure do |conf|
110
115
  conf.before_fork do
111
116
  require 'rails_helper'
@@ -114,6 +119,11 @@ Flatware.configure do |conf|
114
119
  end
115
120
 
116
121
  conf.after_fork do |test_env_number|
122
+ ##
123
+ # uncomment if you're using SimpleCov and have started it in `rails_helper` as suggested here:
124
+ # @see https://github.com/simplecov-ruby/simplecov/tree/main?tab=readme-ov-file#use-it-with-any-framework
125
+ # SimpleCov.at_fork.call(test_env_number)
126
+
117
127
  config = ActiveRecord::Base.connection_db_config.configuration_hash
118
128
 
119
129
  ActiveRecord::Base.establish_connection(
@@ -126,6 +136,15 @@ end
126
136
  ```
127
137
  Now when I run `bundle exec flatware rspec -r ./spec/flatware_helper` My app only boots once, rather than once per core.
128
138
 
139
+ ## SimpleCov
140
+
141
+ If you're using SimpleCov, follow [their directions](https://github.com/simplecov-ruby/simplecov/tree/main?tab=readme-ov-file#use-it-with-any-framework) to install. When you have it working as desired for serial runs, add
142
+ `SimpleCov.at_fork.call(test_env_number)` to flatware's `after_fork` hook. You should now get the same coverage stats from parallel and serial runs.
143
+
144
+ ## Segmentation faults in the PG gem
145
+
146
+ If you get a segmentation fault on start you may need to add `ENV["PGGSSENCMODE"] = "disable"` to the top of your flatware helper.
147
+
129
148
  ## Design Goals
130
149
 
131
150
  ### Maintainable
@@ -170,3 +189,10 @@ Do whatever you want. I'd love to help make sure Flatware meets your needs.
170
189
  [![Hashrocket logo](https://hashrocket.com/hashrocket_logo.svg)](https://hashrocket.com)
171
190
 
172
191
  Flatware is supported by the team at [Hashrocket](https://hashrocket.com), a multidisciplinary design & development consultancy. If you'd like to [work with us](https://hashrocket.com/contact-us/hire-us) or [join our team](https://hashrocket.com/contact-us/jobs), don't hesitate to get in touch.
192
+
193
+
194
+ # TODO:
195
+
196
+ possible simplecov fixes
197
+
198
+ 1. seems like we won't get the same results as serial rspec runs unless we start simplecov after fork. And if we do that, I think a process needs to claim to be the last one for simplecov to run the merge.
data/lib/flatware/cli.rb CHANGED
@@ -55,7 +55,8 @@ module Flatware
55
55
 
56
56
  def start_sink(jobs:, workers:, formatter:)
57
57
  $0 = 'flatware sink'
58
- Process.setpgrp
58
+ try_setpgrp
59
+
59
60
  passed = Sink.start_server(
60
61
  jobs: jobs,
61
62
  formatter: Flatware::Broadcaster.new([formatter]),
@@ -65,6 +66,12 @@ module Flatware
65
66
  exit passed ? 0 : 1
66
67
  end
67
68
 
69
+ def try_setpgrp
70
+ Process.setpgrp
71
+ rescue Errno::EPERM => e
72
+ Flatware.log 'continuing after: Process.setpgrp:', e.message
73
+ end
74
+
68
75
  def workers
69
76
  options[:workers]
70
77
  end
@@ -3,11 +3,11 @@ module Flatware
3
3
  attr_reader :class, :message, :cause
4
4
  attr_accessor :backtrace
5
5
 
6
- def initialize(klass, message, backtrace, cause = '')
6
+ def initialize(klass, message, backtrace, cause = nil)
7
7
  @class = serialized(klass)
8
8
  @message = message
9
9
  @backtrace = backtrace
10
- @cause = cause
10
+ @cause = cause && SerializedException.from(cause)
11
11
  end
12
12
 
13
13
  def self.from(exception)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flatware
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flatware
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -62,14 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
62
  version: '2.6'
63
63
  - - "<"
64
64
  - !ruby/object:Gem::Version
65
- version: '3.3'
65
+ version: '3.4'
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.3.7
72
+ rubygems_version: 3.4.1
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: A distributed rspec and cucumber runner