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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20541408cebae1ced527a8f5d7f425b719151a9959fc95d421904dce37ad34b4
4
- data.tar.gz: 9df0eff320f56aa55764993e16b100519b0112ebb17a19750e9ef9d39a01b51d
3
+ metadata.gz: 0a359bd88ba0482dad8bf78555ce9256e8dfa4f000d48f2e36579df34172a684
4
+ data.tar.gz: a41d177279abb2622d8778a14344ede5f8eac4cac83bbd99185e6302f956f6e7
5
5
  SHA512:
6
- metadata.gz: 2769e8abf15400ea0984f73d5f1015bf8c2afa009b23a346cf7d74ff3bb0d38b4bcf8ccb85a298d8ae6e38ab7d88db16d40e14e1053228a4da11915af9476e83
7
- data.tar.gz: 5e815ee3f6471bc09fff5202f6b867b7b7722310ad18fd9acd95eef1d39368ebc14968e01e1ac37bb7af816e914e7c102190fc9966335af0f66b401040eef6fa
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 invserly true. Others are comercial or impactical without making a purchase.
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 [LGLPv3 License](http://www.gnu.org/licenses/lgpl-3.0.html).
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"]
@@ -4,7 +4,7 @@ require "time"
4
4
 
5
5
  require "specwrk/client"
6
6
 
7
- require "rspec"
7
+ require "rspec/core"
8
8
  require "rspec/core/formatters/helpers"
9
9
  require "rspec/core/formatters/console_codes"
10
10
 
data/lib/specwrk/store.rb CHANGED
@@ -20,8 +20,12 @@ module Specwrk
20
20
 
21
21
  FileAdapter
22
22
  when /redis/
23
- # Expects the specwrk-store-redis_adapter gem to be available
24
- require "specwrk/store/redis_adapter" unless defined?(RedisAdapter)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Specwrk
4
- VERSION = "0.15.6"
4
+ VERSION = "0.15.8"
5
5
  end
@@ -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:///")), "server") { yield }
122
+ Store.with_lock(URI(ENV.fetch("SPECWRK_SRV_STORE_URI", "memory:///")), run_id) { yield }
123
123
  end
124
124
  end
125
125
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "tempfile"
4
4
 
5
- require "rspec"
5
+ require "rspec/core"
6
6
 
7
7
  require "specwrk/worker/progress_formatter"
8
8
  require "specwrk/worker/completion_formatter"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specwrk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.6
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf