specwrk 0.4.3 → 0.4.5
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 +35 -30
- data/lib/specwrk/cli.rb +21 -18
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/endpoints.rb +3 -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: b752ad94605b60fec10d72935d86e9d37cc0b3cf7ae107163921259f1895affa
|
4
|
+
data.tar.gz: 131680d8a177b839c46c11d910841e704d3eff134c0578356f639a22df325d69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4c33485613191a342c8b614663a954b181a551ef53efa23fe35ae2c964bcbe843a56493d6afcaae33d88aee9b6272d8edfe7e2323b46fc7d144101c1b8628f
|
7
|
+
data.tar.gz: ed8d728db0fc51274083efc82ddeb4db2766113893f3bf646feda0061a7ce601d0ebd82109545d8434c989437ec7fb2885607c1b077166066647d9c9c1a383f3
|
data/README.md
CHANGED
@@ -47,17 +47,18 @@ Arguments:
|
|
47
47
|
DIR # Relative spec directory to run against
|
48
48
|
|
49
49
|
Options:
|
50
|
-
--uri=VALUE # HTTP URI of the server to pull jobs from. Overrides
|
51
|
-
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY
|
52
|
-
--run=VALUE, -r VALUE # The run identifier for this job execution. Overrides SPECWRK_RUN
|
53
|
-
--timeout=VALUE, -t VALUE # The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT
|
54
|
-
--id=VALUE # The identifier for this worker. Default specwrk-worker(-COUNT_INDEX)
|
55
|
-
--count=VALUE, -c VALUE # The number of worker processes you want to start
|
56
|
-
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT
|
57
|
-
--
|
58
|
-
--
|
59
|
-
--
|
60
|
-
--
|
50
|
+
--uri=VALUE # HTTP URI of the server to pull jobs from. Overrides SPECWRK_SRV_URI, default: "http://localhost:5138"
|
51
|
+
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY, default: ""
|
52
|
+
--run=VALUE, -r VALUE # The run identifier for this job execution. Overrides SPECWRK_RUN, default: "main"
|
53
|
+
--timeout=VALUE, -t VALUE # The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT, default: "5"
|
54
|
+
--id=VALUE # The identifier for this worker. Default specwrk-worker(-COUNT_INDEX), default: "specwrk-worker"
|
55
|
+
--count=VALUE, -c VALUE # The number of worker processes you want to start, default: 1
|
56
|
+
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT, default: ".specwrk/"
|
57
|
+
--seed-waits=VALUE, -w VALUE # Number of times the worker will wait for examples to be seeded to the server. 1sec between attempts. Overrides SPECWRK_SEED_WAITS, default: "10"
|
58
|
+
--port=VALUE, -p VALUE # Server port. Overrides SPECWRK_SRV_PORT, default: "5138"
|
59
|
+
--bind=VALUE, -b VALUE # Server bind address. Overrides SPECWRK_SRV_BIND, default: "127.0.0.1"
|
60
|
+
--group-by=VALUE # How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY: (file/timings), default: "timings"
|
61
|
+
--[no-]single-seed-per-run # Only allow one seed per run. Useful for CI where many nodes may seed at the same time, default: false
|
61
62
|
--[no-]verbose # Run in verbose mode. Default false., default: false
|
62
63
|
--help, -h # Print this help
|
63
64
|
```
|
@@ -77,13 +78,14 @@ Description:
|
|
77
78
|
Start a queue server
|
78
79
|
|
79
80
|
Options:
|
80
|
-
--port=VALUE, -p VALUE # Server port. Overrides SPECWRK_SRV_PORT
|
81
|
-
--bind=VALUE, -b VALUE # Server bind address. Overrides SPECWRK_SRV_BIND
|
82
|
-
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY
|
83
|
-
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT
|
84
|
-
--group-by=VALUE # How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY
|
85
|
-
--[no-]single-run
|
81
|
+
--port=VALUE, -p VALUE # Server port. Overrides SPECWRK_SRV_PORT, default: "5138"
|
82
|
+
--bind=VALUE, -b VALUE # Server bind address. Overrides SPECWRK_SRV_BIND, default: "127.0.0.1"
|
83
|
+
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY, default: ""
|
84
|
+
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT, default: ".specwrk/"
|
85
|
+
--group-by=VALUE # How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY: (file/timings), default: "timings"
|
86
|
+
--[no-]single-seed-per-run # Only allow one seed per run. Useful for CI where many nodes may seed at the same time, default: false
|
86
87
|
--[no-]verbose # Run in verbose mode. Default false., default: false
|
88
|
+
--[no-]single-run # Act on shutdown requests from clients. Default: false., default: false
|
87
89
|
--help, -h # Print this help
|
88
90
|
```
|
89
91
|
|
@@ -105,10 +107,10 @@ Arguments:
|
|
105
107
|
DIR # Relative spec directory to run against
|
106
108
|
|
107
109
|
Options:
|
108
|
-
--uri=VALUE # HTTP URI of the server to pull jobs from. Overrides
|
109
|
-
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY
|
110
|
-
--run=VALUE, -r VALUE # The run identifier for this job execution. Overrides SPECWRK_RUN
|
111
|
-
--timeout=VALUE, -t VALUE # The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT
|
110
|
+
--uri=VALUE # HTTP URI of the server to pull jobs from. Overrides SPECWRK_SRV_URI, default: "http://localhost:5138"
|
111
|
+
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY, default: ""
|
112
|
+
--run=VALUE, -r VALUE # The run identifier for this job execution. Overrides SPECWRK_RUN, default: "main"
|
113
|
+
--timeout=VALUE, -t VALUE # The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT, default: "5"
|
112
114
|
--help, -h # Print this help
|
113
115
|
```
|
114
116
|
|
@@ -127,13 +129,14 @@ Description:
|
|
127
129
|
Start one or more worker processes
|
128
130
|
|
129
131
|
Options:
|
130
|
-
--id=VALUE # The identifier for this worker. Default specwrk-worker(-COUNT_INDEX)
|
131
|
-
--count=VALUE, -c VALUE # The number of worker processes you want to start
|
132
|
-
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT
|
133
|
-
--
|
134
|
-
--
|
135
|
-
--
|
136
|
-
--
|
132
|
+
--id=VALUE # The identifier for this worker. Default specwrk-worker(-COUNT_INDEX), default: "specwrk-worker"
|
133
|
+
--count=VALUE, -c VALUE # The number of worker processes you want to start, default: 1
|
134
|
+
--output=VALUE, -o VALUE # Directory where worker output is stored. Overrides SPECWRK_OUT, default: ".specwrk/"
|
135
|
+
--seed-waits=VALUE, -w VALUE # Number of times the worker will wait for examples to be seeded to the server. 1sec between attempts. Overrides SPECWRK_SEED_WAITS, default: "10"
|
136
|
+
--uri=VALUE # HTTP URI of the server to pull jobs from. Overrides SPECWRK_SRV_URI, default: "http://localhost:5138"
|
137
|
+
--key=VALUE, -k VALUE # Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY, default: ""
|
138
|
+
--run=VALUE, -r VALUE # The run identifier for this job execution. Overrides SPECWRK_RUN, default: "main"
|
139
|
+
--timeout=VALUE, -t VALUE # The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT, default: "5"
|
137
140
|
--help, -h # Print this help
|
138
141
|
```
|
139
142
|
|
@@ -158,9 +161,11 @@ Rails has had easy multi-process test setup for a while now by creating unique t
|
|
158
161
|
```
|
159
162
|
|
160
163
|
## CI
|
161
|
-
|
164
|
+
Run `specwrk` in CI in either a single-node or multi-node configuration.
|
165
|
+
|
166
|
+
### Single-node, multi-process
|
167
|
+
Single-node + multi-process is the easiest way to get started. Add it to your existing configuration
|
162
168
|
|
163
|
-
TODO!
|
164
169
|
|
165
170
|
## Contributing
|
166
171
|
|
data/lib/specwrk/cli.rb
CHANGED
@@ -16,10 +16,10 @@ module Specwrk
|
|
16
16
|
extend Hookable
|
17
17
|
|
18
18
|
on_included do |base|
|
19
|
-
base.unique_option :uri, type: :string, default: ENV.fetch("SPECWRK_SRV_URI", "http://localhost:#{ENV.fetch("SPECWRK_SRV_PORT", "5138")}"), desc: "HTTP URI of the server to pull jobs from. Overrides SPECWRK_SRV_URI
|
20
|
-
base.unique_option :key, type: :string, default: ENV.fetch("SPECWRK_SRV_KEY", ""), aliases: ["-k"], desc: "Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY
|
21
|
-
base.unique_option :run, type: :string, default: ENV.fetch("SPECWRK_RUN", "main"), aliases: ["-r"], desc: "The run identifier for this job execution. Overrides SPECWRK_RUN
|
22
|
-
base.unique_option :timeout, type: :integer, default: ENV.fetch("SPECWRK_TIMEOUT", "5"), aliases: ["-t"], desc: "The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT
|
19
|
+
base.unique_option :uri, type: :string, default: ENV.fetch("SPECWRK_SRV_URI", "http://localhost:#{ENV.fetch("SPECWRK_SRV_PORT", "5138")}"), desc: "HTTP URI of the server to pull jobs from. Overrides SPECWRK_SRV_URI"
|
20
|
+
base.unique_option :key, type: :string, default: ENV.fetch("SPECWRK_SRV_KEY", ""), aliases: ["-k"], desc: "Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY"
|
21
|
+
base.unique_option :run, type: :string, default: ENV.fetch("SPECWRK_RUN", "main"), aliases: ["-r"], desc: "The run identifier for this job execution. Overrides SPECWRK_RUN"
|
22
|
+
base.unique_option :timeout, type: :integer, default: ENV.fetch("SPECWRK_TIMEOUT", "5"), aliases: ["-t"], desc: "The amount of time to wait for the server to respond. Overrides SPECWRK_TIMEOUT"
|
23
23
|
end
|
24
24
|
|
25
25
|
on_setup do |uri:, key:, run:, timeout:, **|
|
@@ -34,10 +34,10 @@ module Specwrk
|
|
34
34
|
extend Hookable
|
35
35
|
|
36
36
|
on_included do |base|
|
37
|
-
base.unique_option :id, type: :string, default: "specwrk-worker", desc: "The identifier for this worker. Default specwrk-worker(-COUNT_INDEX)
|
38
|
-
base.unique_option :count, type: :integer, default: 1, aliases: ["-c"], desc: "The number of worker processes you want to start
|
39
|
-
base.unique_option :output, type: :string, default: ENV.fetch("SPECWRK_OUT", ".specwrk/"), aliases: ["-o"], desc: "Directory where worker output is stored. Overrides SPECWRK_OUT
|
40
|
-
base.unique_option :seed_waits, type: :integer, default: ENV.fetch("SPECWRK_SEED_WAITS", "10"), aliases: ["-w"], desc: "Number of times the worker will wait for examples to be seeded to the server. 1sec between attempts. Overrides SPECWRK_SEED_WAITS
|
37
|
+
base.unique_option :id, type: :string, default: "specwrk-worker", desc: "The identifier for this worker. Default specwrk-worker(-COUNT_INDEX)"
|
38
|
+
base.unique_option :count, type: :integer, default: 1, aliases: ["-c"], desc: "The number of worker processes you want to start"
|
39
|
+
base.unique_option :output, type: :string, default: ENV.fetch("SPECWRK_OUT", ".specwrk/"), aliases: ["-o"], desc: "Directory where worker output is stored. Overrides SPECWRK_OUT"
|
40
|
+
base.unique_option :seed_waits, type: :integer, default: ENV.fetch("SPECWRK_SEED_WAITS", "10"), aliases: ["-w"], desc: "Number of times the worker will wait for examples to be seeded to the server. 1sec between attempts. Overrides SPECWRK_SEED_WAITS"
|
41
41
|
end
|
42
42
|
|
43
43
|
on_setup do |id:, count:, output:, seed_waits:, **|
|
@@ -71,17 +71,16 @@ module Specwrk
|
|
71
71
|
extend Hookable
|
72
72
|
|
73
73
|
on_included do |base|
|
74
|
-
base.unique_option :port, type: :integer, default: ENV.fetch("SPECWRK_SRV_PORT", "5138"), aliases: ["-p"], desc: "Server port. Overrides SPECWRK_SRV_PORT
|
75
|
-
base.unique_option :bind, type: :string, default: ENV.fetch("SPECWRK_SRV_BIND", "127.0.0.1"), aliases: ["-b"], desc: "Server bind address. Overrides SPECWRK_SRV_BIND
|
76
|
-
base.unique_option :key, type: :string, aliases: ["-k"], default: ENV.fetch("SPECWRK_SRV_KEY", ""), desc: "Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY
|
77
|
-
base.unique_option :output, type: :string, default: ENV.fetch("SPECWRK_OUT", ".specwrk/"), aliases: ["-o"], desc: "Directory where worker output is stored. Overrides SPECWRK_OUT
|
78
|
-
base.unique_option :group_by, values: %w[file timings], default: ENV.fetch("SPECWERK_SRV_GROUP_BY", "timings"), desc: "How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY
|
79
|
-
base.unique_option :
|
80
|
-
base.unique_option :single_seed_per_run, type: :boolean, default: false, desc: "Only allow one seed per run. Useful for CI where many nodes may seed at the same time. Default: false."
|
74
|
+
base.unique_option :port, type: :integer, default: ENV.fetch("SPECWRK_SRV_PORT", "5138"), aliases: ["-p"], desc: "Server port. Overrides SPECWRK_SRV_PORT"
|
75
|
+
base.unique_option :bind, type: :string, default: ENV.fetch("SPECWRK_SRV_BIND", "127.0.0.1"), aliases: ["-b"], desc: "Server bind address. Overrides SPECWRK_SRV_BIND"
|
76
|
+
base.unique_option :key, type: :string, aliases: ["-k"], default: ENV.fetch("SPECWRK_SRV_KEY", ""), desc: "Authentication key clients must use for access. Overrides SPECWRK_SRV_KEY"
|
77
|
+
base.unique_option :output, type: :string, default: ENV.fetch("SPECWRK_OUT", ".specwrk/"), aliases: ["-o"], desc: "Directory where worker output is stored. Overrides SPECWRK_OUT"
|
78
|
+
base.unique_option :group_by, values: %w[file timings], default: ENV.fetch("SPECWERK_SRV_GROUP_BY", "timings"), desc: "How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY"
|
79
|
+
base.unique_option :single_seed_per_run, type: :boolean, default: false, desc: "Only allow one seed per run. Useful for CI where many nodes may seed at the same time"
|
81
80
|
base.unique_option :verbose, type: :boolean, default: false, desc: "Run in verbose mode. Default false."
|
82
81
|
end
|
83
82
|
|
84
|
-
on_setup do |port:, bind:, output:, key:,
|
83
|
+
on_setup do |port:, bind:, output:, key:, single_seed_per_run:, group_by:, verbose:, **|
|
85
84
|
ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
|
86
85
|
FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
|
87
86
|
|
@@ -90,7 +89,6 @@ module Specwrk
|
|
90
89
|
ENV["SPECWRK_SRV_PORT"] = port
|
91
90
|
ENV["SPECWRK_SRV_BIND"] = bind
|
92
91
|
ENV["SPECWRK_SRV_KEY"] = key
|
93
|
-
ENV["SPECWRK_SRV_SINGLE_RUN"] = "1" if single_run
|
94
92
|
ENV["SPECWRK_SRV_SINGLE_SEED_PER_RUN"] = "1" if single_seed_per_run
|
95
93
|
ENV["SPECWRK_SRV_GROUP_BY"] = group_by
|
96
94
|
end
|
@@ -117,6 +115,7 @@ module Specwrk
|
|
117
115
|
require "specwrk/list_examples"
|
118
116
|
require "specwrk/client"
|
119
117
|
|
118
|
+
ENV["SPECWRK_SEED"] = "1"
|
120
119
|
examples = ListExamples.new(dir).examples
|
121
120
|
|
122
121
|
Client.wait_for_server!
|
@@ -159,8 +158,11 @@ module Specwrk
|
|
159
158
|
include Servable
|
160
159
|
|
161
160
|
desc "Start a queue server"
|
161
|
+
option :single_run, type: :boolean, default: false, desc: "Act on shutdown requests from clients. Default: false."
|
162
|
+
|
163
|
+
def call(single_run:, **args)
|
164
|
+
ENV["SPECWRK_SRV_SINGLE_RUN"] = "1" if single_run
|
162
165
|
|
163
|
-
def call(**args)
|
164
166
|
self.class.setup(**args)
|
165
167
|
|
166
168
|
require "specwrk/web"
|
@@ -197,6 +199,7 @@ module Specwrk
|
|
197
199
|
require "specwrk/list_examples"
|
198
200
|
require "specwrk/client"
|
199
201
|
|
202
|
+
ENV["SPECWRK_SEED"] = "1"
|
200
203
|
examples = ListExamples.new(dir).examples
|
201
204
|
|
202
205
|
status "Waiting for server to respond..."
|
data/lib/specwrk/version.rb
CHANGED
@@ -82,12 +82,14 @@ module Specwrk
|
|
82
82
|
def response
|
83
83
|
processing_queue.synchronize do |processing_queue_hash|
|
84
84
|
payload.each do |example|
|
85
|
+
next unless processing_queue_hash.key?(example[:id])
|
86
|
+
|
85
87
|
processing_queue_hash.delete(example[:id])
|
86
88
|
completed_queue[example[:id]] = example
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
90
|
-
if pending_queue.length.zero? && processing_queue.length.zero? && ENV["SPECWRK_SRV_OUTPUT"]
|
92
|
+
if pending_queue.length.zero? && processing_queue.length.zero? && completed_queue.length.positive? && ENV["SPECWRK_SRV_OUTPUT"]
|
91
93
|
completed_queue.dump_and_write(ENV["SPECWRK_SRV_OUTPUT"])
|
92
94
|
end
|
93
95
|
|