rspec-abq 1.0.1 → 1.0.3

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: 1b166fd4c2ba3722370ca2dad745e0d5e5267de565934dfe5091012b86a41a9b
4
- data.tar.gz: 4d493113ceefa919ad5429fbf290373def78fa3eeea9bcc20e13d7c49f17f96c
3
+ metadata.gz: bc4f520d1b869e03a972436e4b3eeddb42ce1c3a88db2b944e7ce8d654ac6c25
4
+ data.tar.gz: 8608c3bc156d2789596d3b8606aa7d5a164ddbefce1d58ca1243dddf9a006bb6
5
5
  SHA512:
6
- metadata.gz: a50ab4b5fdd2e94bcaac06f3947d4ae3116f0182a54e107db90b99c3abb51a24545d063af4ab9b1397c20d3a9df66da14dbb65bed695cd252227180efd866827
7
- data.tar.gz: 4d1ad622e266f237285fc18e26b0ad7dc96de1902cb85051555643c26abb6fc8461551a5f834b49f21d3fcf7c7433a2d82ee539a4bf67ef99ab7e9f8b77ac8a4
6
+ metadata.gz: ac6d181459d36293e661b141f2c0a685ed9a40feb70a877f0fb9b645ba58e4e1d73397c7e1c264545709df3ef610ee42170cf4b1a703d05dc0f50c53f919bb33
7
+ data.tar.gz: fc5e6cc4d5435fd27552de89b6bfd1cf0a59a077b5f571c20c44788638dbcfb8a9e5cc449338b87a10dc9ccf5b9b8f5b25efb031e16f36d7d8c9de8e887a1203
data/README.md CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  And then execute:
18
18
 
19
- ```
19
+ ```bash
20
20
  bundle
21
21
  ```
22
22
 
@@ -24,10 +24,16 @@ bundle
24
24
 
25
25
  Use the included binary with abq:
26
26
 
27
- ```
27
+ ```bash
28
28
  abq test -- bundle exec rspec
29
29
  ```
30
30
 
31
+ If abq displays "Worker quit before sending protocol version", try adding this line to your application's `spec/spec_helper.rb`:
32
+
33
+ ```ruby
34
+ require 'rspec/abq'
35
+ ```
36
+
31
37
  ## Compatibility
32
38
 
33
39
  This gem is actively tested against rubies 2.6-3.1 and rspecs 3.5-3.12
@@ -125,7 +125,16 @@ module RSpec
125
125
  end
126
126
  end
127
127
 
128
- exit_code(examples_passed)
128
+ if Abq.target_test_case != Abq::TestCase.end_marker
129
+ warn "Hit end of test run without being on end marker. Target test case is #{Abq.target_test_case.inspect}"
130
+ example_passed = false
131
+ end
132
+
133
+ if Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new("3.10.0")
134
+ exit_code(examples_passed)
135
+ else
136
+ example_passed ? 0 : @configuration.failure_exit_code
137
+ end
129
138
  end
130
139
 
131
140
  private
@@ -37,7 +37,7 @@ module RSpec
37
37
  # @param outer [Array<String>] parsed scope
38
38
  # @param inner [Array<String>] parsed scope
39
39
  def self.scope_leftover(outer, inner)
40
- inner[outer.length..-1] || []
40
+ inner[outer.length..] || []
41
41
  end
42
42
 
43
43
  # @param group [RSpec::Core::ExampleGroup]
@@ -1,6 +1,6 @@
1
1
  module RSpec
2
2
  module Abq
3
3
  # current version!
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.3"
5
5
  end
6
6
  end
data/lib/rspec/abq.rb CHANGED
@@ -29,14 +29,35 @@ module RSpec
29
29
  ABQ_RSPEC_PID = "ABQ_RSPEC_PID"
30
30
 
31
31
  # The [ABQ protocol version message](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#8587ee4fd01e41ec880dcbe212562172).
32
- # Must be sent to ABQ_SOCKET on startup.
33
32
  # @!visibility private
