specwrk 0.3.0 → 0.4.0
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/lib/specwrk/client.rb +2 -0
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/endpoints.rb +3 -1
- data/lib/specwrk/worker/executor.rb +3 -0
- data/lib/specwrk/worker.rb +12 -0
- data/lib/specwrk.rb +1 -0
- 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: e3916d92756b30810112db210d2a7ab6627ed250dbddfdc64ba8b0f24248d22c
|
4
|
+
data.tar.gz: eaa7c44ddacb99dde93337de842a420ebe8b12157b9dd90b5a158d75be8bebbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 138e0a9358bcdd82472f3ab03c607ca647393c6d79c818d2c470fbd13670e045853e1355d3ca53634e0e8447058d5cc50676ea8692fb3286afa015346765970a
|
7
|
+
data.tar.gz: 2480031a9d3a080c3ddda3f4a6b5e736c3331356415da510c77ec8525114c65469c34fd0530a60fed49ccb15cef2ca03b438672920118872cc45fa8393edd8a5
|
data/lib/specwrk/client.rb
CHANGED
data/lib/specwrk/version.rb
CHANGED
@@ -94,7 +94,9 @@ module Specwrk
|
|
94
94
|
|
95
95
|
if @examples.length.positive?
|
96
96
|
[200, {"Content-Type" => "application/json"}, [JSON.generate(@examples)]]
|
97
|
-
elsif processing_queue.length.zero?
|
97
|
+
elsif pending_queue.length.zero? && processing_queue.length.zero? && completed_queue.length.zero?
|
98
|
+
[204, {"Content-Type" => "text/plain"}, ["Waiting for sample to be seeded."]]
|
99
|
+
elsif completed_queue.length.positive? && processing_queue.length.zero?
|
98
100
|
[410, {"Content-Type" => "text/plain"}, ["That's a good lad. Run along now and go home."]]
|
99
101
|
else
|
100
102
|
not_found
|
@@ -11,6 +11,8 @@ require "specwrk/worker/null_formatter"
|
|
11
11
|
module Specwrk
|
12
12
|
class Worker
|
13
13
|
class Executor
|
14
|
+
attr_reader :example_processed
|
15
|
+
|
14
16
|
def failure
|
15
17
|
completion_formatter.failure
|
16
18
|
end
|
@@ -27,6 +29,7 @@ module Specwrk
|
|
27
29
|
reset!
|
28
30
|
|
29
31
|
example_ids = examples.map { |example| example[:id] }
|
32
|
+
@example_processed ||= true unless example_ids.size.zero? # only ever toggle from nil => true
|
30
33
|
|
31
34
|
options = RSpec::Core::ConfigurationOptions.new rspec_options + example_ids
|
32
35
|
RSpec::Core::Runner.new(options).run($stderr, $stdout)
|
data/lib/specwrk/worker.rb
CHANGED
@@ -36,6 +36,17 @@ module Specwrk
|
|
36
36
|
# This will cause workers to 'hang' until all work has been completed
|
37
37
|
# TODO: break here if all the other worker processes on this host are done executing examples
|
38
38
|
sleep 0.5
|
39
|
+
rescue WaitingForSeedError
|
40
|
+
@seed_wait_count ||= 0
|
41
|
+
@seed_wait_count += 1
|
42
|
+
|
43
|
+
if @seed_wait_count <= 10
|
44
|
+
warn "No examples seeded yet, waiting..."
|
45
|
+
sleep 1
|
46
|
+
else
|
47
|
+
warn "No examples seeded, giving up!"
|
48
|
+
break
|
49
|
+
end
|
39
50
|
end
|
40
51
|
|
41
52
|
executor.final_output.tap(&:rewind).each_line { |line| $stdout.write line }
|
@@ -88,6 +99,7 @@ module Specwrk
|
|
88
99
|
attr_reader :running, :client, :executor
|
89
100
|
|
90
101
|
def status
|
102
|
+
return 1 unless executor.example_processed
|
91
103
|
return 1 if executor.failure
|
92
104
|
return 1 if Specwrk.force_quit
|
93
105
|
|
data/lib/specwrk.rb
CHANGED
@@ -8,6 +8,7 @@ module Specwrk
|
|
8
8
|
# HTTP Client Errors
|
9
9
|
ClientError = Class.new(Error)
|
10
10
|
UnhandledResponseError = Class.new(ClientError)
|
11
|
+
WaitingForSeedError = Class.new(ClientError)
|
11
12
|
NoMoreExamplesError = Class.new(ClientError)
|
12
13
|
CompletedAllExamplesError = Class.new(ClientError)
|
13
14
|
|