specwrk 0.15.8 → 0.15.9

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: 0a359bd88ba0482dad8bf78555ce9256e8dfa4f000d48f2e36579df34172a684
4
- data.tar.gz: a41d177279abb2622d8778a14344ede5f8eac4cac83bbd99185e6302f956f6e7
3
+ metadata.gz: 8afbccd28740ac63fbdbd2f71a6f60442664a2d19e6743c337266fd14cffe081
4
+ data.tar.gz: 5b2b645f3b93abcb320f9fb4e93ebac94df591bb4336dac8af946d5f771575a4
5
5
  SHA512:
6
- metadata.gz: 7faa3a2e27b1338fde5aa02b8ae29482b8203857bfb07a54d5c8ff751e73b051b1bc7c69e05bf1b58a8aa609e9de15b767d78a4002936b83d60f3c2f90f928b7
7
- data.tar.gz: d6c167e28a11bcc0798074d4214430430cbdb6e34c8b1f1c5c9bed2c086251736c73aefcc984d5ae10ce47e4204d1d13a4b3119a68ed6e26f262ec657839ab4f
6
+ metadata.gz: eb05bb7995ebd500c6935e0325f00d58ad7cd0d78f3f1fe133615258f53a8a3ec8832f43e4c383bfb6d09577c1d9e5e9830bc9043e5c3cc7a3d5e4a376986c52
7
+ data.tar.gz: 4bfbc09dde0c764df5ad01869b1ba86bb9acde760ab49ab46fcd509f9eba8db849237e272e46a3baf5e7c458c054a00450d3c9b1f657ecbeb84e81f2da9781c7
data/README.md CHANGED
@@ -205,7 +205,7 @@ Multi-node, multi-process works best when have many nodes running tests. This di
205
205
  To accomplish this, a central queue server is required, examples must be explicitly seeded, and workers explicitly started.
206
206
 
207
207
  1. Start a centralized queue server (see [Running a persistent Queue Server](#running-a-persistent-queue-server))
208
- 2. Seed the server with the specs for the current `SPECWWRK_RUN` pointed at your central server
208
+ 2. Seed the server with the specs for the current `SPECWRK_RUN` pointed at your central server
209
209
  3. Execute `specwrk work` for the given process count, for the current `SPECWRK_RUN`, pointed at your central server
210
210
 
211
211
  [GitHub Actions Example](https://github.com/danielwestendorf/specwrk/blob/main/.github/workflows/specwrk-multi-node.yml)
data/lib/specwrk/cli.rb CHANGED
@@ -131,7 +131,7 @@ module Specwrk
131
131
 
132
132
  desc "Seed the server with a list of specs for the run"
133
133
  option :max_retries, default: 0, desc: "Number of times an example will be re-run should it fail"
134
- argument :dir, required: false, default: "spec", desc: "Relative spec directory to run against"
134
+ argument :dir, type: :array, required: false, default: "spec", desc: "Relative spec directory to run against"
135
135
 
136
136
  def call(max_retries:, dir:, **args)
137
137
  self.class.setup(**args)
@@ -208,7 +208,7 @@ module Specwrk
208
208
 
209
209
  desc "Start a server and workers, monitor until complete"
210
210
  option :max_retries, default: 0, desc: "Number of times an example will be re-run should it fail"
211
- argument :dir, required: false, default: "spec", desc: "Relative spec directory to run against"
211
+ argument :dir, required: false, type: :array, default: "spec", desc: "Relative spec directory to run against"
212
212
 
213
213
  def call(max_retries:, dir:, **args)
214
214
  self.class.setup(**args)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Specwrk
4
- VERSION = "0.15.8"
4
+ VERSION = "0.15.9"
5
5
  end
@@ -46,6 +46,10 @@ module Specwrk
46
46
 
47
47
  attr_reader :request
48
48
 
49
+ def skip_lock
50
+ false
51
+ end
52
+
49
53
  def before_lock
50
54
  end
51
55
 
@@ -119,7 +123,11 @@ module Specwrk
119
123
  end
120
124
 
121
125
  def with_lock
122
- Store.with_lock(URI(ENV.fetch("SPECWRK_SRV_STORE_URI", "memory:///")), run_id) { yield }
126
+ if skip_lock
127
+ yield
128
+ else
129
+ Store.with_lock(URI(ENV.fetch("SPECWRK_SRV_STORE_URI", "memory:///")), run_id) { yield }
130
+ end
123
131
  end
124
132
  end
125
133
 
@@ -19,8 +19,17 @@ module Specwrk
19
19
 
20
20
  private
21
21
 
22
+ def before_lock
23
+ processing_examples
24
+ completed_examples
25
+ end
26
+
22
27
  def all_examples
23
- @all_examples ||= payload.map { |example| [example[:id], example] if processing[example[:id]] }.compact.to_h
28
+ @all_examples ||= payload.map { |example| [example[:id], example] if processing_examples[example[:id]] }.compact.to_h
29
+ end
30
+
31
+ def processing_examples
32
+ @processing_examples ||= processing.multi_read(*payload.map { |example| example[:id] })
24
33
  end
25
34
 
26
35
  def completed_examples
@@ -67,7 +76,7 @@ module Specwrk
67
76
  # So if we overwrite run times from another process it is nbd
68
77
  run_times.merge! run_time_data
69
78
 
70
- # workers are single proces, single-threaded, so safe to do this work without the lock
79
+ # workers are single process, single-threaded, so safe to do this work without the lock
71
80
  existing_status_counts = worker.multi_read(*EXAMPLE_STATUSES)
72
81
  new_status_counts = EXAMPLE_STATUSES.map do |status|
73
82
  [status, existing_status_counts.fetch(status, 0) + completed_examples_status_counts.fetch(status, 0)]
@@ -13,6 +13,12 @@ module Specwrk
13
13
 
14
14
  [200, {"content-type" => "application/json"}, [JSON.generate(completed_dump)]]
15
15
  end
16
+
17
+ private
18
+
19
+ def skip_lock
20
+ true
21
+ end
16
22
  end
17
23
  end
18
24
  end
@@ -12,6 +12,12 @@ module Specwrk
12
12
  [200, {"content-type" => "text/plain"}, ["✌️"]]
13
13
  end
14
14
 
15
+ private
16
+
17
+ def skip_lock
18
+ true
19
+ end
20
+
15
21
  def interupt!
16
22
  Thread.new do
17
23
  # give the socket a moment to flush the response
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.8
4
+ version: 0.15.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf