rspec-abq 1.0.0 → 1.0.2

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: c8480f9deacbbe6a9a52019f2a2493e66c9f952a5fce0af85ef1fe942118eb2e
4
- data.tar.gz: c3f02272646ac9624c07221cd98e2264d9057caa4138309ada3df3f4913bd75a
3
+ metadata.gz: 47cb306f3ccae9028f66868c94bad15520483ba37a240b91a15c95799c004eea
4
+ data.tar.gz: 9f9b96ff40ddb02f1d545e4c8f0032b436f099c90e8fc2dc779df79b11e7e8c3
5
5
  SHA512:
6
- metadata.gz: c682346cef98977257270d64cdf94705d5d5519665d2b0e8c37769597b58a01c918748dd50975a59200f54df42d82f575a680be1961afec5b2d9ee0f67677d00
7
- data.tar.gz: 48f99ff65d5451e08d21e202f10a91dc3efc9cf93c40a0bf52839fd8802e7100f72d30f16feabd82c3d0341b64373b8215089966959698e8d17a7d1dea22d1d7
6
+ metadata.gz: 5600f59bdb6bf10da3676b3333218d06138df69fd98c6b46b4f63cd6582d7ba41b41513482697279b49844799db3efede34156836f5a30f276f1d1021ec70642
7
+ data.tar.gz: fbe86282d566d1db465018261ce241aa2a24c70109fd0878cb33a70814d89f1898c7255cd0ed71e6e83eb6d9fdb6eeceb8d8652a64bc2a841cf44155506080fb
@@ -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.0"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  end
data/lib/rspec/abq.rb CHANGED
@@ -29,14 +29,30 @@ 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
+ }
46
+
47
+ # The [rpsec-abq spawned message](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#8587ee4fd01e41ec880dcbe212562172).
48
+ # Must be sent to ABQ_SOCKET on startup.
49
+ # @!visibility private
50
+ NATIVE_RUNNER_SPAWNED_MESSAGE = {
51
+ type: "abq_native_runner_spawned",
52
+ protocol_version: PROTOCOL_VERSION,
53
+ runner_specification: NATIVE_RUNNER_SPECIFICATION
54
+ }
55
+
40
56
  # The [ABQ initialization success
41
57
  # message](https://www.notion.so/rwx/ABQ-Worker-Native-Test-Runner-IPC-Interface-0959f5a9144741d798ac122566a3d887#538582a3049f4934a5cb563d815c1247)
42
58
  # Must be sent after receiving the ABQ initialization message.
@@ -113,10 +129,10 @@ module RSpec
113
129
  init_message = protocol_read
114
130
  protocol_write(INIT_SUCCESS_MESSAGE)
115
131
  # 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
132
+ return true if init_message["fast_exit"]
133
+
134
+ Ordering.setup!(init_message["init_meta"], RSpec.configuration)
135
+ fetch_next_example
120
136
  nil
121
137
  end
122
138
 
@@ -124,7 +140,10 @@ module RSpec
124
140
  # @!visibility private
125
141
  def self.socket
126
142
  @socket ||= TCPSocket.new(*ENV[ABQ_SOCKET].split(":")).tap do |socket|
127
- protocol_write(PROTOCOL_VERSION_MESSAGE, socket)
143
+ # Messages sent to/received from the ABQ worker should be done so ASAP.
144
+ # Since we're on a local network, we don't care about packet reduction here.
145
+ socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
146
+ protocol_write(NATIVE_RUNNER_SPAWNED_MESSAGE, socket)
128
147
  end
129
148
  end
130
149
 
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.0
4
+ version: 1.0.2
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.