specwrk 0.15.6 → 0.15.8
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 +4 -4
- data/README.md +2 -2
- data/lib/specwrk/cli.rb +29 -0
- data/lib/specwrk/cli_reporter.rb +1 -1
- data/lib/specwrk/store.rb +6 -2
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/endpoints/base.rb +3 -3
- data/lib/specwrk/worker/executor.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a359bd88ba0482dad8bf78555ce9256e8dfa4f000d48f2e36579df34172a684
|
4
|
+
data.tar.gz: a41d177279abb2622d8778a14344ede5f8eac4cac83bbd99185e6302f956f6e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7faa3a2e27b1338fde5aa02b8ae29482b8203857bfb07a54d5c8ff751e73b051b1bc7c69e05bf1b58a8aa609e9de15b767d78a4002936b83d60f3c2f90f928b7
|
7
|
+
data.tar.gz: d6c167e28a11bcc0798074d4214430430cbdb6e34c8b1f1c5c9bed2c086251736c73aefcc984d5ae10ce47e4204d1d13a4b3119a68ed6e26f262ec657839ab4f
|
data/README.md
CHANGED
@@ -263,7 +263,7 @@ end
|
|
263
263
|
```
|
264
264
|
|
265
265
|
## Prior/other works
|
266
|
-
There are many prior works for running rspec tests across multiple processes. Most of them combine process output making failures hard to grok. Some are good at running tests locally, but not on CI, while others are
|
266
|
+
There are many prior works for running rspec tests across multiple processes. Most of them combine process output making failures hard to grok. Some are good at running tests locally, but not on CI, while others are inversely true. Others are comercial or impactical without making a purchase.
|
267
267
|
|
268
268
|
specwrk is different because it:
|
269
269
|
1. Puts your developer experience first. Easy execution. No messy outputs. Retries built in. Easy(er) debugging of flaky tests.
|
@@ -284,4 +284,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/dweste
|
|
284
284
|
|
285
285
|
## License
|
286
286
|
|
287
|
-
The gem is available as open source under the terms of the [
|
287
|
+
The gem is available as open source under the terms of the [LGPLv3 License](http://www.gnu.org/licenses/lgpl-3.0.html).
|
data/lib/specwrk/cli.rb
CHANGED
@@ -106,6 +106,16 @@ module Specwrk
|
|
106
106
|
ENV["SPECWRK_SRV_KEY"] = key
|
107
107
|
ENV["SPECWRK_SRV_GROUP_BY"] = group_by
|
108
108
|
end
|
109
|
+
|
110
|
+
def find_open_port
|
111
|
+
require "socket"
|
112
|
+
|
113
|
+
server = TCPServer.new("127.0.0.1", 0)
|
114
|
+
port = server.addr[1]
|
115
|
+
server.close
|
116
|
+
|
117
|
+
port
|
118
|
+
end
|
109
119
|
end
|
110
120
|
|
111
121
|
class Version < Dry::CLI::Command
|
@@ -207,6 +217,10 @@ module Specwrk
|
|
207
217
|
# nil this env var if it exists to prevent never-ending workers
|
208
218
|
ENV["SPECWRK_SRV_URI"] = nil
|
209
219
|
|
220
|
+
# Start on a random open port to not conflict with another server
|
221
|
+
ENV["SPECWRK_SRV_PORT"] = find_open_port.to_s
|
222
|
+
ENV["SPECWRK_SRV_URI"] = "http://localhost:#{ENV.fetch("SPECWRK_SRV_PORT", "5138")}"
|
223
|
+
|
210
224
|
web_pid = Process.fork do
|
211
225
|
require "specwrk/web"
|
212
226
|
require "specwrk/web/app"
|
@@ -273,6 +287,11 @@ module Specwrk
|
|
273
287
|
|
274
288
|
# nil this env var if it exists to prevent never-ending workers
|
275
289
|
ENV["SPECWRK_SRV_URI"] = nil
|
290
|
+
|
291
|
+
# Start on a random open port to not conflict with another server
|
292
|
+
ENV["SPECWRK_SRV_PORT"] = find_open_port.to_s
|
293
|
+
ENV["SPECWRK_SRV_URI"] = "http://localhost:#{ENV.fetch("SPECWRK_SRV_PORT", "5138")}"
|
294
|
+
|
276
295
|
ENV["SPECWRK_SEED_WAITS"] = "0"
|
277
296
|
ENV["SPECWRK_MAX_BUCKET_SIZE"] = "1"
|
278
297
|
ENV["SPECWRK_COUNT"] = count.to_s
|
@@ -428,6 +447,16 @@ module Specwrk
|
|
428
447
|
def worker_count
|
429
448
|
@worker_count ||= [1, ENV["SPECWRK_COUNT"].to_i].max
|
430
449
|
end
|
450
|
+
|
451
|
+
def find_open_port
|
452
|
+
require "socket"
|
453
|
+
|
454
|
+
server = TCPServer.new("127.0.0.1", 0)
|
455
|
+
port = server.addr[1]
|
456
|
+
server.close
|
457
|
+
|
458
|
+
port
|
459
|
+
end
|
431
460
|
end
|
432
461
|
|
433
462
|
register "version", Version, aliases: ["v", "-v", "--version"]
|
data/lib/specwrk/cli_reporter.rb
CHANGED
data/lib/specwrk/store.rb
CHANGED
@@ -20,8 +20,12 @@ module Specwrk
|
|
20
20
|
|
21
21
|
FileAdapter
|
22
22
|
when /redis/
|
23
|
-
|
24
|
-
|
23
|
+
begin
|
24
|
+
require "specwrk/store/redis_adapter" unless defined?(RedisAdapter)
|
25
|
+
rescue LoadError
|
26
|
+
warn "Unable use RedisAdapter with #{uri}, gem not found. Add `gem 'specwrk-store-redis_adapter'` to your Gemfile and bundle install."
|
27
|
+
exit(1)
|
28
|
+
end
|
25
29
|
|
26
30
|
RedisAdapter
|
27
31
|
end
|
data/lib/specwrk/version.rb
CHANGED
@@ -15,12 +15,12 @@ module Specwrk
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def response
|
18
|
-
before_lock
|
19
|
-
|
20
18
|
return with_response unless run_id # No run_id, no datastore usage in the endpoint
|
21
19
|
|
22
20
|
payload # parse the payload before any locking
|
23
21
|
|
22
|
+
before_lock
|
23
|
+
|
24
24
|
worker[:first_seen_at] ||= Time.now.iso8601
|
25
25
|
worker[:last_seen_at] = Time.now.iso8601
|
26
26
|
|
@@ -119,7 +119,7 @@ module Specwrk
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def with_lock
|
122
|
-
Store.with_lock(URI(ENV.fetch("SPECWRK_SRV_STORE_URI", "memory:///")),
|
122
|
+
Store.with_lock(URI(ENV.fetch("SPECWRK_SRV_STORE_URI", "memory:///")), run_id) { yield }
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|