rocketjob_mission_control 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -23
- data/app/assets/javascripts/rocket_job_mission_control/application.js +1 -0
- data/app/assets/stylesheets/rocket_job_mission_control/base.scss +6 -2
- data/app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb +8 -4
- data/app/controllers/rocket_job_mission_control/jobs_controller.rb +7 -2
- data/app/controllers/rocket_job_mission_control/servers_controller.rb +7 -2
- data/app/datatables/rocket_job_mission_control/abstract_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/jobs_datatable.rb +14 -14
- data/app/models/rocket_job_mission_control/query.rb +1 -1
- data/app/views/layouts/rocket_job_mission_control/partials/_flash.html.erb +1 -1
- data/app/views/layouts/rocket_job_mission_control/partials/_header.html.erb +1 -1
- data/app/views/rocket_job_mission_control/jobs/_status.html.erb +8 -8
- data/config/routes.rb +1 -0
- data/lib/rocket_job_mission_control/version.rb +1 -1
- data/test/controllers/rocket_job_mission_control/dirmon_entries_controller_test.rb +42 -70
- data/test/controllers/rocket_job_mission_control/jobs_controller_test.rb +49 -17
- data/test/controllers/rocket_job_mission_control/servers_controller_test.rb +19 -7
- data/test/helpers/rocket_job_mission_control/slices_helper_test.rb +2 -2
- data/test/models/rocket_job_mission_control/job_sanitizer_test.rb +17 -17
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21d26a16d5a42afc84e40b409b784dc9114a0964
|
4
|
+
data.tar.gz: ba1b5b6abdee92bd07e235365edeba6b4d5be340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603390cc09d91dc638e1014b1121125a2c7438b14e3c360edf1cb666faa434211bcea7aa230d10b9ae934fa62dad0fd03823289b0db9a1ec693e6316fefe43eb
|
7
|
+
data.tar.gz: 51cd9a8828ec473401f1b95dc23c2e0fe56e419d3cb7a965cf86a350ee43d466e55f75bc4ee74d784229e1d8a7bd5ece904072c91d8ac92adfa1d75f06b2505c
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/rocketjob_mission_control.svg)](http://badge.fury.io/rb/rocketjob_mission_control) [![Build Status](https://secure.travis-ci.org/rocketjob/rocketjob_mission_control.png?branch=master)](http://travis-ci.org/rocketjob/rocketjob_mission_control)
|
1
|
+
# Rocket Job Mission Control
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/rocketjob_mission_control.svg)](http://badge.fury.io/rb/rocketjob_mission_control) [![Build Status](https://secure.travis-ci.org/rocketjob/rocketjob_mission_control.png?branch=master)](http://travis-ci.org/rocketjob/rocketjob_mission_control)
|
3
3
|
|
4
|
-
Web based management interface for [
|
4
|
+
Web based management interface for [Rocket Job][0].
|
5
5
|
|
6
6
|
![Screen shot](http://rocketjob.io/images/rjmc_running.png)
|
7
7
|
|
@@ -10,24 +10,24 @@ Web based management interface for [rocketjob][0].
|
|
10
10
|
Production Ready
|
11
11
|
|
12
12
|
Already in use in production processing large files with millions
|
13
|
-
of records, as well as large jobs to walk
|
13
|
+
of records, as well as large jobs to walk through large databases.
|
14
14
|
|
15
15
|
## Features
|
16
16
|
|
17
17
|
Job Management
|
18
18
|
|
19
|
-
* View all queued, running, failed, and running jobs
|
20
|
-
* View all completed jobs where `destroy_on_complete
|
21
|
-
* Pause any running jobs
|
22
|
-
* Resume paused jobs
|
23
|
-
* Retry failed jobs
|
24
|
-
* Abort, or fail queued or running jobs
|
25
|
-
* Destroy a completed or aborted job
|
19
|
+
* View all queued, running, failed, and running jobs.
|
20
|
+
* View all completed jobs where `destroy_on_complete` is `false`.
|
21
|
+
* Pause any running jobs.
|
22
|
+
* Resume paused jobs.
|
23
|
+
* Retry failed jobs.
|
24
|
+
* Abort, or fail queued or running jobs.
|
25
|
+
* Destroy a completed or aborted job.
|
26
26
|
|
27
27
|
Server Management
|
28
28
|
|
29
|
-
* View running servers
|
30
|
-
* Stop servers
|
29
|
+
* View running servers.
|
30
|
+
* Stop servers.
|
31
31
|
|
32
32
|
Running Jobs
|
33
33
|
|
@@ -35,31 +35,30 @@ Running Jobs
|
|
35
35
|
|
36
36
|
Directory Monitor Management
|
37
37
|
|
38
|
-
* Create, update, enable, disable directory monitoring entries
|
38
|
+
* Create, update, enable, disable directory monitoring entries.
|
39
39
|
|
40
40
|
## Documentation
|
41
41
|
|
42
42
|
* [Guide](http://rocketjob.io/mission_control)
|
43
43
|
|
44
|
-
## Rails
|
44
|
+
## Rails Installation
|
45
45
|
|
46
46
|
This gem is a Rails Engine and can be installed directly into existing Rails 4
|
47
|
-
applications.
|
47
|
+
or 5 applications.
|
48
48
|
|
49
|
-
Add
|
49
|
+
Add to Gemfile:
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
gem 'rocketjob_mission_control'
|
53
53
|
```
|
54
54
|
|
55
|
-
Install
|
55
|
+
Install:
|
56
56
|
|
57
57
|
```ruby
|
58
58
|
bundle
|
59
59
|
```
|
60
60
|
|
61
|
-
Add the following route to
|
62
|
-
and retrying failed jobs.
|
61
|
+
Add the following route to `config/routes.rb`:
|
63
62
|
|
64
63
|
```ruby
|
65
64
|
mount RocketJobMissionControl::Engine => 'rocketjob'
|
@@ -74,9 +73,6 @@ This project uses [Semantic Versioning](http://semver.org/).
|
|
74
73
|
* [Michael Cloutier][1]
|
75
74
|
* [Chris Lamb][2]
|
76
75
|
* [Jonathan Whittington][4]
|
77
|
-
|
78
|
-
## Contributors
|
79
|
-
|
80
76
|
* [Reid Morrison][3] :: @reidmorrison
|
81
77
|
|
82
78
|
[0]: http://rocketjob.io
|
@@ -15,6 +15,7 @@
|
|
15
15
|
//= require dataTables/jquery.dataTables
|
16
16
|
//= require dataTables/extras/dataTables.responsive
|
17
17
|
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
|
18
|
+
//= require bootstrap-sprockets
|
18
19
|
//
|
19
20
|
// Selectize is used by Array builder in application_helper#editable_field_html
|
20
21
|
//= require microplugin
|
@@ -257,9 +257,13 @@ table.dataTable thead > tr > th {
|
|
257
257
|
left: 50%;
|
258
258
|
margin-left: -96px !important;
|
259
259
|
display: block;
|
260
|
+
|
260
261
|
img {
|
261
262
|
display: inline;
|
262
263
|
height: 40px;
|
264
|
+
position: relative;
|
265
|
+
bottom: 3px;
|
266
|
+
left: 8px;
|
263
267
|
}
|
264
268
|
}
|
265
269
|
|
@@ -267,10 +271,10 @@ table.dataTable thead > tr > th {
|
|
267
271
|
.last { right: 15px; }
|
268
272
|
|
269
273
|
a.navbar-brand.brand {
|
270
|
-
font-size:
|
274
|
+
font-size: 23px;
|
271
275
|
color: white;
|
272
276
|
font-weight: bold;
|
273
|
-
|
277
|
+
top: -5px;
|
274
278
|
|
275
279
|
span {
|
276
280
|
display: inline-block;
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module RocketJobMissionControl
|
2
2
|
class DirmonEntriesController < RocketJobMissionControl::ApplicationController
|
3
|
-
|
4
|
-
|
3
|
+
if Rails.version.to_i < 5
|
4
|
+
before_filter :find_entry_or_redirect, except: [:index, :disabled, :enabled, :failed, :pending, :new, :create]
|
5
|
+
before_filter :show_sidebar
|
6
|
+
else
|
7
|
+
before_action :find_entry_or_redirect, except: [:index, :disabled, :enabled, :failed, :pending, :new, :create]
|
8
|
+
before_action :show_sidebar
|
9
|
+
end
|
5
10
|
|
6
11
|
def index
|
7
12
|
@data_table_url = dirmon_entries_url(format: 'json')
|
@@ -65,8 +70,7 @@ module RocketJobMissionControl
|
|
65
70
|
if properties = params[:rocket_job_dirmon_entry][:properties]
|
66
71
|
@dirmon_entry.properties = JobSanitizer.sanitize(properties, @dirmon_entry.job_class, @dirmon_entry, false)
|
67
72
|
end
|
68
|
-
|
69
|
-
if @dirmon_entry.errors.empty? && @dirmon_entry.valid? && @dirmon_entry.save
|
73
|
+
if @dirmon_entry.errors.empty? && @dirmon_entry.valid? && @dirmon_entry.update_attributes(dirmon_params)
|
70
74
|
redirect_to(rocket_job_mission_control.dirmon_entry_path(@dirmon_entry))
|
71
75
|
else
|
72
76
|
render :edit
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module RocketJobMissionControl
|
2
2
|
class JobsController < RocketJobMissionControl::ApplicationController
|
3
|
-
|
4
|
-
|
3
|
+
if Rails.version.to_i < 5
|
4
|
+
before_filter :find_job_or_redirect, except: [:index, :aborted, :completed, :failed, :paused, :queued, :running, :scheduled]
|
5
|
+
before_filter :show_sidebar
|
6
|
+
else
|
7
|
+
before_action :find_job_or_redirect, except: [:index, :aborted, :completed, :failed, :paused, :queued, :running, :scheduled]
|
8
|
+
before_action :show_sidebar
|
9
|
+
end
|
5
10
|
rescue_from StandardError, with: :error_occurred
|
6
11
|
|
7
12
|
def index
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module RocketJobMissionControl
|
2
2
|
class ServersController < RocketJobMissionControl::ApplicationController
|
3
|
-
|
4
|
-
|
3
|
+
if Rails.version.to_i < 5
|
4
|
+
before_filter :find_server_or_redirect, only: [:stop, :pause, :resume, :destroy]
|
5
|
+
before_filter :show_sidebar
|
6
|
+
else
|
7
|
+
before_action :find_server_or_redirect, only: [:stop, :pause, :resume, :destroy]
|
8
|
+
before_action :show_sidebar
|
9
|
+
end
|
5
10
|
|
6
11
|
def index
|
7
12
|
@data_table_url = servers_url(format: 'json')
|
@@ -1,28 +1,28 @@
|
|
1
1
|
module RocketJobMissionControl
|
2
2
|
class JobsDatatable < AbstractDatatable
|
3
3
|
delegate :job_path, :job_icon, :edit_job_path,
|
4
|
-
|
5
|
-
|
4
|
+
:abort_job_path, :job_path, :fail_job_path, :run_now_job_path, :pause_job_path,
|
5
|
+
:resume_job_path, :retry_job_path, :exception_job_path, :job_action_link, :exceptions_job_path, to: :@view
|
6
6
|
|
7
7
|
COMMON_FIELDS = [:id, :_type, :description, :completed_at, :created_at, :started_at, :state].freeze
|
8
8
|
|
9
|
-
ABORTED_COLUMNS
|
9
|
+
ABORTED_COLUMNS = [
|
10
10
|
{display: 'Class', value: :class_with_link, field: '_type', width: '30%'},
|
11
11
|
{display: 'Description', value: :description, field: 'description', width: '30%'},
|
12
12
|
{display: 'Aborted', value: :completed_ago, field: 'completed_at'},
|
13
13
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
14
14
|
]
|
15
15
|
|
16
|
-
ALL_COLUMNS
|
16
|
+
ALL_COLUMNS = [
|
17
17
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
18
18
|
{display: 'Description', value: :description, field: 'description'},
|
19
19
|
{display: 'Created', value: :created_at, field: 'created_at'},
|
20
20
|
{display: 'Duration', value: :duration, field: 'duration', orderable: false},
|
21
21
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
22
22
|
]
|
23
|
-
ALL_FIELDS
|
23
|
+
ALL_FIELDS = COMMON_FIELDS + [:run_at].freeze
|
24
24
|
|
25
|
-
COMPLETED_COLUMNS
|
25
|
+
COMPLETED_COLUMNS = [
|
26
26
|
{display: 'Class', value: :class_with_link, field: '_type', width: '30%'},
|
27
27
|
{display: 'Description', value: :description, field: 'description', width: '30%'},
|
28
28
|
{display: 'Duration', value: :duration, field: 'duration', orderable: false},
|
@@ -36,16 +36,16 @@ module RocketJobMissionControl
|
|
36
36
|
PAUSED_COLUMNS = ABORTED_COLUMNS.deep_dup
|
37
37
|
PAUSED_COLUMNS[2][:display] = 'Paused'
|
38
38
|
|
39
|
-
QUEUED_COLUMNS
|
39
|
+
QUEUED_COLUMNS = [
|
40
40
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
41
41
|
{display: 'Description', value: :description, field: 'description'},
|
42
42
|
{display: 'Priority', value: :priority, field: 'priority'},
|
43
43
|
{display: 'Queued For', value: :duration, field: 'duration', orderable: false},
|
44
44
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
45
45
|
]
|
46
|
-
QUEUED_FIELDS
|
46
|
+
QUEUED_FIELDS = COMMON_FIELDS + [:run_at, :priority].freeze
|
47
47
|
|
48
|
-
RUNNING_COLUMNS
|
48
|
+
RUNNING_COLUMNS = [
|
49
49
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
50
50
|
{display: 'Description', value: :description, field: 'description'},
|
51
51
|
{display: 'Progress', value: :progress, field: 'percent_complete', orderable: false},
|
@@ -53,16 +53,16 @@ module RocketJobMissionControl
|
|
53
53
|
{display: 'Started', value: :started, field: 'started_at'},
|
54
54
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
55
55
|
]
|
56
|
-
RUNNING_FIELDS
|
56
|
+
RUNNING_FIELDS = COMMON_FIELDS + [:record_count, :collect_output, :input_categories, :output_categories, :encrypt, :compress, :slice_size, :priority, :sub_state, :percent_complete].freeze
|
57
57
|
|
58
|
-
SCHEDULED_COLUMNS
|
58
|
+
SCHEDULED_COLUMNS = [
|
59
59
|
{display: 'Class', value: :class_with_link, field: '_type'},
|
60
60
|
{display: 'Description', value: :description, field: 'description'},
|
61
61
|
{display: 'Runs in', value: :time_till_run, field: 'run_at'},
|
62
62
|
{display: 'Cron Schedule', value: :cron_schedule, field: 'cron_schedule'},
|
63
63
|
{display: 'Actions', value: :action_buttons, orderable: false}
|
64
64
|
]
|
65
|
-
SCHEDULED_FIELDS
|
65
|
+
SCHEDULED_FIELDS = COMMON_FIELDS + [:run_at, :cron_schedule].freeze
|
66
66
|
|
67
67
|
def initialize(view, query, columns)
|
68
68
|
@columns = columns
|
@@ -78,10 +78,10 @@ module RocketJobMissionControl
|
|
78
78
|
# Map the values for each column
|
79
79
|
def map(job)
|
80
80
|
index = 0
|
81
|
-
h
|
81
|
+
h = {}
|
82
82
|
@columns.each do |column|
|
83
83
|
h[index.to_s] = send(column[:value], job)
|
84
|
-
index
|
84
|
+
index += 1
|
85
85
|
end
|
86
86
|
h['DT_RowClass'] = "card callout callout-#{job.state}"
|
87
87
|
h
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<span class="icon-bar"></span>
|
9
9
|
</button>
|
10
10
|
<a class="navbar-brand brand" href="http://rocketjob.io" target="_blank">
|
11
|
-
|
11
|
+
<%= image_tag('rocket_job_mission_control/rocket-icon-64x64.png') %>
|
12
12
|
Rocket Job
|
13
13
|
</a>
|
14
14
|
</div>
|
@@ -1,23 +1,23 @@
|
|
1
1
|
<% status = job.status(Time.zone) %>
|
2
|
-
<div class="id"><label>ID:</label
|
2
|
+
<div class="id"><label>ID:</label> <%= status.delete('_id') %></div>
|
3
3
|
|
4
4
|
<% if description = status.delete('description') %>
|
5
|
-
<div class="status-message"><label>Description:</label
|
5
|
+
<div class="status-message"><label>Description:</label> <%= description %></div>
|
6
6
|
<% end %>
|
7
7
|
<% if duration = status.delete('duration') %>
|
8
|
-
<div class="status-message"><label>Duration:</label
|
8
|
+
<div class="status-message"><label>Duration:</label> <%= duration %></div>
|
9
9
|
<% end %>
|
10
10
|
<% if record_count = status.delete('record_count') %>
|
11
|
-
<div class="status-message"><label>Record Count:</label
|
11
|
+
<div class="status-message"><label>Record Count:</label> <%= record_count %></div>
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
<div class="created_at"><label>Created At:</label
|
14
|
+
<div class="created_at"><label>Created At:</label> <%= status.delete('created_at') %></div>
|
15
15
|
|
16
16
|
<% if started_at = status.delete('started_at') %>
|
17
|
-
<div class="status-message"><label>Started At:</label
|
17
|
+
<div class="status-message"><label>Started At:</label> <%= started_at %></div>
|
18
18
|
<% end %>
|
19
19
|
<% if percent_complete = status.delete('percent_complete') %>
|
20
|
-
<div class="status-message"><label>% Complete:</label
|
20
|
+
<div class="status-message"><label>% Complete:</label> <%= percent_complete %></div>
|
21
21
|
<% end %>
|
22
22
|
|
23
23
|
<%
|
@@ -29,7 +29,7 @@
|
|
29
29
|
next
|
30
30
|
end
|
31
31
|
%>
|
32
|
-
<div class="status-message"><label><%= key.to_s.titleize %>:</label
|
32
|
+
<div class="status-message"><label><%= key.to_s.titleize %>:</label> <%= value %></div>
|
33
33
|
<% end %>
|
34
34
|
|
35
35
|
<div class="clearfix"></div>
|
data/config/routes.rb
CHANGED
@@ -37,11 +37,9 @@ module RocketJobMissionControl
|
|
37
37
|
describe 'PATCH #enable' do
|
38
38
|
describe 'when transition is allowed' do
|
39
39
|
before do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
patch :enable, id: existing_dirmon_entry.id
|
44
|
-
end
|
40
|
+
params = {id: existing_dirmon_entry.id}
|
41
|
+
params = {params: params} if Rails.version.to_i >= 5
|
42
|
+
patch :enable, params
|
45
43
|
end
|
46
44
|
|
47
45
|
it do
|
@@ -56,11 +54,9 @@ module RocketJobMissionControl
|
|
56
54
|
describe 'when transition is not allowed' do
|
57
55
|
before do
|
58
56
|
existing_dirmon_entry.enable!
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
patch :enable, id: existing_dirmon_entry.id
|
63
|
-
end
|
57
|
+
params = {id: existing_dirmon_entry.id}
|
58
|
+
params = {params: params} if Rails.version.to_i >= 5
|
59
|
+
patch :enable, params
|
64
60
|
end
|
65
61
|
|
66
62
|
it 'succeeds' do
|
@@ -77,11 +73,9 @@ module RocketJobMissionControl
|
|
77
73
|
describe 'when transition is allowed' do
|
78
74
|
before do
|
79
75
|
existing_dirmon_entry.enable!
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
patch :disable, id: existing_dirmon_entry.id
|
84
|
-
end
|
76
|
+
params = {id: existing_dirmon_entry.id}
|
77
|
+
params = {params: params} if Rails.version.to_i >= 5
|
78
|
+
patch :disable, params
|
85
79
|
end
|
86
80
|
|
87
81
|
it do
|
@@ -95,11 +89,9 @@ module RocketJobMissionControl
|
|
95
89
|
|
96
90
|
describe 'when transition is not allowed' do
|
97
91
|
before do
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
patch :disable, id: existing_dirmon_entry.id
|
102
|
-
end
|
92
|
+
params = {id: existing_dirmon_entry.id}
|
93
|
+
params = {params: params} if Rails.version.to_i >= 5
|
94
|
+
patch :disable, params
|
103
95
|
end
|
104
96
|
|
105
97
|
it 'succeeds' do
|
@@ -116,11 +108,9 @@ module RocketJobMissionControl
|
|
116
108
|
let(:entry_params) { {} }
|
117
109
|
|
118
110
|
before do
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
get :new, entry_params
|
123
|
-
end
|
111
|
+
params = entry_params
|
112
|
+
params = {params: entry_params} if Rails.version.to_i >= 5
|
113
|
+
get :new, params
|
124
114
|
end
|
125
115
|
|
126
116
|
it 'succeeds' do
|
@@ -173,11 +163,9 @@ module RocketJobMissionControl
|
|
173
163
|
describe 'PATCH #update' do
|
174
164
|
describe 'with valid parameters' do
|
175
165
|
before do
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
patch :update, id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {pattern: 'the_path2', job_class_name: job_class_name}
|
180
|
-
end
|
166
|
+
params = {id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {pattern: 'the_path2', job_class_name: job_class_name}}
|
167
|
+
params = {params: params} if Rails.version.to_i >= 5
|
168
|
+
patch :update, params
|
181
169
|
end
|
182
170
|
|
183
171
|
it 'redirects to the updated entry' do
|
@@ -185,27 +173,23 @@ module RocketJobMissionControl
|
|
185
173
|
end
|
186
174
|
|
187
175
|
it 'updates the entry' do
|
188
|
-
|
189
|
-
#assert_equal 'the_path2', existing_dirmon_entry.reload.pattern
|
176
|
+
assert_equal 'the_path2', existing_dirmon_entry.reload.pattern
|
190
177
|
end
|
191
178
|
end
|
192
179
|
|
193
180
|
describe 'with invalid parameters' do
|
194
181
|
before do
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
patch :update, id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {job_class_name: 'FakeAndBadJob'}
|
199
|
-
end
|
182
|
+
params = {id: existing_dirmon_entry.id, rocket_job_dirmon_entry: {job_class_name: 'FakeAndBadJob'}}
|
183
|
+
params = {params: params} if Rails.version.to_i >= 5
|
184
|
+
patch :update, params
|
200
185
|
end
|
201
186
|
|
202
187
|
it 'renders the edit template' do
|
203
|
-
|
188
|
+
assert_response :success
|
204
189
|
end
|
205
190
|
|
206
191
|
it 'alerts the user' do
|
207
|
-
|
208
|
-
#assert_select 'div.message', "job_class_name: #{I18n.t(:failure, scope: [:dirmon_entry, :disable])}"
|
192
|
+
assert_select 'div.message', "job_class_name: [\"job_class_name must be defined and must be derived from RocketJob::Job\"]"
|
209
193
|
end
|
210
194
|
end
|
211
195
|
end
|
@@ -222,11 +206,9 @@ module RocketJobMissionControl
|
|
222
206
|
end
|
223
207
|
|
224
208
|
before do
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
post :create, rocket_job_dirmon_entry: dirmon_params
|
229
|
-
end
|
209
|
+
params = {rocket_job_dirmon_entry: dirmon_params}
|
210
|
+
params = {params: params} if Rails.version.to_i >= 5
|
211
|
+
post :create, params
|
230
212
|
end
|
231
213
|
|
232
214
|
it 'creates the entry' do
|
@@ -265,11 +247,9 @@ module RocketJobMissionControl
|
|
265
247
|
end
|
266
248
|
|
267
249
|
before do
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
post :create, rocket_job_dirmon_entry: dirmon_params
|
272
|
-
end
|
250
|
+
params = {rocket_job_dirmon_entry: dirmon_params}
|
251
|
+
params = {params: params} if Rails.version.to_i >= 5
|
252
|
+
post :create, params
|
273
253
|
end
|
274
254
|
|
275
255
|
describe 'on model attributes' do
|
@@ -287,11 +267,9 @@ module RocketJobMissionControl
|
|
287
267
|
|
288
268
|
describe 'GET #edit' do
|
289
269
|
before do
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
get :edit, id: existing_dirmon_entry.id
|
294
|
-
end
|
270
|
+
params = {id: existing_dirmon_entry.id}
|
271
|
+
params = {params: params} if Rails.version.to_i >= 5
|
272
|
+
get :edit, params
|
295
273
|
end
|
296
274
|
|
297
275
|
it 'succeeds' do
|
@@ -306,11 +284,9 @@ module RocketJobMissionControl
|
|
306
284
|
describe 'GET #show' do
|
307
285
|
describe 'with an invalid id' do
|
308
286
|
before do
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
get :show, id: 42
|
313
|
-
end
|
287
|
+
params = {id: 42}
|
288
|
+
params = {params: params} if Rails.version.to_i >= 5
|
289
|
+
get :show, params
|
314
290
|
end
|
315
291
|
|
316
292
|
it 'redirects' do
|
@@ -324,11 +300,9 @@ module RocketJobMissionControl
|
|
324
300
|
|
325
301
|
describe 'with a valid id' do
|
326
302
|
before do
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
get :show, id: existing_dirmon_entry.id
|
331
|
-
end
|
303
|
+
params = {id: existing_dirmon_entry.id}
|
304
|
+
params = {params: params} if Rails.version.to_i >= 5
|
305
|
+
get :show, params
|
332
306
|
end
|
333
307
|
|
334
308
|
it 'succeeds' do
|
@@ -344,11 +318,9 @@ module RocketJobMissionControl
|
|
344
318
|
describe 'DELETE #destroy' do
|
345
319
|
describe 'with a valid id' do
|
346
320
|
before do
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
delete :destroy, id: existing_dirmon_entry.id
|
351
|
-
end
|
321
|
+
params = {id: existing_dirmon_entry.id}
|
322
|
+
params = {params: params} if Rails.version.to_i >= 5
|
323
|
+
delete :destroy, params
|
352
324
|
end
|
353
325
|
|
354
326
|
it 'redirects to index' do
|
@@ -3,6 +3,15 @@ require_relative '../../compare_hashes'
|
|
3
3
|
|
4
4
|
module RocketJobMissionControl
|
5
5
|
class JobsControllerTest < ActionController::TestCase
|
6
|
+
|
7
|
+
class PausableJob < RocketJob::Job
|
8
|
+
self.pausable = true
|
9
|
+
|
10
|
+
def perform
|
11
|
+
21
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
6
15
|
describe JobsController do
|
7
16
|
before do
|
8
17
|
RocketJob::Job.delete_all
|
@@ -12,6 +21,10 @@ module RocketJobMissionControl
|
|
12
21
|
RocketJob::Jobs::SimpleJob.create!
|
13
22
|
end
|
14
23
|
|
24
|
+
let :pausable_job do
|
25
|
+
PausableJob.create!
|
26
|
+
end
|
27
|
+
|
15
28
|
let :failed_job do
|
16
29
|
job = KaboomBatchJob.new(slice_size: 1)
|
17
30
|
job.upload do |stream|
|
@@ -44,7 +57,9 @@ module RocketJobMissionControl
|
|
44
57
|
describe "PATCH ##{state}" do
|
45
58
|
describe 'with an invalid job id' do
|
46
59
|
before do
|
47
|
-
|
60
|
+
params = {id: 42, job: {id: 42, priority: 12}}
|
61
|
+
params = {params: params} if Rails.version.to_i >= 5
|
62
|
+
patch state, params
|
48
63
|
end
|
49
64
|
|
50
65
|
it 'redirects' do
|
@@ -60,21 +75,23 @@ module RocketJobMissionControl
|
|
60
75
|
before do
|
61
76
|
case state
|
62
77
|
when :pause, :fail, :abort
|
63
|
-
|
78
|
+
pausable_job.start!
|
64
79
|
when :resume
|
65
|
-
|
80
|
+
pausable_job.pause!
|
66
81
|
when :retry
|
67
|
-
|
82
|
+
pausable_job.fail!
|
68
83
|
end
|
69
|
-
|
84
|
+
params = {id: pausable_job.id, job: {id: pausable_job.id, priority: pausable_job.priority}}
|
85
|
+
params = {params: params} if Rails.version.to_i >= 5
|
86
|
+
patch state, params
|
70
87
|
end
|
71
88
|
|
72
89
|
it 'redirects to the job' do
|
73
|
-
assert_redirected_to job_path(
|
90
|
+
assert_redirected_to job_path(pausable_job.id)
|
74
91
|
end
|
75
92
|
|
76
93
|
it 'transitions the job' do
|
77
|
-
refute_equal state,
|
94
|
+
refute_equal state, pausable_job.state
|
78
95
|
end
|
79
96
|
end
|
80
97
|
end
|
@@ -84,7 +101,9 @@ module RocketJobMissionControl
|
|
84
101
|
let(:scheduled_job) { RocketJob::Jobs::SimpleJob.create!(run_at: 2.days.from_now) }
|
85
102
|
|
86
103
|
before do
|
87
|
-
|
104
|
+
params = {id: scheduled_job.id}
|
105
|
+
params = {params: params} if Rails.version.to_i >= 5
|
106
|
+
patch :run_now, params
|
88
107
|
end
|
89
108
|
|
90
109
|
it 'redirects to the job path' do
|
@@ -100,7 +119,9 @@ module RocketJobMissionControl
|
|
100
119
|
describe "PATCH #update" do
|
101
120
|
describe 'with an invalid job id' do
|
102
121
|
before do
|
103
|
-
|
122
|
+
params = {id: 42, job: {id: 42, priority: 12}}
|
123
|
+
params = {params: params} if Rails.version.to_i >= 5
|
124
|
+
patch :update, params
|
104
125
|
end
|
105
126
|
|
106
127
|
it 'redirects' do
|
@@ -114,7 +135,9 @@ module RocketJobMissionControl
|
|
114
135
|
|
115
136
|
describe "with a valid job id" do
|
116
137
|
before do
|
117
|
-
|
138
|
+
params = {id: job.id, job: {id: job.id, priority: 12, blah: 23, description: '', log_level: '', state: 'failed'}}
|
139
|
+
params = {params: params} if Rails.version.to_i >= 5
|
140
|
+
patch :update, params
|
118
141
|
end
|
119
142
|
|
120
143
|
it 'redirects to the job' do
|
@@ -137,7 +160,9 @@ module RocketJobMissionControl
|
|
137
160
|
describe 'GET #show' do
|
138
161
|
describe 'with an invalid job id' do
|
139
162
|
before do
|
140
|
-
|
163
|
+
params = {id: 42}
|
164
|
+
params = {params: params} if Rails.version.to_i >= 5
|
165
|
+
get :show, params
|
141
166
|
end
|
142
167
|
|
143
168
|
it 'redirects' do
|
@@ -151,7 +176,9 @@ module RocketJobMissionControl
|
|
151
176
|
|
152
177
|
describe "with a valid job id" do
|
153
178
|
before do
|
154
|
-
|
179
|
+
params = {id: job.id}
|
180
|
+
params = {params: params} if Rails.version.to_i >= 5
|
181
|
+
get :show, params
|
155
182
|
end
|
156
183
|
|
157
184
|
it 'succeeds' do
|
@@ -167,7 +194,9 @@ module RocketJobMissionControl
|
|
167
194
|
describe 'GET #exception' do
|
168
195
|
describe 'with an invalid job id' do
|
169
196
|
before do
|
170
|
-
|
197
|
+
params = {id: 42}
|
198
|
+
params = {params: params} if Rails.version.to_i >= 5
|
199
|
+
get :exception, params
|
171
200
|
end
|
172
201
|
|
173
202
|
it 'redirects' do
|
@@ -181,13 +210,14 @@ module RocketJobMissionControl
|
|
181
210
|
|
182
211
|
describe 'with a valid job id' do
|
183
212
|
before do
|
184
|
-
skip
|
185
|
-
get :exception, id: failed_job.id, error_type: 'Blah'
|
213
|
+
skip('Only tested with Rocket Job Pro') unless defined?(RocketJob::Plugins::Batch)
|
186
214
|
end
|
187
215
|
|
188
216
|
describe 'without an exception' do
|
189
217
|
before do
|
190
|
-
|
218
|
+
params = {id: failed_job.id, error_type: 'Blah'}
|
219
|
+
params = {params: params} if Rails.version.to_i >= 5
|
220
|
+
get :exception, params
|
191
221
|
end
|
192
222
|
|
193
223
|
it 'redirects to job path' do
|
@@ -201,7 +231,9 @@ module RocketJobMissionControl
|
|
201
231
|
|
202
232
|
describe 'with exception' do
|
203
233
|
before do
|
204
|
-
|
234
|
+
params = {id: failed_job.id, error_type: 'ArgumentError'}
|
235
|
+
params = {params: params} if Rails.version.to_i >= 5
|
236
|
+
get :exception, params
|
205
237
|
end
|
206
238
|
|
207
239
|
it 'succeeds' do
|
@@ -31,7 +31,9 @@ module RocketJobMissionControl
|
|
31
31
|
describe 'with a valid server id' do
|
32
32
|
before do
|
33
33
|
server.pause! if server_action == :resume
|
34
|
-
|
34
|
+
params = {id: server.id}
|
35
|
+
params = {params: params} if Rails.version.to_i >= 5
|
36
|
+
patch server_action, params
|
35
37
|
end
|
36
38
|
|
37
39
|
it 'redirects to servers' do
|
@@ -48,7 +50,9 @@ module RocketJobMissionControl
|
|
48
50
|
before do
|
49
51
|
server.pause! if server_action == :pause
|
50
52
|
server.stop! if server_action == :stop
|
51
|
-
|
53
|
+
params = {id: server.id}
|
54
|
+
params = {params: params} if Rails.version.to_i >= 5
|
55
|
+
patch server_action, params
|
52
56
|
end
|
53
57
|
|
54
58
|
it 'redirects to servers' do
|
@@ -66,7 +70,9 @@ module RocketJobMissionControl
|
|
66
70
|
RocketJobMissionControl::ServersController::VALID_ACTIONS.each do |server_action, action_message|
|
67
71
|
describe "with '#{server_action}' as the server_action param" do
|
68
72
|
before do
|
69
|
-
|
73
|
+
params = {server_action: server_action}
|
74
|
+
params = {params: params} if Rails.version.to_i >= 5
|
75
|
+
patch :update_all, params
|
70
76
|
end
|
71
77
|
|
72
78
|
it 'redirects to servers' do
|
@@ -81,7 +87,9 @@ module RocketJobMissionControl
|
|
81
87
|
|
82
88
|
describe 'with an invalid server_action param' do
|
83
89
|
before do
|
84
|
-
|
90
|
+
params = {server_action: :bad_server_action}
|
91
|
+
params = {params: params} if Rails.version.to_i >= 5
|
92
|
+
patch :update_all, params
|
85
93
|
end
|
86
94
|
|
87
95
|
it 'redirects to servers' do
|
@@ -101,7 +109,9 @@ module RocketJobMissionControl
|
|
101
109
|
describe 'DELETE #destroy' do
|
102
110
|
describe 'with a valid server id' do
|
103
111
|
before do
|
104
|
-
|
112
|
+
params = {id: server.id}
|
113
|
+
params = {params: params} if Rails.version.to_i >= 5
|
114
|
+
delete :destroy, params
|
105
115
|
end
|
106
116
|
|
107
117
|
it 'redirects to servers' do
|
@@ -119,7 +129,9 @@ module RocketJobMissionControl
|
|
119
129
|
|
120
130
|
describe 'when the server is not found' do
|
121
131
|
before do
|
122
|
-
|
132
|
+
params = {id: 999999}
|
133
|
+
params = {params: params} if Rails.version.to_i >= 5
|
134
|
+
delete :destroy, params
|
123
135
|
end
|
124
136
|
|
125
137
|
it 'redirects to servers' do
|
@@ -192,7 +204,7 @@ module RocketJobMissionControl
|
|
192
204
|
|
193
205
|
it 'succeeds' do
|
194
206
|
assert_response :success
|
195
|
-
json
|
207
|
+
json = JSON.parse(response.body)
|
196
208
|
expected_data = {
|
197
209
|
starting: {
|
198
210
|
"0" => /#{RocketJob::Server.starting.first.name}/,
|
@@ -16,11 +16,11 @@ module RocketJobMissionControl
|
|
16
16
|
|
17
17
|
describe 'when not encrypted' do
|
18
18
|
it "does not return 'encrypted'" do
|
19
|
-
refute_equal 'encrypted', display_slice_info([1,2], false)
|
19
|
+
refute_equal 'encrypted', display_slice_info([1, 2], false)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "displays the slice info" do
|
23
|
-
assert_equal "[<br /> 1,<br /> 2<br />]", display_slice_info([1,2], false)
|
23
|
+
assert_equal "[<br /> 1,<br /> 2<br />]", display_slice_info([1, 2], false)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -21,15 +21,15 @@ class JobSanitizerTest < Minitest::Test
|
|
21
21
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
22
22
|
assert_equal 0, @job.errors.count
|
23
23
|
assert_equal 3, cleansed.count
|
24
|
-
assert_equal({:string=>"hello", :integer=>"12", :symbol=>"name"}, cleansed)
|
24
|
+
assert_equal({:string => "hello", :integer => "12", :symbol => "name"}, cleansed)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'strips blank values' do
|
28
28
|
properties = {
|
29
|
-
string:
|
30
|
-
integer:
|
31
|
-
symbol:
|
32
|
-
secure:
|
29
|
+
string: '',
|
30
|
+
integer: '',
|
31
|
+
symbol: '',
|
32
|
+
secure: 'Not permissible',
|
33
33
|
log_level: ''
|
34
34
|
}
|
35
35
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
@@ -39,11 +39,11 @@ class JobSanitizerTest < Minitest::Test
|
|
39
39
|
|
40
40
|
it 'nils blank values' do
|
41
41
|
properties = {
|
42
|
-
string:
|
43
|
-
integer:
|
44
|
-
symbol:
|
45
|
-
hash:
|
46
|
-
secure:
|
42
|
+
string: '',
|
43
|
+
integer: '',
|
44
|
+
symbol: '',
|
45
|
+
hash: '',
|
46
|
+
secure: 'Not permissible',
|
47
47
|
log_level: ''
|
48
48
|
}
|
49
49
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, true)
|
@@ -54,9 +54,9 @@ class JobSanitizerTest < Minitest::Test
|
|
54
54
|
|
55
55
|
it 'parses JSON' do
|
56
56
|
properties = {
|
57
|
-
string:
|
58
|
-
secure:
|
59
|
-
hash:
|
57
|
+
string: '',
|
58
|
+
secure: 'Not permissible',
|
59
|
+
hash: '{"state":"FL"}'
|
60
60
|
}
|
61
61
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
62
62
|
assert_equal 0, @job.errors.count
|
@@ -66,9 +66,9 @@ class JobSanitizerTest < Minitest::Test
|
|
66
66
|
|
67
67
|
it 'sets the error for invalid JSON' do
|
68
68
|
properties = {
|
69
|
-
string:
|
70
|
-
secure:
|
71
|
-
hash:
|
69
|
+
string: 'hello',
|
70
|
+
secure: 'Not permissible',
|
71
|
+
hash: '{ bad json }'
|
72
72
|
}
|
73
73
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
74
74
|
assert_equal 1, @job.errors.count
|
@@ -80,7 +80,7 @@ class JobSanitizerTest < Minitest::Test
|
|
80
80
|
|
81
81
|
it 'Keeps empty JSON Hash' do
|
82
82
|
properties = {
|
83
|
-
hash:
|
83
|
+
hash: '{ }'
|
84
84
|
}
|
85
85
|
cleansed = RocketJobMissionControl::JobSanitizer.sanitize(properties, @job.class, @job, false)
|
86
86
|
assert_equal 0, @job.errors.count
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketjob_mission_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Cloutier
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.6.
|
208
|
+
rubygems_version: 2.6.11
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Enterprise Batch Processing System for Ruby.
|