specwrk 0.4.9 → 0.4.11
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/config.ru +1 -0
- data/docker/Dockerfile.server +1 -1
- data/docker/entrypoint.server.sh +5 -1
- data/lib/specwrk/cli.rb +2 -7
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/app.rb +22 -5
- data/lib/specwrk/worker.rb +5 -3
- 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: e85bdff31c7f1312b12a9a823200a5da5b36653433496556cc1bce274a3dc90a
|
4
|
+
data.tar.gz: fa73aebb69753d7b528d333f2fca589e0e5525bd12b71e4c5b7815df0932b9a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9467744c0cd676bdeb312b3f1deb4190113601cb01bb9ce939acdfa1c6170897904f3125b43c90dde536459ed56b2623be132bfeed84725c1f6b098ea65ae6a9
|
7
|
+
data.tar.gz: f8cd7800b9f117567c1aa53404f2ca7f9a99a907c4b46c1c05da34d7534a2743c68960c50ffd9555de82430f582cb6a042a70579e4a8a44f53dea136f72cd8ae
|
data/config.ru
CHANGED
data/docker/Dockerfile.server
CHANGED
data/docker/entrypoint.server.sh
CHANGED
@@ -1,3 +1,7 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
|
-
|
3
|
+
export THRUSTER_HTTP_PORT=${PORT:-5138}
|
4
|
+
export THRUSTER_TARGET_PORT=3000
|
5
|
+
export THRUSTER_HTTP_IDLE_TIMEOUT=${IDLE_TIMEOUT:-305}
|
6
|
+
|
7
|
+
exec thrust puma --workers 0 --bind tcp://127.0.0.1:3000 --threads ${PUMA_THREADS:-1}
|
data/lib/specwrk/cli.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pathname"
|
4
|
-
require "fileutils"
|
5
4
|
|
6
5
|
require "dry/cli"
|
7
6
|
|
@@ -45,7 +44,6 @@ module Specwrk
|
|
45
44
|
ENV["SPECWRK_COUNT"] = count.to_s
|
46
45
|
ENV["SPECWRK_SEED_WAITS"] = seed_waits.to_s
|
47
46
|
ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
|
48
|
-
FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
|
49
47
|
end
|
50
48
|
|
51
49
|
def start_workers
|
@@ -80,16 +78,13 @@ module Specwrk
|
|
80
78
|
base.unique_option :verbose, type: :boolean, default: false, desc: "Run in verbose mode. Default false."
|
81
79
|
end
|
82
80
|
|
83
|
-
on_setup do |port:, bind:, output:, key:,
|
81
|
+
on_setup do |port:, bind:, output:, key:, group_by:, verbose:, **|
|
84
82
|
ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
|
85
|
-
|
83
|
+
ENV["SPECWRK_SRV_VERBOSE"] = "1" if verbose
|
86
84
|
|
87
|
-
ENV["SPECWRK_SRV_LOG"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "server.log")).to_s if output && !verbose
|
88
|
-
ENV["SPECWRK_SRV_OUTPUT"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "report.json")).expand_path(Dir.pwd).to_s if output
|
89
85
|
ENV["SPECWRK_SRV_PORT"] = port
|
90
86
|
ENV["SPECWRK_SRV_BIND"] = bind
|
91
87
|
ENV["SPECWRK_SRV_KEY"] = key
|
92
|
-
ENV["SPECWRK_SRV_SINGLE_SEED_PER_RUN"] = "1" if single_seed_per_run
|
93
88
|
ENV["SPECWRK_SRV_GROUP_BY"] = group_by
|
94
89
|
end
|
95
90
|
end
|
data/lib/specwrk/version.rb
CHANGED
data/lib/specwrk/web/app.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "pathname"
|
4
|
+
require "fileutils"
|
5
|
+
|
3
6
|
require "webrick"
|
4
7
|
require "rack"
|
5
8
|
|
@@ -21,9 +24,7 @@ module Specwrk
|
|
21
24
|
def run!
|
22
25
|
Process.setproctitle "specwrk-server"
|
23
26
|
|
24
|
-
|
25
|
-
$stdout.reopen(ENV["SPECWRK_SRV_LOG"], "w")
|
26
|
-
end
|
27
|
+
setup!
|
27
28
|
|
28
29
|
server_opts = {
|
29
30
|
Port: ENV.fetch("SPECWRK_SRV_PORT", "5138").to_i,
|
@@ -46,10 +47,26 @@ module Specwrk
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
def setup!
|
51
|
+
if ENV["SPECWRK_OUT"]
|
52
|
+
|
53
|
+
FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
|
54
|
+
ENV["SPECWRK_SRV_LOG"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "server.log")).to_s unless ENV["SPECWRK_SRV_VERBOSE"]
|
55
|
+
ENV["SPECWRK_SRV_OUTPUT"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "report.json")).expand_path(Dir.pwd).to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
if ENV["SPECWRK_SRV_LOG"]
|
59
|
+
$stdout.reopen(ENV["SPECWRK_SRV_LOG"], "w")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
49
63
|
def rackup
|
50
64
|
Rack::Builder.new do
|
51
|
-
|
52
|
-
|
65
|
+
if ENV["SPECWRK_SRV_VERBOSE"]
|
66
|
+
use Rack::Runtime
|
67
|
+
use Specwrk::Web::Logger, $stdout, %w[/health]
|
68
|
+
end
|
69
|
+
|
53
70
|
use Specwrk::Web::Auth, %w[/health] # global auth check
|
54
71
|
run Specwrk::Web::App.new # your router
|
55
72
|
end
|
data/lib/specwrk/worker.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "stringio"
|
4
|
+
require "fileutils"
|
4
5
|
|
5
6
|
require "specwrk/client"
|
6
7
|
require "specwrk/worker/executor"
|
@@ -13,6 +14,7 @@ module Specwrk
|
|
13
14
|
|
14
15
|
def initialize
|
15
16
|
Process.setproctitle ENV.fetch("SPECWRK_ID", "specwrk-worker")
|
17
|
+
FileUtils.mkdir_p(ENV["SPECWRK_OUT"]) if ENV["SPECWRK_OUT"]
|
16
18
|
|
17
19
|
@running = true
|
18
20
|
@client = Client.new
|
@@ -85,13 +87,13 @@ module Specwrk
|
|
85
87
|
|
86
88
|
def thump
|
87
89
|
while running && !Specwrk.force_quit
|
90
|
+
sleep 10
|
91
|
+
|
88
92
|
begin
|
89
|
-
client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now -
|
93
|
+
client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now - 30
|
90
94
|
rescue
|
91
95
|
warn "Heartbeat failed!"
|
92
96
|
end
|
93
|
-
|
94
|
-
sleep 1
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|