rocketjob_mission_control 2.1.1 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/stylesheets/rocket_job_mission_control/callout.scss +1 -1
- data/app/assets/stylesheets/rocket_job_mission_control/worker_processes.scss +2 -2
- data/app/controllers/rocket_job_mission_control/active_workers_controller.rb +15 -0
- data/app/controllers/rocket_job_mission_control/dirmon_entries/index_filters_controller.rb +8 -13
- data/app/controllers/rocket_job_mission_control/dirmon_entries_controller.rb +3 -14
- data/app/controllers/rocket_job_mission_control/jobs/failures_controller.rb +6 -11
- data/app/controllers/rocket_job_mission_control/jobs/index_filters_controller.rb +35 -14
- data/app/controllers/rocket_job_mission_control/jobs_controller.rb +12 -15
- data/app/controllers/rocket_job_mission_control/servers/index_filters_controller.rb +49 -0
- data/app/controllers/rocket_job_mission_control/servers_controller.rb +93 -0
- data/app/datatables/rocket_job_mission_control/abstract_datatable.rb +62 -0
- data/app/datatables/rocket_job_mission_control/active_workers_datatable.rb +47 -0
- data/app/datatables/rocket_job_mission_control/completed_jobs_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/dirmon_entries_datatable.rb +10 -72
- data/app/datatables/rocket_job_mission_control/interrupted_jobs_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/jobs_datatable.rb +16 -91
- data/app/datatables/rocket_job_mission_control/queued_jobs_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/running_jobs_datatable.rb +23 -12
- data/app/datatables/rocket_job_mission_control/scheduled_jobs_datatable.rb +1 -1
- data/app/datatables/rocket_job_mission_control/servers_datatable.rb +67 -0
- data/app/helpers/rocket_job_mission_control/{workers_helper.rb → servers_helper.rb} +9 -9
- data/app/models/job_failures.rb +3 -16
- data/app/models/rocket_job_mission_control/query.rb +51 -0
- data/app/views/layouts/rocket_job_mission_control/partials/_header.html.haml +3 -3
- data/app/views/layouts/rocket_job_mission_control/partials/_sidebar.html.haml +2 -2
- data/app/views/rocket_job_mission_control/{active_processes → active_workers}/index.html.haml +3 -3
- data/app/views/rocket_job_mission_control/dirmon_entries/_properties.html.haml +7 -18
- data/app/views/rocket_job_mission_control/dirmon_entries/_status.html.haml +0 -5
- data/app/views/rocket_job_mission_control/dirmon_entries/show.html.haml +4 -3
- data/app/views/rocket_job_mission_control/jobs/_status.html.haml +22 -17
- data/app/views/rocket_job_mission_control/jobs/edit.html.haml +1 -1
- data/app/views/rocket_job_mission_control/jobs/exceptions.html.haml +29 -0
- data/app/views/rocket_job_mission_control/jobs/failures/index.html.haml +7 -7
- data/app/views/rocket_job_mission_control/jobs/show.html.haml +23 -11
- data/app/views/rocket_job_mission_control/servers/_actions.html.haml +9 -0
- data/app/views/rocket_job_mission_control/servers/_sidebar.html.haml +20 -0
- data/app/views/rocket_job_mission_control/{workers → servers}/index.html.haml +9 -9
- data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/paused.html.haml +8 -8
- data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/running.html.haml +8 -8
- data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/starting.html.haml +8 -8
- data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/stopping.html.haml +8 -8
- data/config/locales/en.yml +2 -2
- data/config/routes.rb +7 -6
- data/lib/rocket_job_mission_control/engine.rb +0 -12
- data/lib/rocket_job_mission_control/version.rb +1 -1
- data/spec/controllers/dirmon_entries/index_filters_controller_spec.rb +2 -4
- data/spec/controllers/dirmon_entries_controller_spec.rb +15 -72
- data/spec/controllers/jobs/index_filters_controller_spec.rb +1 -1
- data/spec/controllers/workers/index_filters_controller_spec.rb +9 -9
- data/spec/controllers/workers_controller_spec.rb +47 -47
- data/spec/dummy/config/mongoid.yml +88 -0
- data/spec/dummy/config/symmetric-encryption.yml +8 -0
- data/spec/dummy/log/test.log +89072 -0
- data/spec/helpers/servers_helper_spec.rb +16 -0
- data/spec/spec_helper.rb +3 -0
- metadata +31 -45
- data/app/controllers/rocket_job_mission_control/active_processes_controller.rb +0 -27
- data/app/controllers/rocket_job_mission_control/workers/index_filters_controller.rb +0 -50
- data/app/controllers/rocket_job_mission_control/workers_controller.rb +0 -93
- data/app/datatables/rocket_job_mission_control/active_processes_datatable.rb +0 -79
- data/app/datatables/rocket_job_mission_control/workers_datatable.rb +0 -127
- data/app/interactors/rocket_job_mission_control/dirmon_entries/search.rb +0 -19
- data/app/interactors/rocket_job_mission_control/jobs/search.rb +0 -19
- data/app/interactors/rocket_job_mission_control/workers/search.rb +0 -19
- data/app/views/rocket_job_mission_control/workers/_actions.html.haml +0 -9
- data/app/views/rocket_job_mission_control/workers/_sidebar.html.haml +0 -20
- data/spec/dummy/config/mongo.yml +0 -15
- data/spec/helpers/workers_helper_spec.rb +0 -16
- data/spec/interactors/jobs/search_spec.rb +0 -35
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
.
|
1
|
+
#servers
|
2
|
+
.server-list
|
3
3
|
.list
|
4
4
|
.row
|
5
5
|
.col-md-6
|
6
6
|
%h2 Servers
|
7
7
|
.col-md-6
|
8
8
|
.col-sm-10
|
9
|
-
.
|
10
|
-
- if @
|
9
|
+
.server-collection-actions
|
10
|
+
- if @servers.present?
|
11
11
|
%ol
|
12
12
|
.btn-group
|
13
13
|
- [:stop_all, :pause_all, :resume_all, :destroy_zombies].each do |action|
|
14
14
|
= link_to("#{action.to_s.humanize.capitalize}",
|
15
|
-
rocket_job_mission_control.
|
15
|
+
rocket_job_mission_control.update_all_servers_path(server_action: action),
|
16
16
|
method: :patch,
|
17
|
-
data: { confirm: t(:confirm, scope: [:
|
17
|
+
data: { confirm: t(:confirm, scope: [:server, :update_all], action: action.to_s.singularize.humanize.downcase) },
|
18
18
|
class: 'btn btn-default')
|
19
19
|
.col-sm-2.pull-right
|
20
20
|
.btn.btn-default.pull-right.dt-reload{ data: { behavior: 'reload' } }
|
21
21
|
%i.fa.fa-refresh
|
22
|
-
%table.table.datatable.
|
22
|
+
%table.table.datatable.servers-datatable{ style: "width: 100%", data: { source: "#{servers_url(format: 'json')}" } }
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th Hostname : PID
|
@@ -32,6 +32,6 @@
|
|
32
32
|
:javascript
|
33
33
|
jQuery(function() {
|
34
34
|
new RjmcDatatable(
|
35
|
-
$('.
|
36
|
-
[{data: '0'}, {data: '1'
|
35
|
+
$('.servers-datatable'),
|
36
|
+
[{data: '0'}, {data: '1'}, {data: '2'}, {data: '3'}, {data: '4', orderable: false}]);
|
37
37
|
});
|
data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/paused.html.haml
RENAMED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
.
|
1
|
+
#servers
|
2
|
+
.server-list
|
3
3
|
.list
|
4
4
|
.row
|
5
5
|
.col-md-6
|
6
6
|
%h2 Paused Servers
|
7
7
|
.col-md-6
|
8
8
|
.col-sm-10
|
9
|
-
.
|
10
|
-
- if @
|
9
|
+
.server-collection-actions
|
10
|
+
- if @servers.present?
|
11
11
|
%ol.pull-right
|
12
12
|
.btn-group
|
13
13
|
- [:stop_all, :resume_all, :destroy_zombies].each do |action|
|
14
14
|
= link_to("#{action.to_s.humanize.capitalize}",
|
15
|
-
rocket_job_mission_control.
|
15
|
+
rocket_job_mission_control.update_all_servers_path(server_action: action),
|
16
16
|
method: :patch,
|
17
|
-
data: { confirm: t(:confirm, scope: [:
|
17
|
+
data: { confirm: t(:confirm, scope: [:server, :update_all], action: action.to_s.singularize.humanize.downcase) },
|
18
18
|
class: 'btn btn-default')
|
19
19
|
.col-sm-2.pull-right
|
20
20
|
.btn.btn-default.pull-right.dt-reload{ data: { behavior: 'reload' } }
|
21
21
|
%i.fa.fa-refresh
|
22
|
-
%table.table.datatable.
|
22
|
+
%table.table.datatable.servers-datatable{ style: "width: 100%", data: { source: "#{paused_servers_url(format: 'json')}" } }
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th Hostname : PID
|
@@ -32,6 +32,6 @@
|
|
32
32
|
:javascript
|
33
33
|
jQuery(function() {
|
34
34
|
new RjmcDatatable(
|
35
|
-
$('.
|
35
|
+
$('.servers-datatable'),
|
36
36
|
[{data: '0'}, {data: '1', orderable: false}, {data: '2'}, {data: '3'}, {data: '4', orderable: false}]);
|
37
37
|
});
|
data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/running.html.haml
RENAMED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
.
|
1
|
+
#servers
|
2
|
+
.server-list
|
3
3
|
.list
|
4
4
|
.row
|
5
5
|
.col-md-6
|
6
6
|
%h2 Running Servers
|
7
7
|
.col-md-6
|
8
8
|
.col-sm-10
|
9
|
-
.
|
10
|
-
- if @
|
9
|
+
.server-collection-actions
|
10
|
+
- if @servers.present?
|
11
11
|
%ol.pull-right
|
12
12
|
.btn-group
|
13
13
|
- [:stop_all, :pause_all, :resume_all, :destroy_zombies].each do |action|
|
14
14
|
= link_to("#{action.to_s.humanize.capitalize}",
|
15
|
-
rocket_job_mission_control.
|
15
|
+
rocket_job_mission_control.update_all_servers_path(server_action: action),
|
16
16
|
method: :patch,
|
17
|
-
data: { confirm: t(:confirm, scope: [:
|
17
|
+
data: { confirm: t(:confirm, scope: [:server, :update_all], action: action.to_s.singularize.humanize.downcase) },
|
18
18
|
class: 'btn btn-default')
|
19
19
|
.col-sm-2.pull-right
|
20
20
|
.btn.btn-default.pull-right.dt-reload{ data: { behavior: 'reload' } }
|
21
21
|
%i.fa.fa-refresh
|
22
|
-
%table.table.datatable.
|
22
|
+
%table.table.datatable.servers-datatable{ style: "width: 100%", data: { source: "#{running_servers_url(format: 'json')}" } }
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th Hostname : PID
|
@@ -32,6 +32,6 @@
|
|
32
32
|
:javascript
|
33
33
|
jQuery(function() {
|
34
34
|
new RjmcDatatable(
|
35
|
-
$('.
|
35
|
+
$('.servers-datatable'),
|
36
36
|
[{data: '0'}, {data: '1', orderable: false}, {data: '2'}, {data: '3'}, {data: '4', orderable: false}]);
|
37
37
|
});
|
data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/starting.html.haml
RENAMED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
.
|
1
|
+
#servers
|
2
|
+
.server-list
|
3
3
|
.list
|
4
4
|
.row
|
5
5
|
.col-md-6
|
6
6
|
%h2 Starting Servers
|
7
7
|
.col-md-6
|
8
8
|
.col-sm-10
|
9
|
-
.
|
10
|
-
- if @
|
9
|
+
.server-collection-actions
|
10
|
+
- if @servers.present?
|
11
11
|
%ol.pull-right
|
12
12
|
.btn-group
|
13
13
|
- [:stop_all, :pause_all, :resume_all, :destroy_zombies].each do |action|
|
14
14
|
= link_to("#{action.to_s.humanize.capitalize}",
|
15
|
-
rocket_job_mission_control.
|
15
|
+
rocket_job_mission_control.update_all_servers_path(server_action: action),
|
16
16
|
method: :patch,
|
17
|
-
data: { confirm: t(:confirm, scope: [:
|
17
|
+
data: { confirm: t(:confirm, scope: [:server, :update_all], action: action.to_s.singularize.humanize.downcase) },
|
18
18
|
class: 'btn btn-default')
|
19
19
|
.col-sm-2.pull-right
|
20
20
|
.btn.btn-default.pull-right.dt-reload{ data: { behavior: 'reload' } }
|
21
21
|
%i.fa.fa-refresh
|
22
|
-
%table.table.datatable.
|
22
|
+
%table.table.datatable.servers-datatable{ style: "width: 100%", data: { source: "#{starting_servers_url(format: 'json')}" } }
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th Hostname : PID
|
@@ -32,6 +32,6 @@
|
|
32
32
|
:javascript
|
33
33
|
jQuery(function() {
|
34
34
|
new RjmcDatatable(
|
35
|
-
$('.
|
35
|
+
$('.servers-datatable'),
|
36
36
|
[{data: '0'}, {data: '1', orderable: false}, {data: '2'}, {data: '3'}, {data: '4', orderable: false}]);
|
37
37
|
});
|
data/app/views/rocket_job_mission_control/{workers → servers}/index_filters/stopping.html.haml
RENAMED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
.
|
1
|
+
#servers
|
2
|
+
.server-list
|
3
3
|
.list
|
4
4
|
.row
|
5
5
|
.col-md-6
|
6
6
|
%h2 Stopping Servers
|
7
7
|
.col-md-6
|
8
8
|
.col-sm-10
|
9
|
-
.
|
10
|
-
- if @
|
9
|
+
.server-collection-actions
|
10
|
+
- if @servers.present?
|
11
11
|
%ol.pull-right
|
12
12
|
.btn-group
|
13
13
|
- [:pause_all, :resume_all, :destroy_zombies].each do |action|
|
14
14
|
= link_to("#{action.to_s.humanize.capitalize}",
|
15
|
-
rocket_job_mission_control.
|
15
|
+
rocket_job_mission_control.update_all_servers_path(server_action: action),
|
16
16
|
method: :patch,
|
17
|
-
data: { confirm: t(:confirm, scope: [:
|
17
|
+
data: { confirm: t(:confirm, scope: [:server, :update_all], action: action.to_s.singularize.humanize.downcase) },
|
18
18
|
class: 'btn btn-default')
|
19
19
|
.col-sm-2.pull-right
|
20
20
|
.btn.btn-default.pull-right.dt-reload{ data: { behavior: 'reload' } }
|
21
21
|
%i.fa.fa-refresh
|
22
|
-
%table.table.datatable.
|
22
|
+
%table.table.datatable.servers-datatable{ style: "width: 100%", data: { source: "#{stopping_servers_url(format: 'json')}" } }
|
23
23
|
%thead
|
24
24
|
%tr
|
25
25
|
%th Hostname : PID
|
@@ -32,6 +32,6 @@
|
|
32
32
|
:javascript
|
33
33
|
jQuery(function() {
|
34
34
|
new RjmcDatatable(
|
35
|
-
$('.
|
35
|
+
$('.servers-datatable'),
|
36
36
|
[{data: '0'}, {data: '1', orderable: false}, {data: '2'}, {data: '3'}, {data: '4', orderable: false}]);
|
37
37
|
});
|
data/config/locales/en.yml
CHANGED
@@ -36,7 +36,7 @@ en:
|
|
36
36
|
almost_x_years:
|
37
37
|
one: "1 year" # default was: "almost 1 year"
|
38
38
|
other: "%{count} years" # default was: "almost %{count} years"
|
39
|
-
|
39
|
+
server:
|
40
40
|
stop:
|
41
41
|
success: "Server successfully stopped."
|
42
42
|
failure: "Error attempting to stop server."
|
@@ -50,7 +50,7 @@ en:
|
|
50
50
|
success: "Server successfully resumed."
|
51
51
|
failure: "Error attempting to resume server."
|
52
52
|
update_all:
|
53
|
-
success: "Servers have been %{
|
53
|
+
success: "Servers have been %{server_action}."
|
54
54
|
invalid: "Action not allowed."
|
55
55
|
confirm: "Are you sure you want to %{action} servers?"
|
56
56
|
job:
|
data/config/routes.rb
CHANGED
@@ -18,18 +18,19 @@ RocketJobMissionControl::Engine.routes.draw do
|
|
18
18
|
patch :resume
|
19
19
|
patch :retry
|
20
20
|
patch :run_now
|
21
|
+
get :exceptions
|
21
22
|
end
|
22
23
|
resources :failures, controller: 'jobs/failures', only: :index
|
23
24
|
end
|
24
25
|
|
25
|
-
resources :
|
26
|
+
resources :active_workers, only: :index
|
26
27
|
|
27
|
-
resources :
|
28
|
+
resources :servers, only: [:index, :destroy] do
|
28
29
|
collection do
|
29
|
-
get :starting, to: '
|
30
|
-
get :running, to: '
|
31
|
-
get :paused, to: '
|
32
|
-
get :stopping, to: '
|
30
|
+
get :starting, to: 'servers/index_filters#starting'
|
31
|
+
get :running, to: 'servers/index_filters#running'
|
32
|
+
get :paused, to: 'servers/index_filters#paused'
|
33
|
+
get :stopping, to: 'servers/index_filters#stopping'
|
33
34
|
end
|
34
35
|
|
35
36
|
member do
|
@@ -2,18 +2,6 @@ module RocketJobMissionControl
|
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace RocketJobMissionControl
|
4
4
|
|
5
|
-
require 'rocketjob'
|
6
|
-
require 'jquery-rails'
|
7
|
-
require 'haml'
|
8
|
-
require 'mongo'
|
9
|
-
require 'mongo_mapper'
|
10
|
-
require 'mongo_ha'
|
11
|
-
require 'bootstrap-sass'
|
12
|
-
require 'sass-rails'
|
13
|
-
require 'coffee-rails'
|
14
|
-
require 'kaminari'
|
15
|
-
require 'jquery-datatables-rails'
|
16
|
-
|
17
5
|
config.to_prepare do
|
18
6
|
Rails.application.config.assets.precompile += %w(
|
19
7
|
rocket_job_mission_control/rocket-icon-64x64.png
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
class AJob < RocketJob::Job
|
4
|
-
def perform
|
5
|
-
|
4
|
+
def perform
|
5
|
+
23
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -39,7 +39,6 @@ module RocketJobMissionControl
|
|
39
39
|
RocketJob::DirmonEntry.create!(
|
40
40
|
state: state,
|
41
41
|
pattern: '21',
|
42
|
-
arguments: ['42'],
|
43
42
|
job_class_name: 'AJob'
|
44
43
|
)
|
45
44
|
}
|
@@ -48,7 +47,6 @@ module RocketJobMissionControl
|
|
48
47
|
RocketJob::DirmonEntry.create!(
|
49
48
|
name: 'Test',
|
50
49
|
state: not_state,
|
51
|
-
arguments: ['42'],
|
52
50
|
pattern: '21',
|
53
51
|
job_class_name: 'AJob'
|
54
52
|
)
|
@@ -1,11 +1,5 @@
|
|
1
1
|
require_relative '../rails_helper'
|
2
2
|
|
3
|
-
class OneParamJob < RocketJob::Job
|
4
|
-
def perform(id)
|
5
|
-
id
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
3
|
class NoParamsJob < RocketJob::Job
|
10
4
|
def perform
|
11
5
|
100_000
|
@@ -30,9 +24,8 @@ module RocketJobMissionControl
|
|
30
24
|
let(:existing_dirmon) do
|
31
25
|
RocketJob::DirmonEntry.create!(
|
32
26
|
name: 'Test',
|
33
|
-
job_class_name: '
|
27
|
+
job_class_name: 'NoParamsJob',
|
34
28
|
pattern: 'the_path',
|
35
|
-
arguments: ['42'],
|
36
29
|
state: starting_state,
|
37
30
|
)
|
38
31
|
end
|
@@ -62,9 +55,8 @@ module RocketJobMissionControl
|
|
62
55
|
let(:existing_dirmon) do
|
63
56
|
RocketJob::DirmonEntry.create!(
|
64
57
|
name: 'Test',
|
65
|
-
job_class_name: '
|
58
|
+
job_class_name: 'NoParamsJob',
|
66
59
|
pattern: 'the_path',
|
67
|
-
arguments: ['42'],
|
68
60
|
state: starting_state,
|
69
61
|
)
|
70
62
|
end
|
@@ -119,13 +111,13 @@ module RocketJobMissionControl
|
|
119
111
|
end
|
120
112
|
|
121
113
|
context 'with a valid job_class_name' do
|
122
|
-
let(:entry_params) { {rocket_job_dirmon_entry: {job_class_name: '
|
114
|
+
let(:entry_params) { {rocket_job_dirmon_entry: {job_class_name: 'NoParamsJob'}} }
|
123
115
|
|
124
116
|
it { expect(response.status).to eq(200) }
|
125
117
|
|
126
118
|
it 'assigns the job class' do
|
127
119
|
expect(assigns(:dirmon_entry)).to be_present
|
128
|
-
expect(assigns(:dirmon_entry).job_class).to eq(
|
120
|
+
expect(assigns(:dirmon_entry).job_class).to eq(NoParamsJob)
|
129
121
|
end
|
130
122
|
end
|
131
123
|
|
@@ -147,9 +139,8 @@ module RocketJobMissionControl
|
|
147
139
|
let(:existing_dirmon) do
|
148
140
|
RocketJob::DirmonEntry.create!(
|
149
141
|
name: 'Test',
|
150
|
-
job_class_name: '
|
142
|
+
job_class_name: 'NoParamsJob',
|
151
143
|
pattern: 'the_path',
|
152
|
-
arguments: ['{"argument1":"value1", "argument2":"value2", "argument3":"value3"}']
|
153
144
|
)
|
154
145
|
end
|
155
146
|
|
@@ -161,8 +152,7 @@ module RocketJobMissionControl
|
|
161
152
|
let(:dirmon_params) do
|
162
153
|
{
|
163
154
|
pattern: 'the_path2',
|
164
|
-
job_class_name: '
|
165
|
-
arguments: ['42']
|
155
|
+
job_class_name: 'NoParamsJob',
|
166
156
|
}
|
167
157
|
end
|
168
158
|
|
@@ -195,24 +185,6 @@ module RocketJobMissionControl
|
|
195
185
|
expect(assigns(:dirmon_entry)).to_not be_valid
|
196
186
|
end
|
197
187
|
|
198
|
-
context 'with invalid arguments json' do
|
199
|
-
let(:dirmon_params) do
|
200
|
-
{
|
201
|
-
name: 'Test',
|
202
|
-
job_class_name: 'OneParamJob',
|
203
|
-
arguments: [],
|
204
|
-
}
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'renders the new template' do
|
208
|
-
expect(response.status).to eq(200)
|
209
|
-
expect(response).to render_template(:edit)
|
210
|
-
end
|
211
|
-
|
212
|
-
it 'has errors on arguments' do
|
213
|
-
expect(assigns(:dirmon_entry).errors[:arguments]).to be_present
|
214
|
-
end
|
215
|
-
end
|
216
188
|
end
|
217
189
|
end
|
218
190
|
|
@@ -220,9 +192,7 @@ module RocketJobMissionControl
|
|
220
192
|
context 'with valid parameters' do
|
221
193
|
|
222
194
|
[
|
223
|
-
{job_class_name: '
|
224
|
-
{job_class_name: 'OneParamJob', argument: ['{"argument1":"value1", "argument2":"value2", "argument3":"value3"}'], expected_value: [{"argument1" => "value1", "argument2" => "value2", "argument3" => "value3"}]},
|
225
|
-
{job_class_name: 'NoParamsJob', argument: [], expected_value: []}
|
195
|
+
{job_class_name: 'NoParamsJob', expected_value: []}
|
226
196
|
].each do |arguments|
|
227
197
|
context "and arguments are '#{arguments}'" do
|
228
198
|
let(:dirmon_params) do
|
@@ -230,8 +200,7 @@ module RocketJobMissionControl
|
|
230
200
|
name: 'Test',
|
231
201
|
pattern: '/files/*',
|
232
202
|
job_class_name: arguments[:job_class_name],
|
233
|
-
|
234
|
-
properties: {description: '', priority: 42},
|
203
|
+
properties: {description: '', priority: '42'}
|
235
204
|
}
|
236
205
|
end
|
237
206
|
|
@@ -268,10 +237,6 @@ module RocketJobMissionControl
|
|
268
237
|
expect(assigns(:dirmon_entry)[attribute]).to eq(dirmon_params[attribute])
|
269
238
|
end
|
270
239
|
end
|
271
|
-
|
272
|
-
it 'persists arguments correctly' do
|
273
|
-
expect(assigns(:dirmon_entry).arguments).to eq(arguments[:expected_value])
|
274
|
-
end
|
275
240
|
end
|
276
241
|
end
|
277
242
|
end
|
@@ -280,8 +245,7 @@ module RocketJobMissionControl
|
|
280
245
|
let(:dirmon_params) do
|
281
246
|
{
|
282
247
|
name: 'Test',
|
283
|
-
job_class_name: 'FakeAndBadJob'
|
284
|
-
arguments: [[42].to_json],
|
248
|
+
job_class_name: 'FakeAndBadJob'
|
285
249
|
}
|
286
250
|
end
|
287
251
|
|
@@ -299,25 +263,6 @@ module RocketJobMissionControl
|
|
299
263
|
expect(assigns(:dirmon_entry)).to_not be_valid
|
300
264
|
end
|
301
265
|
end
|
302
|
-
|
303
|
-
context 'with invalid arguments json' do
|
304
|
-
let(:dirmon_params) do
|
305
|
-
{
|
306
|
-
name: 'Test',
|
307
|
-
job_class_name: 'OneParamJob',
|
308
|
-
arguments: ['{"bad" "json"}'],
|
309
|
-
}
|
310
|
-
end
|
311
|
-
|
312
|
-
it 'renders the new template' do
|
313
|
-
expect(response.status).to eq(200)
|
314
|
-
expect(response).to render_template(:new)
|
315
|
-
end
|
316
|
-
|
317
|
-
it 'has errors on arguments' do
|
318
|
-
expect(assigns(:dirmon_entry).errors[:arguments]).to be_present
|
319
|
-
end
|
320
|
-
end
|
321
266
|
end
|
322
267
|
end
|
323
268
|
|
@@ -326,8 +271,7 @@ module RocketJobMissionControl
|
|
326
271
|
@entry = RocketJob::DirmonEntry.create(
|
327
272
|
name: 'Test',
|
328
273
|
pattern: '/files/',
|
329
|
-
job_class_name: '
|
330
|
-
arguments: [42]
|
274
|
+
job_class_name: 'NoParamsJob'
|
331
275
|
)
|
332
276
|
get :edit, id: @entry.id
|
333
277
|
end
|
@@ -376,9 +320,8 @@ module RocketJobMissionControl
|
|
376
320
|
let(:existing_dirmon) do
|
377
321
|
RocketJob::DirmonEntry.create!(
|
378
322
|
name: 'Test',
|
379
|
-
job_class_name: '
|
380
|
-
pattern: 'the_path'
|
381
|
-
arguments: [42].to_json
|
323
|
+
job_class_name: 'NoParamsJob',
|
324
|
+
pattern: 'the_path'
|
382
325
|
)
|
383
326
|
end
|
384
327
|
|
@@ -394,7 +337,7 @@ module RocketJobMissionControl
|
|
394
337
|
end
|
395
338
|
|
396
339
|
it 'deletes the entry' do
|
397
|
-
expect(RocketJob::DirmonEntry.
|
340
|
+
expect(RocketJob::DirmonEntry.where(id: existing_dirmon.id).exists?).to eq(false)
|
398
341
|
end
|
399
342
|
end
|
400
343
|
end
|
@@ -419,7 +362,7 @@ module RocketJobMissionControl
|
|
419
362
|
let(:dirmons) { ['fake_dirmon1', 'fake_dirmon2'] }
|
420
363
|
|
421
364
|
before do
|
422
|
-
allow(RocketJob::DirmonEntry).to receive(:
|
365
|
+
allow(RocketJob::DirmonEntry).to receive(:all).and_return(dirmons)
|
423
366
|
get :index
|
424
367
|
end
|
425
368
|
|
@@ -428,7 +371,7 @@ module RocketJobMissionControl
|
|
428
371
|
end
|
429
372
|
|
430
373
|
it 'grabs all dirmons with empty where' do
|
431
|
-
expect(RocketJob::DirmonEntry).to have_received(:
|
374
|
+
expect(RocketJob::DirmonEntry).to have_received(:all)
|
432
375
|
end
|
433
376
|
|
434
377
|
it 'returns the entries' do
|