ruby_raider 4.0.1 → 4.2.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/.github/workflows/e2e_tests.yml +3 -0
- data/README.md +58 -1
- data/RELEASE.md +25 -0
- data/lib/commands/schedule_commands.rb +84 -0
- data/lib/generators/templates/common/git_ignore.tt +1 -0
- data/lib/ruby_raider/runtime/retry_reset.rb +32 -0
- data/lib/ruby_raider/runtime/rspec.rb +1 -0
- data/lib/ruby_raider/runtime/show_browser.rb +53 -0
- data/lib/ruby_raider/runtime.rb +2 -0
- data/lib/ruby_raider.rb +31 -0
- data/lib/utilities/schedules/adapter.rb +22 -0
- data/lib/utilities/schedules/base.rb +27 -0
- data/lib/utilities/schedules/kind.rb +74 -0
- data/lib/utilities/schedules/legacy.rb +196 -0
- data/lib/utilities/schedules/legacy_stub.rb +62 -0
- data/lib/utilities/schedules/next_run.rb +61 -0
- data/lib/utilities/schedules/notifier.rb +76 -0
- data/lib/utilities/schedules/os/command_runner.rb +73 -0
- data/lib/utilities/schedules/os/cron.rb +147 -0
- data/lib/utilities/schedules/os/launchd.rb +182 -0
- data/lib/utilities/schedules/os/linux.rb +81 -0
- data/lib/utilities/schedules/os/systemd.rb +194 -0
- data/lib/utilities/schedules/os/task_scheduler.rb +195 -0
- data/lib/utilities/schedules/os_enumerator.rb +30 -0
- data/lib/utilities/schedules/project.rb +70 -0
- data/lib/utilities/schedules/rule.rb +162 -0
- data/lib/utilities/schedules/run_lock.rb +160 -0
- data/lib/utilities/schedules/run_log.rb +122 -0
- data/lib/utilities/schedules/run_report.rb +139 -0
- data/lib/utilities/schedules/run_wrapper.rb +216 -0
- data/lib/utilities/schedules/schedule.rb +89 -0
- data/lib/utilities/schedules/schedule_store.rb +53 -0
- data/lib/utilities/schedules/scheduler.rb +178 -0
- data/lib/utilities/schedules/scheduler_steps.rb +69 -0
- data/lib/utilities/schedules/selection.rb +133 -0
- data/lib/utilities/schedules/spawn.rb +68 -0
- data/lib/utilities/schedules/store.rb +139 -0
- data/lib/version +1 -1
- data/ruby_raider.gemspec +1 -0
- data/sig/commands/schedule_commands.rbs +12 -0
- data/sig/ruby_raider/runtime/retry_reset.rbs +7 -0
- data/sig/ruby_raider/runtime/show_browser.rbs +27 -0
- data/sig/ruby_raider.rbs +6 -0
- data/sig/utilities/schedules/adapter.rbs +5 -0
- data/sig/utilities/schedules/base.rbs +15 -0
- data/sig/utilities/schedules/kind.rbs +32 -0
- data/sig/utilities/schedules/legacy.rbs +45 -0
- data/sig/utilities/schedules/legacy_stub.rbs +15 -0
- data/sig/utilities/schedules/next_run.rbs +15 -0
- data/sig/utilities/schedules/notifier.rbs +29 -0
- data/sig/utilities/schedules/os/command_runner.rbs +27 -0
- data/sig/utilities/schedules/os/cron.rbs +34 -0
- data/sig/utilities/schedules/os/launchd.rbs +46 -0
- data/sig/utilities/schedules/os/linux.rbs +33 -0
- data/sig/utilities/schedules/os/systemd.rbs +44 -0
- data/sig/utilities/schedules/os/task_scheduler.rbs +56 -0
- data/sig/utilities/schedules/os_enumerator.rbs +12 -0
- data/sig/utilities/schedules/project.rbs +22 -0
- data/sig/utilities/schedules/rule.rbs +72 -0
- data/sig/utilities/schedules/run_lock.rbs +29 -0
- data/sig/utilities/schedules/run_log.rbs +33 -0
- data/sig/utilities/schedules/run_report.rbs +34 -0
- data/sig/utilities/schedules/run_wrapper.rbs +45 -0
- data/sig/utilities/schedules/schedule.rbs +27 -0
- data/sig/utilities/schedules/schedule_store.rbs +21 -0
- data/sig/utilities/schedules/scheduler.rbs +49 -0
- data/sig/utilities/schedules/scheduler_steps.rbs +22 -0
- data/sig/utilities/schedules/selection.rbs +36 -0
- data/sig/utilities/schedules/spawn.rbs +10 -0
- data/sig/utilities/schedules/store.rbs +39 -0
- data/spec/commands/schedule_commands_spec.rb +284 -0
- data/spec/integration/content/common_content_spec.rb +8 -2
- data/spec/integration/content/gemfile_content_spec.rb +2 -2
- data/spec/runtime/retry_reset_spec.rb +112 -0
- data/spec/runtime/show_browser_project_spec.rb +70 -0
- data/spec/runtime/show_browser_spec.rb +101 -0
- data/spec/utilities/schedules/kind_spec.rb +81 -0
- data/spec/utilities/schedules/legacy_spec.rb +433 -0
- data/spec/utilities/schedules/legacy_stub_spec.rb +144 -0
- data/spec/utilities/schedules/next_run_spec.rb +119 -0
- data/spec/utilities/schedules/notifier_spec.rb +120 -0
- data/spec/utilities/schedules/os/command_runner_spec.rb +55 -0
- data/spec/utilities/schedules/os/cron_spec.rb +292 -0
- data/spec/utilities/schedules/os/launchd_spec.rb +306 -0
- data/spec/utilities/schedules/os/linux_spec.rb +163 -0
- data/spec/utilities/schedules/os/list_ids_spec.rb +202 -0
- data/spec/utilities/schedules/os/systemd_spec.rb +333 -0
- data/spec/utilities/schedules/os/task_scheduler_spec.rb +511 -0
- data/spec/utilities/schedules/os_entry_spec.rb +54 -0
- data/spec/utilities/schedules/os_enumerator_spec.rb +57 -0
- data/spec/utilities/schedules/project_spec.rb +125 -0
- data/spec/utilities/schedules/run_lock_spec.rb +143 -0
- data/spec/utilities/schedules/run_log_spec.rb +83 -0
- data/spec/utilities/schedules/run_report_spec.rb +150 -0
- data/spec/utilities/schedules/run_wrapper_integration_spec.rb +166 -0
- data/spec/utilities/schedules/run_wrapper_spec.rb +430 -0
- data/spec/utilities/schedules/schedule_spec.rb +120 -0
- data/spec/utilities/schedules/schedule_store_spec.rb +151 -0
- data/spec/utilities/schedules/scheduler_launchd_spec.rb +77 -0
- data/spec/utilities/schedules/scheduler_spec.rb +445 -0
- data/spec/utilities/schedules/selection_spec.rb +176 -0
- data/spec/utilities/schedules/spawn_spec.rb +104 -0
- metadata +106 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tmpdir'
|
|
4
|
+
require_relative '../../../lib/utilities/schedules/selection'
|
|
5
|
+
|
|
6
|
+
RSpec.describe RubyRaider::Schedules::Selection do # rubocop:disable RSpec/FilePath
|
|
7
|
+
let(:tmp) { File.realpath(Dir.mktmpdir('schedules-selection')) }
|
|
8
|
+
let(:root) { File.join(tmp, 'project') }
|
|
9
|
+
let(:mac) { 'darwin24' }
|
|
10
|
+
let(:windows) { 'mingw32' }
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
FileUtils.mkdir_p(File.join(root, 'spec/login'))
|
|
14
|
+
%w[spec/a_spec.rb spec/b_spec.rb spec/login/c_spec.rb].each { |file| File.write(File.join(root, file), '') }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
after { FileUtils.rm_rf(tmp) }
|
|
18
|
+
|
|
19
|
+
def parse(files: [], tag: nil, host_os: mac) = described_class.parse(files: files, tag: tag, root: root, host_os: host_os)
|
|
20
|
+
|
|
21
|
+
def error_for(...)
|
|
22
|
+
parse(...)
|
|
23
|
+
nil
|
|
24
|
+
rescue RubyRaider::Schedules::Error => e
|
|
25
|
+
e.message
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def load_error(hash, host_os: mac)
|
|
29
|
+
described_class.from_h(hash, root: root, host_os: host_os)
|
|
30
|
+
nil
|
|
31
|
+
rescue RubyRaider::Schedules::Error => e
|
|
32
|
+
e.message
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe '.parse' do
|
|
36
|
+
it 'selects all tests with no files and no tag' do
|
|
37
|
+
expect([parse.kind, parse.to_h]).to eq(['all', { 'kind' => 'all' }])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'selects one tag' do
|
|
41
|
+
expect(parse(tag: 'smoke:fast-1_x').to_h).to eq({ 'kind' => 'tag', 'tag' => 'smoke:fast-1_x' })
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'selects files, removing duplicates and keeping their order' do
|
|
45
|
+
selection = parse(files: %w[spec/b_spec.rb spec/a_spec.rb spec/b_spec.rb spec/login/c_spec.rb])
|
|
46
|
+
|
|
47
|
+
expect(selection.to_h).to eq({ 'kind' => 'files', 'files' => %w[spec/b_spec.rb spec/a_spec.rb spec/login/c_spec.rb] })
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'refuses a tag together with files' do
|
|
51
|
+
expect(error_for(files: %w[spec/a_spec.rb], tag: 'smoke')).to eq('Use --tag or spec files, not both')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'refuses a tag with a space, a semicolon, a newline or nothing in it' do
|
|
55
|
+
errors = ['smoke test', 'smoke;rm', "smoke\n;x", '', 'smoke$(id)', 1, "\xFF".dup.force_encoding('UTF-8')].map { |tag| error_for(tag: tag) }
|
|
56
|
+
|
|
57
|
+
expect(errors).to all(start_with('Invalid tag'))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'refuses paths that climb out, look like options or are absolute' do
|
|
61
|
+
hostile = ['../x_spec.rb', 'spec/../../x_spec.rb', '-rf_spec.rb', '/abs_spec.rb', "#{root}/spec/a_spec.rb"]
|
|
62
|
+
|
|
63
|
+
expect(hostile.map { |file| error_for(files: [file]) }).to all(start_with('Invalid spec file'))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'refuses a file that is not a _spec.rb, has a control character or is not text' do
|
|
67
|
+
bad = ['spec/a.rb', 'spec/a_spec.rb.bak', "spec/a\n_spec.rb", "spec/a\0_spec.rb", '', nil, 1, "spec/\xFF_spec.rb".b.force_encoding('UTF-8')]
|
|
68
|
+
|
|
69
|
+
expect(bad.map { |file| error_for(files: [file]) }).to all(start_with('Invalid spec file'))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'refuses a link that points outside the project' do
|
|
73
|
+
outside = File.join(tmp, 'outside_spec.rb')
|
|
74
|
+
File.write(outside, '')
|
|
75
|
+
File.symlink(outside, File.join(root, 'spec/link_spec.rb'))
|
|
76
|
+
|
|
77
|
+
expect(error_for(files: %w[spec/link_spec.rb])).to eq('spec/link_spec.rb points outside the project')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'refuses a folder link that points outside the project' do
|
|
81
|
+
FileUtils.mkdir_p(File.join(tmp, 'elsewhere'))
|
|
82
|
+
File.write(File.join(tmp, 'elsewhere/x_spec.rb'), '')
|
|
83
|
+
File.symlink(File.join(tmp, 'elsewhere'), File.join(root, 'spec/away'))
|
|
84
|
+
|
|
85
|
+
expect(error_for(files: %w[spec/away/x_spec.rb])).to eq('spec/away/x_spec.rb points outside the project')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'takes a link that stays inside the project' do
|
|
89
|
+
File.symlink(File.join(root, 'spec/a_spec.rb'), File.join(root, 'spec/alias_spec.rb'))
|
|
90
|
+
|
|
91
|
+
expect(parse(files: %w[spec/alias_spec.rb]).files).to eq(%w[spec/alias_spec.rb])
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'refuses a file that is not there' do
|
|
95
|
+
expect(error_for(files: %w[spec/a_spec.rb spec/gone_spec.rb])).to eq('spec/gone_spec.rb not found')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'takes 200 files and refuses 201' do
|
|
99
|
+
files = Array.new(201) { |index| "spec/many/f#{index}_spec.rb" }
|
|
100
|
+
FileUtils.mkdir_p(File.join(root, 'spec/many'))
|
|
101
|
+
files.each { |file| File.write(File.join(root, file), '') }
|
|
102
|
+
|
|
103
|
+
expect([parse(files: files.first(200)).files.size, error_for(files: files)])
|
|
104
|
+
.to eq([200, 'Too many spec files (201): select at most 200, or use a tag'])
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'counts files after removing duplicates' do
|
|
108
|
+
expect(parse(files: %w[spec/a_spec.rb] * 300).files).to eq(%w[spec/a_spec.rb])
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'refuses %NAME% and glob characters in a file on Windows only' do
|
|
112
|
+
%w[a%PATH%_spec.rb a*_spec.rb a?_spec.rb a[1]_spec.rb a{b}_spec.rb].each { |file| File.write(File.join(root, 'spec', file), '') }
|
|
113
|
+
files = %w[spec/a%PATH%_spec.rb spec/a*_spec.rb spec/a?_spec.rb spec/a[1]_spec.rb spec/a{b}_spec.rb]
|
|
114
|
+
|
|
115
|
+
expect([files.map { |file| error_for(files: [file], host_os: windows) }, files.map { |file| error_for(files: [file]) }])
|
|
116
|
+
.to match([all(start_with('Invalid spec file')), all(be_nil)])
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'refuses backslash climbs and drive paths on Windows' do
|
|
120
|
+
errors = ['spec\\..\\..\\x_spec.rb', 'C:/x_spec.rb', '\\\\host\\x_spec.rb'].map { |file| error_for(files: [file], host_os: windows) }
|
|
121
|
+
|
|
122
|
+
expect(errors).to all(start_with('Invalid spec file'))
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
describe '.from_h' do
|
|
127
|
+
it 'reads back what to_h wrote' do
|
|
128
|
+
[parse, parse(tag: 'smoke'), parse(files: %w[spec/a_spec.rb spec/login/c_spec.rb])].each do |selection|
|
|
129
|
+
expect(described_class.from_h(selection.to_h, root: root, host_os: mac).to_h).to eq(selection.to_h)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
it 'loads a selection whose file is gone and names the missing file' do
|
|
134
|
+
selection = described_class.from_h({ 'kind' => 'files', 'files' => %w[spec/a_spec.rb spec/gone_spec.rb] }, root: root, host_os: mac)
|
|
135
|
+
|
|
136
|
+
expect([selection.missing_file(root), parse(files: %w[spec/a_spec.rb]).missing_file(root)]).to eq(['spec/gone_spec.rb', nil])
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'refuses on load a file that exists but resolves outside the project' do
|
|
140
|
+
File.write(File.join(tmp, 'outside_spec.rb'), '')
|
|
141
|
+
File.symlink(File.join(tmp, 'outside_spec.rb'), File.join(root, 'spec/link_spec.rb'))
|
|
142
|
+
|
|
143
|
+
expect(load_error({ 'kind' => 'files', 'files' => %w[spec/link_spec.rb] })).to eq('spec/link_spec.rb points outside the project')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
it 'refuses broken shapes as errors, never anything else' do
|
|
147
|
+
broken = [nil, 'all', [], {}, { 'kind' => 'some' }, { 'kind' => 'tag' }, { 'kind' => 'tag', 'tag' => 'a b' },
|
|
148
|
+
{ 'kind' => 'files' }, { 'kind' => 'files', 'files' => [] }, { 'kind' => 'files', 'files' => 'spec/a_spec.rb' },
|
|
149
|
+
{ 'kind' => 'files', 'files' => [1] }, { 'kind' => 'files', 'files' => ['../x_spec.rb'] },
|
|
150
|
+
{ 'kind' => 'all', 'tag' => 'smoke' }, { 'kind' => 'tag', 'tag' => 'smoke', 'files' => %w[spec/a_spec.rb] },
|
|
151
|
+
{ 'kind' => 'files', 'files' => Array.new(201) { |index| "spec/f#{index}_spec.rb" } }]
|
|
152
|
+
|
|
153
|
+
expect(broken.map { |hash| load_error(hash) }).to all(be_a(String))
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
it 'applies the Windows rules on load' do
|
|
157
|
+
expect(load_error({ 'kind' => 'files', 'files' => %w[spec/a%PATH%_spec.rb] }, host_os: windows)).to start_with('Invalid spec file')
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
describe '#check!' do
|
|
162
|
+
it 'raises for a missing file and returns itself otherwise' do
|
|
163
|
+
gone = described_class.from_h({ 'kind' => 'files', 'files' => %w[spec/gone_spec.rb] }, root: root, host_os: mac)
|
|
164
|
+
present = parse(files: %w[spec/a_spec.rb])
|
|
165
|
+
|
|
166
|
+
expect(present.check!(root)).to be(present)
|
|
167
|
+
expect { gone.check!(root) }.to raise_error(RubyRaider::Schedules::Error, 'spec/gone_spec.rb not found')
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it 'is frozen' do
|
|
172
|
+
selection = parse(files: %w[spec/a_spec.rb])
|
|
173
|
+
|
|
174
|
+
expect([selection, selection.files, selection.files.first]).to all(be_frozen)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tmpdir'
|
|
4
|
+
require_relative '../../../lib/utilities/schedules/spawn'
|
|
5
|
+
|
|
6
|
+
RSpec.describe RubyRaider::Schedules::Spawn do # rubocop:disable RSpec/FilePath
|
|
7
|
+
let(:dir) { File.realpath(Dir.mktmpdir('schedules-spawn')) }
|
|
8
|
+
let(:ready) { File.join(dir, 'ready') }
|
|
9
|
+
let(:got) { File.join(dir, 'got') }
|
|
10
|
+
# Counts the INTs it gets (TERM counts 100), then exits 0
|
|
11
|
+
let(:child) do
|
|
12
|
+
"n = 0; trap('INT') { n += 1 }; trap('TERM') { n += 100 }; File.write(#{ready.inspect}, ''); " \
|
|
13
|
+
"sleep 1.5; File.write(#{got.inspect}, n.to_s)"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
after { FileUtils.rm_rf(dir) }
|
|
17
|
+
|
|
18
|
+
def signal_when_ready(*signals)
|
|
19
|
+
Thread.new do
|
|
20
|
+
sleep 0.05 until File.exist?(ready)
|
|
21
|
+
signals.each { |signal| Process.kill(signal, Process.pid) }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'runs without a shell and returns the exit status, not stopped' do
|
|
26
|
+
result = described_class.call({ 'X' => '; exit 7' }, [RbConfig.ruby, '-e', 'exit(ENV["X"] == "; exit 7" ? 5 : 6)'], dir)
|
|
27
|
+
|
|
28
|
+
expect(result).to eq([5, false])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'unsets a variable given as nil' do
|
|
32
|
+
ENV['RAIDER_SPAWN_SPEC'] = 'inherited'
|
|
33
|
+
result = described_class.call({ 'RAIDER_SPAWN_SPEC' => nil }, [RbConfig.ruby, '-e', 'exit(ENV.key?("RAIDER_SPAWN_SPEC") ? 1 : 0)'], dir)
|
|
34
|
+
|
|
35
|
+
expect(result.first).to eq(0)
|
|
36
|
+
ensure
|
|
37
|
+
ENV.delete('RAIDER_SPAWN_SPEC')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe 'stopping', skip: Gem.win_platform? do
|
|
41
|
+
it 'passes TERM then INT on as one INT when the INT could not have reached the child' do
|
|
42
|
+
signal_when_ready('TERM', 'INT')
|
|
43
|
+
|
|
44
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: true)
|
|
45
|
+
|
|
46
|
+
expect([result, File.read(got)]).to eq([[0, true], '1'])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'does not pass on an INT that the terminal already sent to the child' do
|
|
50
|
+
signal_when_ready('INT')
|
|
51
|
+
|
|
52
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
53
|
+
|
|
54
|
+
expect([result, File.read(got)]).to eq([[0, true], '0'])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'passes TERM on as one INT even when INTs are not forwarded' do
|
|
58
|
+
signal_when_ready('TERM')
|
|
59
|
+
|
|
60
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
61
|
+
|
|
62
|
+
expect([result, File.read(got)]).to eq([[0, true], '1'])
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'sends no second INT for a TERM after a terminal Ctrl-C' do
|
|
66
|
+
signal_when_ready('INT', 'TERM')
|
|
67
|
+
|
|
68
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
69
|
+
|
|
70
|
+
expect([result, File.read(got)]).to eq([[0, true], '0'])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'passes on a stop that came before the child existed, once it does, whatever forward_int says' do
|
|
74
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
75
|
+
state = { pid: nil, stopped: true, interrupted: false }
|
|
76
|
+
|
|
77
|
+
code = described_class.run({}, [RbConfig.ruby, '-e', 'sleep 5'], dir, state, false)
|
|
78
|
+
|
|
79
|
+
expect([code, state[:interrupted], Process.clock_gettime(Process::CLOCK_MONOTONIC) - started < 4]).to eq([nil, true, true])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'forgets the pid once the child is reaped, so a late signal reaches no other process' do
|
|
83
|
+
state = { pid: nil, stopped: false, interrupted: false }
|
|
84
|
+
described_class.run({}, [RbConfig.ruby, '-e', 'exit 0'], dir, state, true)
|
|
85
|
+
described_class.stop(state, 'TERM', true)
|
|
86
|
+
|
|
87
|
+
expect(state).to eq(pid: nil, stopped: true, interrupted: false)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'restores the previous handlers' do
|
|
91
|
+
previous = trap('INT', 'IGNORE')
|
|
92
|
+
described_class.call({}, [RbConfig.ruby, '-e', 'exit 0'], dir)
|
|
93
|
+
|
|
94
|
+
expect(trap('INT', previous)).to eq('IGNORE')
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'returns no exit status with one line on stderr when the command is not found' do
|
|
99
|
+
result = nil
|
|
100
|
+
|
|
101
|
+
expect { result = described_class.call({}, ['raider-no-such-command'], dir) }.to output(/Could not start raider-no-such-command/).to_stderr
|
|
102
|
+
expect(result).to eq([nil, false])
|
|
103
|
+
end
|
|
104
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_raider
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0
|
|
4
|
+
version: 4.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Agustin Pequeno
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler-audit
|
|
@@ -80,6 +80,20 @@ dependencies:
|
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: 3.11.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec-retry
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.6'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.6'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
98
|
name: rubocop
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -261,6 +275,7 @@ files:
|
|
|
261
275
|
- bin/raider
|
|
262
276
|
- bin/release
|
|
263
277
|
- lib/commands/scaffolding_commands.rb
|
|
278
|
+
- lib/commands/schedule_commands.rb
|
|
264
279
|
- lib/commands/utility_commands.rb
|
|
265
280
|
- lib/generators/automation/automation_generator.rb
|
|
266
281
|
- lib/generators/automation/templates/account.tt
|
|
@@ -339,9 +354,11 @@ files:
|
|
|
339
354
|
- lib/ruby_raider/runtime/matchers/presence.rb
|
|
340
355
|
- lib/ruby_raider/runtime/matchers/retrying_block.rb
|
|
341
356
|
- lib/ruby_raider/runtime/observer.rb
|
|
357
|
+
- lib/ruby_raider/runtime/retry_reset.rb
|
|
342
358
|
- lib/ruby_raider/runtime/role_finder.rb
|
|
343
359
|
- lib/ruby_raider/runtime/rspec.rb
|
|
344
360
|
- lib/ruby_raider/runtime/selectors.rb
|
|
361
|
+
- lib/ruby_raider/runtime/show_browser.rb
|
|
345
362
|
- lib/ruby_raider/runtime/strict.rb
|
|
346
363
|
- lib/ruby_raider/runtime/wait.rb
|
|
347
364
|
- lib/scaffolding/name_normalizer.rb
|
|
@@ -354,11 +371,39 @@ files:
|
|
|
354
371
|
- lib/utilities/desktop_downloader.rb
|
|
355
372
|
- lib/utilities/logger.rb
|
|
356
373
|
- lib/utilities/logo.rb
|
|
374
|
+
- lib/utilities/schedules/adapter.rb
|
|
375
|
+
- lib/utilities/schedules/base.rb
|
|
376
|
+
- lib/utilities/schedules/kind.rb
|
|
377
|
+
- lib/utilities/schedules/legacy.rb
|
|
378
|
+
- lib/utilities/schedules/legacy_stub.rb
|
|
379
|
+
- lib/utilities/schedules/next_run.rb
|
|
380
|
+
- lib/utilities/schedules/notifier.rb
|
|
381
|
+
- lib/utilities/schedules/os/command_runner.rb
|
|
382
|
+
- lib/utilities/schedules/os/cron.rb
|
|
383
|
+
- lib/utilities/schedules/os/launchd.rb
|
|
384
|
+
- lib/utilities/schedules/os/linux.rb
|
|
385
|
+
- lib/utilities/schedules/os/systemd.rb
|
|
386
|
+
- lib/utilities/schedules/os/task_scheduler.rb
|
|
387
|
+
- lib/utilities/schedules/os_enumerator.rb
|
|
388
|
+
- lib/utilities/schedules/project.rb
|
|
389
|
+
- lib/utilities/schedules/rule.rb
|
|
390
|
+
- lib/utilities/schedules/run_lock.rb
|
|
391
|
+
- lib/utilities/schedules/run_log.rb
|
|
392
|
+
- lib/utilities/schedules/run_report.rb
|
|
393
|
+
- lib/utilities/schedules/run_wrapper.rb
|
|
394
|
+
- lib/utilities/schedules/schedule.rb
|
|
395
|
+
- lib/utilities/schedules/schedule_store.rb
|
|
396
|
+
- lib/utilities/schedules/scheduler.rb
|
|
397
|
+
- lib/utilities/schedules/scheduler_steps.rb
|
|
398
|
+
- lib/utilities/schedules/selection.rb
|
|
399
|
+
- lib/utilities/schedules/spawn.rb
|
|
400
|
+
- lib/utilities/schedules/store.rb
|
|
357
401
|
- lib/utilities/utilities.rb
|
|
358
402
|
- lib/version
|
|
359
403
|
- plugins.yml
|
|
360
404
|
- ruby_raider.gemspec
|
|
361
405
|
- sig/commands/scaffolding_commands.rbs
|
|
406
|
+
- sig/commands/schedule_commands.rbs
|
|
362
407
|
- sig/commands/utility_commands.rbs
|
|
363
408
|
- sig/generators/automation/automation_generator.rbs
|
|
364
409
|
- sig/generators/common_generator.rbs
|
|
@@ -390,8 +435,10 @@ files:
|
|
|
390
435
|
- sig/ruby_raider/runtime/matchers/presence.rbs
|
|
391
436
|
- sig/ruby_raider/runtime/matchers/retrying_block.rbs
|
|
392
437
|
- sig/ruby_raider/runtime/observer.rbs
|
|
438
|
+
- sig/ruby_raider/runtime/retry_reset.rbs
|
|
393
439
|
- sig/ruby_raider/runtime/role_finder.rbs
|
|
394
440
|
- sig/ruby_raider/runtime/selectors.rbs
|
|
441
|
+
- sig/ruby_raider/runtime/show_browser.rbs
|
|
395
442
|
- sig/ruby_raider/runtime/strict.rbs
|
|
396
443
|
- sig/ruby_raider/runtime/wait.rbs
|
|
397
444
|
- sig/scaffolding/name_normalizer.rbs
|
|
@@ -400,12 +447,40 @@ files:
|
|
|
400
447
|
- sig/utilities/desktop_downloader.rbs
|
|
401
448
|
- sig/utilities/logger.rbs
|
|
402
449
|
- sig/utilities/logo.rbs
|
|
450
|
+
- sig/utilities/schedules/adapter.rbs
|
|
451
|
+
- sig/utilities/schedules/base.rbs
|
|
452
|
+
- sig/utilities/schedules/kind.rbs
|
|
453
|
+
- sig/utilities/schedules/legacy.rbs
|
|
454
|
+
- sig/utilities/schedules/legacy_stub.rbs
|
|
455
|
+
- sig/utilities/schedules/next_run.rbs
|
|
456
|
+
- sig/utilities/schedules/notifier.rbs
|
|
457
|
+
- sig/utilities/schedules/os/command_runner.rbs
|
|
458
|
+
- sig/utilities/schedules/os/cron.rbs
|
|
459
|
+
- sig/utilities/schedules/os/launchd.rbs
|
|
460
|
+
- sig/utilities/schedules/os/linux.rbs
|
|
461
|
+
- sig/utilities/schedules/os/systemd.rbs
|
|
462
|
+
- sig/utilities/schedules/os/task_scheduler.rbs
|
|
463
|
+
- sig/utilities/schedules/os_enumerator.rbs
|
|
464
|
+
- sig/utilities/schedules/project.rbs
|
|
465
|
+
- sig/utilities/schedules/rule.rbs
|
|
466
|
+
- sig/utilities/schedules/run_lock.rbs
|
|
467
|
+
- sig/utilities/schedules/run_log.rbs
|
|
468
|
+
- sig/utilities/schedules/run_report.rbs
|
|
469
|
+
- sig/utilities/schedules/run_wrapper.rbs
|
|
470
|
+
- sig/utilities/schedules/schedule.rbs
|
|
471
|
+
- sig/utilities/schedules/schedule_store.rbs
|
|
472
|
+
- sig/utilities/schedules/scheduler.rbs
|
|
473
|
+
- sig/utilities/schedules/scheduler_steps.rbs
|
|
474
|
+
- sig/utilities/schedules/selection.rbs
|
|
475
|
+
- sig/utilities/schedules/spawn.rbs
|
|
476
|
+
- sig/utilities/schedules/store.rbs
|
|
403
477
|
- sig/utilities/utilities.rbs
|
|
404
478
|
- sig/vendor/selenium_webdriver.rbs
|
|
405
479
|
- sig/vendor/thor.rbs
|
|
406
480
|
- sig/vendor/tty_prompt.rbs
|
|
407
481
|
- spec/commands/raider_commands_spec.rb
|
|
408
482
|
- spec/commands/scaffolding_commands_spec.rb
|
|
483
|
+
- spec/commands/schedule_commands_spec.rb
|
|
409
484
|
- spec/commands/utility_commands_spec.rb
|
|
410
485
|
- spec/generators/fixtures/templates/test.tt
|
|
411
486
|
- spec/generators/fixtures/templates/test_partial.tt
|
|
@@ -475,9 +550,12 @@ files:
|
|
|
475
550
|
- spec/runtime/matchers/presence_spec.rb
|
|
476
551
|
- spec/runtime/matchers/retrying_block_spec.rb
|
|
477
552
|
- spec/runtime/observer_spec.rb
|
|
553
|
+
- spec/runtime/retry_reset_spec.rb
|
|
478
554
|
- spec/runtime/role_finder_spec.rb
|
|
479
555
|
- spec/runtime/role_query_spec.rb
|
|
480
556
|
- spec/runtime/selectors_spec.rb
|
|
557
|
+
- spec/runtime/show_browser_project_spec.rb
|
|
558
|
+
- spec/runtime/show_browser_spec.rb
|
|
481
559
|
- spec/runtime/strict_spec.rb
|
|
482
560
|
- spec/runtime/support/browser.rb
|
|
483
561
|
- spec/runtime/support/fake_bridge.rb
|
|
@@ -490,6 +568,32 @@ files:
|
|
|
490
568
|
- spec/utilities/desktop_downloader_spec.rb
|
|
491
569
|
- spec/utilities/ffmpeg_spec.rb
|
|
492
570
|
- spec/utilities/headless_config_spec.rb
|
|
571
|
+
- spec/utilities/schedules/kind_spec.rb
|
|
572
|
+
- spec/utilities/schedules/legacy_spec.rb
|
|
573
|
+
- spec/utilities/schedules/legacy_stub_spec.rb
|
|
574
|
+
- spec/utilities/schedules/next_run_spec.rb
|
|
575
|
+
- spec/utilities/schedules/notifier_spec.rb
|
|
576
|
+
- spec/utilities/schedules/os/command_runner_spec.rb
|
|
577
|
+
- spec/utilities/schedules/os/cron_spec.rb
|
|
578
|
+
- spec/utilities/schedules/os/launchd_spec.rb
|
|
579
|
+
- spec/utilities/schedules/os/linux_spec.rb
|
|
580
|
+
- spec/utilities/schedules/os/list_ids_spec.rb
|
|
581
|
+
- spec/utilities/schedules/os/systemd_spec.rb
|
|
582
|
+
- spec/utilities/schedules/os/task_scheduler_spec.rb
|
|
583
|
+
- spec/utilities/schedules/os_entry_spec.rb
|
|
584
|
+
- spec/utilities/schedules/os_enumerator_spec.rb
|
|
585
|
+
- spec/utilities/schedules/project_spec.rb
|
|
586
|
+
- spec/utilities/schedules/run_lock_spec.rb
|
|
587
|
+
- spec/utilities/schedules/run_log_spec.rb
|
|
588
|
+
- spec/utilities/schedules/run_report_spec.rb
|
|
589
|
+
- spec/utilities/schedules/run_wrapper_integration_spec.rb
|
|
590
|
+
- spec/utilities/schedules/run_wrapper_spec.rb
|
|
591
|
+
- spec/utilities/schedules/schedule_spec.rb
|
|
592
|
+
- spec/utilities/schedules/schedule_store_spec.rb
|
|
593
|
+
- spec/utilities/schedules/scheduler_launchd_spec.rb
|
|
594
|
+
- spec/utilities/schedules/scheduler_spec.rb
|
|
595
|
+
- spec/utilities/schedules/selection_spec.rb
|
|
596
|
+
- spec/utilities/schedules/spawn_spec.rb
|
|
493
597
|
- spec/utilities/trace_command_spec.rb
|
|
494
598
|
- spec/utilities/utilities_spec.rb
|
|
495
599
|
- spec/utilities/video_command_spec.rb
|