34
- PROTOCOL_VERSION_MESSAGE = {
33
+ PROTOCOL_VERSION = {
35
34
  type: "abq_protocol_version",
36
35
  major: 0,
37
36
  minor: 1
38
37
  }
39
38
 
39
+ # The [rspec-abq specification](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#8587ee4fd01e41ec880dcbe212562172).
40
+ # @!visibility private
41
+ NATIVE_RUNNER_SPECIFICATION = {
42
+ type: "abq_native_runner_specification",
43
+ name: "rspec-abq",
44
+ version: RSpec::Abq::VERSION,
45
+ test_framework: "rspec",
46
+ test_framework_version: RSpec::Core::Version::STRING,
47
+ language: RUBY_ENGINE,
48
+ language_version: "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}",
49
+ host: RUBY_DESCRIPTION
50
+ }
51
+
52
+ # The [rpsec-abq spawned message](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#8587ee4fd01e41ec880dcbe212562172).
53
+ # Must be sent to ABQ_SOCKET on startup.
54
+ # @!visibility private
55
+ NATIVE_RUNNER_SPAWNED_MESSAGE = {
56
+ type: "abq_native_runner_spawned",
57
+ protocol_version: PROTOCOL_VERSION,
58
+ runner_specification: NATIVE_RUNNER_SPECIFICATION
59
+ }
60
+
40
61
  # The [ABQ initialization success
41
62
  # message](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#538582a3049f4934a5cb563d815c1247)
42
63
  # Must be sent after receiving the ABQ initialization message.
@@ -85,14 +106,6 @@ module RSpec
85
106
  # before abq can start workers, it asks for a manifest
86
107
  if !!ENV[ABQ_GENERATE_MANIFEST] # the abq worker will set this env var if it needs a manifest
87
108
  RSpec::Abq::Manifest.write_manifest(RSpec.world.ordered_example_groups, RSpec.configuration.seed, RSpec.configuration.ordering_registry)
88
- # ... Maybe it's fine to just exit(0)
89
- if Gem::Version.new(RSpec::Core::Version::STRING) >= Gem::Version.new("3.10.0")
90
- RSpec.world.wants_to_quit = true # ask rspec to exit
91
- RSpec.configuration.error_exit_code = 0
92
- RSpec.world.non_example_failure = true # exit has nothing to do with tests
93
- else
94
- exit(0)
95
- end
96
109
  return true
97
110
  end
98
111
 
@@ -113,10 +126,10 @@ module RSpec
113
126
  init_message = protocol_read
114
127
  protocol_write(INIT_SUCCESS_MESSAGE)
115
128
  # TODO: delete the check for empty init_meta when https://github.com/rwx-research/abq/pull/216 is merged
116
- unless init_message["fast_exit"]
117
- Ordering.setup!(init_message["init_meta"], RSpec.configuration)
118
- fetch_next_example
119
- end
129
+ return true if init_message["fast_exit"]
130
+
131
+ Ordering.setup!(init_message["init_meta"], RSpec.configuration)
132
+ fetch_next_example
120
133
  nil
121
134
  end
122
135
 
@@ -127,7 +140,7 @@ module RSpec
127
140
  # Messages sent to/received from the ABQ worker should be done so ASAP.
128
141
  # Since we're on a local network, we don't care about packet reduction here.
129
142
  socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
130
- protocol_write(PROTOCOL_VERSION_MESSAGE, socket)
143
+ protocol_write(NATIVE_RUNNER_SPAWNED_MESSAGE, socket)
131
144
  end
132
145
  end
133
146
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-abq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayaz Hafiz
@@ -31,6 +31,20 @@ dependencies:
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.13.0
34
+ - !ruby/object:Gem::Dependency
35
+ name: pry
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.14.1
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.14.1
34
48
  description: RSpec::Abq is an rspec plugin that replaces its ordering with one that
35
49
  is controlled by abq. It allows for parallelization of rspec on a single machine
36
50
  or across multiple workers.