rocketjob_mission_control 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/app/controllers/rocket_job_mission_control/application_controller.rb +1 -1
- data/lib/rocket_job_mission_control/version.rb +1 -1
- data/test/controllers/rocket_job_mission_control/application_controller_test.rb +4 -12
- data/test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb +17 -49
- data/test/controllers/rocket_job_mission_control/jobs_controller_test.rb +14 -35
- data/test/models/rocket_job_mission_control/job_sanitizer_test.rb +9 -3
- data/test/test_helper.rb +1 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7a9ef0aac59fd6cb345b13c503922ea80232f0eedb8d4eb29ea1d535e04c8a
|
4
|
+
data.tar.gz: 360b3994feec93243b9b4cfadf8fa89416538aafb0fbc927b2db31399cc850e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8782d8a249ee6de70705f806386d1f6fb3afbea4f33451ef7e0337641e87c3b88f0cbc804de35131ef46da8f85e3121a694cd79f4171a912809b0330d5e4e6d
|
7
|
+
data.tar.gz: f051ec5acb746f52c71924d757e35c955715838dfc994c82eb6d2cfaa630bb9b50d8b26c2d8fe7a34d392e06084cf9121906591f8951a0b7feae372093021d0b
|
data/Rakefile
CHANGED
@@ -3,8 +3,7 @@ require "rubygems"
|
|
3
3
|
require "bundler/setup"
|
4
4
|
|
5
5
|
require "rails/version"
|
6
|
-
|
7
|
-
APP_RAKEFILE = File.expand_path(rakefile, __FILE__)
|
6
|
+
APP_RAKEFILE = File.expand_path("../rjmc/Rakefile", __FILE__)
|
8
7
|
load "rails/tasks/engine.rake"
|
9
8
|
|
10
9
|
require "rake/testtask"
|
@@ -13,22 +13,14 @@ module RocketJobMissionControl
|
|
13
13
|
describe TestController do
|
14
14
|
describe "#with_time_zone" do
|
15
15
|
it "uses correct timezone with session and time_zone set" do
|
16
|
-
|
17
|
-
|
18
|
-
get :index
|
19
|
-
else
|
20
|
-
get :index, {}, {"time_zone" => "America/Los_Angeles"}
|
21
|
-
end
|
16
|
+
session["time_zone"] = "America/Los_Angeles"
|
17
|
+
get :index
|
22
18
|
assert_equal "America/Los_Angeles", assigns(:time_zone).name
|
23
19
|
end
|
24
20
|
|
25
21
|
it "uses correct timezone with session, but no time_zone set" do
|
26
|
-
|
27
|
-
|
28
|
-
get :index
|
29
|
-
else
|
30
|
-
get :index, {}, {"user_id" => "42"}
|
31
|
-
end
|
22
|
+
session["user_id"] = "42"
|
23
|
+
get :index
|
32
24
|
assert_equal "UTC", assigns(:time_zone).name
|
33
25
|
end
|
34
26
|
|
@@ -37,9 +37,7 @@ module RocketJobMissionControl
|
|
37
37
|
describe "PATCH #enable" do
|
38
38
|
describe "when transition is allowed" do
|
39
39
|
before do
|
40
|
-
params
|
41
|
-
params = {params: params} if Rails.version.to_i >= 5
|
42
|
-
patch :enable, params
|
40
|
+
patch :enable, params: {id: existing_dirmon_entry.id}
|
43
41
|
end
|
44
42
|
|
45
43
|
it do
|
@@ -54,9 +52,7 @@ module RocketJobMissionControl
|
|
54
52
|
describe "when transition is not allowed" do
|
55
53
|
before do
|
56
54
|
existing_dirmon_entry.enable!
|
57
|
-
params
|
58
|
-
params = {params: params} if Rails.version.to_i >= 5
|
59
|
-
patch :enable, params
|
55
|
+
patch :enable, params: {id: existing_dirmon_entry.id}
|
60
56
|
end
|
61
57
|
|
62
58
|
it "succeeds" do
|
@@ -73,9 +69,7 @@ module RocketJobMissionControl
|
|
73
69
|
describe "when transition is allowed" do
|
74
70
|
before do
|
75
71
|
existing_dirmon_entry.enable!
|
76
|
-
params
|
77
|
-
params = {params: params} if Rails.version.to_i >= 5
|
78
|
-
patch :disable, params
|
72
|
+
patch :disable, params: {id: existing_dirmon_entry.id}
|
79
73
|
end
|
80
74
|
|
81
75
|
it do
|
@@ -89,9 +83,7 @@ module RocketJobMissionControl
|
|
89
83
|
|
90
84
|
describe "when transition is not allowed" do
|
91
85
|
before do
|
92
|
-
params
|
93
|
-
params = {params: params} if Rails.version.to_i >= 5
|
94
|
-
patch :disable, params
|
86
|
+
patch :disable, params: {id: existing_dirmon_entry.id}
|
95
87
|
end
|
96
88
|
|
97
89
|
it "succeeds" do
|
@@ -108,9 +100,7 @@ module RocketJobMissionControl
|
|
108
100
|
let(:entry_params) { {} }
|
109
101
|
|
110
102
|
before do
|
111
|
-
params
|
112
|
-
params = {params: entry_params} if Rails.version.to_i >= 5
|
113
|
-
get :new, params
|
103
|
+
get :new, params: entry_params
|
114
104
|
end
|
115
105
|
|
116
106
|
it "succeeds" do
|
@@ -163,8 +153,7 @@ module RocketJobMissionControl
|
|
163
153
|
describe "with valid parameters" do
|
164
154
|
before do
|
165
155
|
params = {id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {pattern: "the_path2", job_class_name: job_class_name}}
|
166
|
-
|
167
|
-
patch :update, params
|
156
|
+
patch :update, params: params
|
168
157
|
end
|
169
158
|
|
170
159
|
it "redirects to the updated entry" do
|
@@ -179,8 +168,7 @@ module RocketJobMissionControl
|
|
179
168
|
describe "with invalid parameters" do
|
180
169
|
before do
|
181
170
|
params = {id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {job_class_name: "FakeAndBadJob"}}
|
182
|
-
|
183
|
-
patch :update, params
|
171
|
+
patch :update, params: params
|
184
172
|
end
|
185
173
|
|
186
174
|
it "renders the edit template" do
|
@@ -209,9 +197,7 @@ module RocketJobMissionControl
|
|
209
197
|
end
|
210
198
|
|
211
199
|
before do
|
212
|
-
params
|
213
|
-
params = {params: params} if Rails.version.to_i >= 5
|
214
|
-
post :create, params
|
200
|
+
post :create, params: {rocket_job_dirmon_entry: dirmon_params}
|
215
201
|
end
|
216
202
|
|
217
203
|
it "creates the entry" do
|
@@ -250,9 +236,7 @@ module RocketJobMissionControl
|
|
250
236
|
end
|
251
237
|
|
252
238
|
before do
|
253
|
-
params
|
254
|
-
params = {params: params} if Rails.version.to_i >= 5
|
255
|
-
post :create, params
|
239
|
+
post :create, params: {rocket_job_dirmon_entry: dirmon_params}
|
256
240
|
end
|
257
241
|
|
258
242
|
describe "on model attributes" do
|
@@ -270,9 +254,7 @@ module RocketJobMissionControl
|
|
270
254
|
|
271
255
|
describe "GET #edit" do
|
272
256
|
before do
|
273
|
-
params
|
274
|
-
params = {params: params} if Rails.version.to_i >= 5
|
275
|
-
get :edit, params
|
257
|
+
get :edit, params: {id: existing_dirmon_entry.id}
|
276
258
|
end
|
277
259
|
|
278
260
|
it "succeeds" do
|
@@ -287,9 +269,7 @@ module RocketJobMissionControl
|
|
287
269
|
describe "GET #show" do
|
288
270
|
describe "with an invalid id" do
|
289
271
|
before do
|
290
|
-
params
|
291
|
-
params = {params: params} if Rails.version.to_i >= 5
|
292
|
-
get :show, params
|
272
|
+
get :show, params: {id: 42}
|
293
273
|
end
|
294
274
|
|
295
275
|
it "redirects" do
|
@@ -303,9 +283,7 @@ module RocketJobMissionControl
|
|
303
283
|
|
304
284
|
describe "with a valid id" do
|
305
285
|
before do
|
306
|
-
params
|
307
|
-
params = {params: params} if Rails.version.to_i >= 5
|
308
|
-
get :show, params
|
286
|
+
get :show, params: {id: existing_dirmon_entry.id}
|
309
287
|
end
|
310
288
|
|
311
289
|
it "succeeds" do
|
@@ -321,9 +299,7 @@ module RocketJobMissionControl
|
|
321
299
|
describe "DELETE #destroy" do
|
322
300
|
describe "with a valid id" do
|
323
301
|
before do
|
324
|
-
params
|
325
|
-
params = {params: params} if Rails.version.to_i >= 5
|
326
|
-
delete :destroy, params
|
302
|
+
delete :destroy, params: {id: existing_dirmon_entry.id}
|
327
303
|
end
|
328
304
|
|
329
305
|
it "redirects to index" do
|
@@ -464,9 +440,7 @@ module RocketJobMissionControl
|
|
464
440
|
%i[admin editor operator manager dirmon].each do |role|
|
465
441
|
it "allows role #{role} to access #{method}" do
|
466
442
|
set_role(role)
|
467
|
-
params
|
468
|
-
params = {params: params} if Rails.version.to_i >= 5
|
469
|
-
patch :enable, params
|
443
|
+
patch :enable, params: {id: existing_dirmon_entry.id}
|
470
444
|
|
471
445
|
assert_response(:redirect)
|
472
446
|
end
|
@@ -478,9 +452,7 @@ module RocketJobMissionControl
|
|
478
452
|
%i[admin editor operator manager dirmon].each do |role|
|
479
453
|
it "creates dirmon entry" do
|
480
454
|
set_role(role)
|
481
|
-
params
|
482
|
-
params = {params: params} if Rails.version.to_i >= 5
|
483
|
-
post :create, params
|
455
|
+
post :create, params: {rocket_job_dirmon_entry: dirmon_params}
|
484
456
|
|
485
457
|
assert_response(:redirect)
|
486
458
|
end
|
@@ -488,9 +460,7 @@ module RocketJobMissionControl
|
|
488
460
|
|
489
461
|
it "deletes dirmon entry" do
|
490
462
|
set_role(:admin)
|
491
|
-
params
|
492
|
-
params = {params: params} if Rails.version.to_i >= 5
|
493
|
-
delete :destroy, params
|
463
|
+
delete :destroy, params: {id: existing_dirmon_entry.id}
|
494
464
|
|
495
465
|
assert_response(:redirect)
|
496
466
|
end
|
@@ -499,9 +469,7 @@ module RocketJobMissionControl
|
|
499
469
|
it "raises authentication error for #{role}" do
|
500
470
|
set_role(role)
|
501
471
|
assert_raises AccessGranted::AccessDenied do
|
502
|
-
params
|
503
|
-
params = {params: params} if Rails.version.to_i >= 5
|
504
|
-
delete :destroy, params
|
472
|
+
delete :destroy, params: {id: existing_dirmon_entry.id}
|
505
473
|
end
|
506
474
|
end
|
507
475
|
end
|
@@ -56,9 +56,7 @@ module RocketJobMissionControl
|
|
56
56
|
describe "PATCH ##{state}" do
|
57
57
|
describe "with an invalid job id" do
|
58
58
|
before do
|
59
|
-
params
|
60
|
-
params = {params: params} if Rails.version.to_i >= 5
|
61
|
-
patch state, params
|
59
|
+
patch state, params: {id: 42, job: {id: 42, priority: 12}}
|
62
60
|
end
|
63
61
|
|
64
62
|
it "redirects" do
|
@@ -81,8 +79,7 @@ module RocketJobMissionControl
|
|
81
79
|
pausable_job.fail!
|
82
80
|
end
|
83
81
|
params = {id: pausable_job.id, job: {id: pausable_job.id, priority: pausable_job.priority}}
|
84
|
-
|
85
|
-
patch state, params
|
82
|
+
patch state, params: params
|
86
83
|
end
|
87
84
|
|
88
85
|
it "redirects to the job" do
|
@@ -100,9 +97,7 @@ module RocketJobMissionControl
|
|
100
97
|
let(:scheduled_job) { RocketJob::Jobs::SimpleJob.create!(run_at: 2.days.from_now) }
|
101
98
|
|
102
99
|
before do
|
103
|
-
params
|
104
|
-
params = {params: params} if Rails.version.to_i >= 5
|
105
|
-
patch :run_now, params
|
100
|
+
patch :run_now, params: {id: scheduled_job.id}
|
106
101
|
end
|
107
102
|
|
108
103
|
it "redirects to the job path" do
|
@@ -117,9 +112,7 @@ module RocketJobMissionControl
|
|
117
112
|
describe "PATCH #update" do
|
118
113
|
describe "with an invalid job id" do
|
119
114
|
before do
|
120
|
-
params
|
121
|
-
params = {params: params} if Rails.version.to_i >= 5
|
122
|
-
patch :update, params
|
115
|
+
patch :update, params: {id: 42, job: {id: 42, priority: 12}}
|
123
116
|
end
|
124
117
|
|
125
118
|
it "redirects" do
|
@@ -134,8 +127,7 @@ module RocketJobMissionControl
|
|
134
127
|
describe "with a valid job id" do
|
135
128
|
before do
|
136
129
|
params = {id: job.id, job: {id: job.id, priority: 12, blah: 23, description: "", log_level: "", state: "failed"}}
|
137
|
-
|
138
|
-
patch :update, params
|
130
|
+
patch :update, params: params
|
139
131
|
end
|
140
132
|
|
141
133
|
it "redirects to the job" do
|
@@ -158,9 +150,7 @@ module RocketJobMissionControl
|
|
158
150
|
describe "GET #show" do
|
159
151
|
describe "with an invalid job id" do
|
160
152
|
before do
|
161
|
-
params
|
162
|
-
params = {params: params} if Rails.version.to_i >= 5
|
163
|
-
get :show, params
|
153
|
+
get :show, params: {id: 42}
|
164
154
|
end
|
165
155
|
|
166
156
|
it "redirects" do
|
@@ -174,9 +164,7 @@ module RocketJobMissionControl
|
|
174
164
|
|
175
165
|
describe "with a valid job id" do
|
176
166
|
before do
|
177
|
-
params
|
178
|
-
params = {params: params} if Rails.version.to_i >= 5
|
179
|
-
get :show, params
|
167
|
+
get :show, params: {id: job.id}
|
180
168
|
end
|
181
169
|
|
182
170
|
it "succeeds" do
|
@@ -192,9 +180,7 @@ module RocketJobMissionControl
|
|
192
180
|
describe "GET #exception" do
|
193
181
|
describe "with an invalid job id" do
|
194
182
|
before do
|
195
|
-
params
|
196
|
-
params = {params: params} if Rails.version.to_i >= 5
|
197
|
-
get :exception, params
|
183
|
+
get :exception, params: {id: 42}
|
198
184
|
end
|
199
185
|
|
200
186
|
it "redirects" do
|
@@ -209,9 +195,7 @@ module RocketJobMissionControl
|
|
209
195
|
describe "with a valid job id" do
|
210
196
|
describe "without an exception" do
|
211
197
|
before do
|
212
|
-
params
|
213
|
-
params = {params: params} if Rails.version.to_i >= 5
|
214
|
-
get :exception, params
|
198
|
+
get :exception, params: {id: failed_job.id, error_type: "Blah"}
|
215
199
|
end
|
216
200
|
|
217
201
|
it "redirects to job path" do
|
@@ -225,9 +209,7 @@ module RocketJobMissionControl
|
|
225
209
|
|
226
210
|
describe "with exception" do
|
227
211
|
before do
|
228
|
-
params
|
229
|
-
params = {params: params} if Rails.version.to_i >= 5
|
230
|
-
get :exception, params
|
212
|
+
get :exception, params: {id: failed_job.id, error_type: "ArgumentError"}
|
231
213
|
end
|
232
214
|
|
233
215
|
it "succeeds" do
|
@@ -404,13 +386,12 @@ module RocketJobMissionControl
|
|
404
386
|
end
|
405
387
|
|
406
388
|
@params = {id: pausable_job.id, job: {id: pausable_job.id, priority: pausable_job.priority}}
|
407
|
-
@params = {params: @params} if Rails.version.to_i >= 5
|
408
389
|
end
|
409
390
|
|
410
391
|
%i[admin editor operator manager].each do |role|
|
411
392
|
it "redirects with #{method} method and role #{role}" do
|
412
393
|
set_role(role)
|
413
|
-
patch method, @params
|
394
|
+
patch method, params: @params
|
414
395
|
assert_response(:redirect)
|
415
396
|
end
|
416
397
|
end
|
@@ -419,7 +400,7 @@ module RocketJobMissionControl
|
|
419
400
|
it "raises authentication error for #{role}" do
|
420
401
|
set_role(role)
|
421
402
|
assert_raises AccessGranted::AccessDenied do
|
422
|
-
patch method, @params
|
403
|
+
patch method, params: @params
|
423
404
|
end
|
424
405
|
end
|
425
406
|
end
|
@@ -431,8 +412,7 @@ module RocketJobMissionControl
|
|
431
412
|
describe "with a failed slice" do
|
432
413
|
it "access ##{method}" do
|
433
414
|
params = {:error_type => "ArgumentError", "record_number" => "9", "id" => failed_job.id}
|
434
|
-
|
435
|
-
get method, params
|
415
|
+
get method, params: params
|
436
416
|
assert_response :success
|
437
417
|
end
|
438
418
|
end
|
@@ -441,8 +421,7 @@ module RocketJobMissionControl
|
|
441
421
|
describe "#update slice" do
|
442
422
|
before do
|
443
423
|
params = {"job" => {"records" => %w[1 2 3]}, "error_type" => "CSV::MalformedCSVError", "offset" => "1", "id" => failed_job.id.to_s}
|
444
|
-
|
445
|
-
post :update_slice, params
|
424
|
+
post :update_slice, params: params
|
446
425
|
end
|
447
426
|
|
448
427
|
it "redirects" do
|
@@ -72,9 +72,15 @@ class JobSanitizerTest < Minitest::Test
|
|
72
72
|
}
|
73
73
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
74
74
|
assert_equal 1, @job.errors.count
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
if Rails.version.to_f >= 6.1
|
76
|
+
assert error = @job.errors.first
|
77
|
+
assert_equal error.attribute, :properties
|
78
|
+
assert error.message.include?("unexpected token"), error
|
79
|
+
else
|
80
|
+
assert error = @job.errors.first
|
81
|
+
assert_equal error.first, :properties
|
82
|
+
assert error.second.include?("unexpected token"), error
|
83
|
+
end
|
78
84
|
assert_equal({hash_field: "{ bad json }", string: "hello"}, cleansed)
|
79
85
|
end
|
80
86
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketjob_mission_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Cloutier
|
8
8
|
- Chris Lamb
|
9
9
|
- Jonathan Whittington
|
10
10
|
- Reid Morrison
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: access-granted
|
@@ -86,7 +86,6 @@ dependencies:
|
|
86
86
|
description: Rocket Job Mission Control is the Web user interface to manage Rocket
|
87
87
|
Job.
|
88
88
|
email:
|
89
|
-
- support@rocketjob.io
|
90
89
|
executables: []
|
91
90
|
extensions: []
|
92
91
|
extra_rdoc_files: []
|
@@ -202,11 +201,11 @@ files:
|
|
202
201
|
- vendor/assets/stylesheets/fontawesome-all.min.css.erb
|
203
202
|
- vendor/assets/stylesheets/selectize.bootstrap3.css
|
204
203
|
- vendor/assets/stylesheets/selectize.css
|
205
|
-
homepage:
|
204
|
+
homepage: https://rocketjob.io
|
206
205
|
licenses:
|
207
206
|
- Apache-2.0
|
208
207
|
metadata: {}
|
209
|
-
post_install_message:
|
208
|
+
post_install_message:
|
210
209
|
rdoc_options: []
|
211
210
|
require_paths:
|
212
211
|
- lib
|
@@ -221,21 +220,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
220
|
- !ruby/object:Gem::Version
|
222
221
|
version: '0'
|
223
222
|
requirements: []
|
224
|
-
rubygems_version: 3.
|
225
|
-
signing_key:
|
223
|
+
rubygems_version: 3.2.3
|
224
|
+
signing_key:
|
226
225
|
specification_version: 4
|
227
226
|
summary: Ruby's missing batch system.
|
228
227
|
test_files:
|
229
|
-
- test/models/rocket_job_mission_control/job_sanitizer_test.rb
|
230
|
-
- test/models/rocket_job_mission_control/query_test.rb
|
231
228
|
- test/compare_hashes.rb
|
232
|
-
- test/
|
233
|
-
- test/controllers/rocket_job_mission_control/jobs_controller_test.rb
|
229
|
+
- test/controllers/rocket_job_mission_control/application_controller_test.rb
|
234
230
|
- test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb
|
231
|
+
- test/controllers/rocket_job_mission_control/jobs_controller_test.rb
|
235
232
|
- test/controllers/rocket_job_mission_control/servers_controller_test.rb
|
236
|
-
- test/controllers/rocket_job_mission_control/application_controller_test.rb
|
237
233
|
- test/helpers/rocket_job_mission_control/application_helper_test.rb
|
238
|
-
- test/helpers/rocket_job_mission_control/servers_helper_test.rb
|
239
234
|
- test/helpers/rocket_job_mission_control/jobs_helper_test.rb
|
240
|
-
- test/helpers/rocket_job_mission_control/slices_helper_test.rb
|
241
235
|
- test/helpers/rocket_job_mission_control/pagination_helper_test.rb
|
236
|
+
- test/helpers/rocket_job_mission_control/servers_helper_test.rb
|
237
|
+
- test/helpers/rocket_job_mission_control/slices_helper_test.rb
|
238
|
+
- test/models/rocket_job_mission_control/job_sanitizer_test.rb
|
239
|
+
- test/models/rocket_job_mission_control/query_test.rb
|
240
|
+
- test/test_helper.rb
|