kuroko2 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kuroko2/definition_linker.js +1 -1
  3. data/app/assets/stylesheets/kuroko2/application.scss +4 -0
  4. data/app/controllers/kuroko2/api/job_instances_controller.rb +3 -2
  5. data/app/controllers/kuroko2/dashboard_controller.rb +1 -1
  6. data/app/controllers/kuroko2/job_definitions_controller.rb +2 -2
  7. data/app/controllers/kuroko2/job_instances_controller.rb +8 -18
  8. data/app/controllers/kuroko2/tokens_controller.rb +3 -3
  9. data/app/controllers/kuroko2/users_controller.rb +17 -1
  10. data/app/models/kuroko2/job_definition.rb +11 -0
  11. data/app/models/kuroko2/job_instance.rb +19 -2
  12. data/app/models/kuroko2/job_schedule.rb +3 -6
  13. data/app/models/kuroko2/job_suspend_schedule.rb +1 -1
  14. data/app/models/kuroko2/token.rb +8 -0
  15. data/app/views/kuroko2/execution_logs/index.json.jbuilder +1 -1
  16. data/app/views/kuroko2/job_definitions/_form.html.slim +6 -1
  17. data/app/views/kuroko2/job_definitions/_list.html.slim +12 -5
  18. data/app/views/kuroko2/job_definitions/_search_results.html.slim +10 -3
  19. data/app/views/kuroko2/job_definitions/show.html.slim +5 -3
  20. data/app/views/kuroko2/job_timelines/dataset.json.jbuilder +1 -1
  21. data/app/views/kuroko2/logs/index.html.slim +6 -6
  22. data/app/views/kuroko2/tokens/index.html.slim +2 -2
  23. data/app/views/kuroko2/users/edit.html.slim +37 -0
  24. data/app/views/kuroko2/users/show.html.slim +8 -4
  25. data/db/migrate/026_add_webhook_url_to_job_definitions.rb +5 -0
  26. data/lib/autoload/kuroko2/workflow/engine.rb +4 -6
  27. data/lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb +12 -0
  28. data/lib/autoload/kuroko2/workflow/notifier/hipchat.rb +30 -4
  29. data/lib/autoload/kuroko2/workflow/notifier/mail.rb +9 -1
  30. data/lib/autoload/kuroko2/workflow/notifier/slack.rb +31 -4
  31. data/lib/autoload/kuroko2/workflow/notifier/webhook.rb +173 -0
  32. data/lib/autoload/kuroko2/workflow/task/queue.rb +2 -2
  33. data/lib/autoload/kuroko2/workflow/task/sub_process.rb +2 -4
  34. data/lib/kuroko2/version.rb +1 -1
  35. data/spec/controllers/users_controller_spec.rb +51 -2
  36. data/spec/dummy/config/kuroko2.yml +2 -0
  37. data/spec/dummy/db/schema.rb +76 -92
  38. data/spec/dummy/log/development.log +1143 -0
  39. data/spec/dummy/log/test.log +271238 -0
  40. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-Q/-QhKaYdB1JJGAsq6Ih7uQZJD46XkY5Gw0-38DBDVg3Y.cache +1 -0
  41. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-h/-h4P8jVHGGfJVwG36J8kBUkHFa3HHGNiJQz0936uaxg.cache +1 -0
  42. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/24/24laeo7m53bkbst3Gxu4hlJY-EbnK-rQxH-DA4ujzwY.cache +1 -0
  43. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2e/2eEFzw4UUZHJizptl3nT5jVv3IL25_RdYImr3lAVlJ4.cache +1 -0
  44. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2z/2z8OmZrK1FFsPb8zq9RFli2IVM0gOna92hieZ4cK36c.cache +0 -0
  45. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4K/4Ky9Fg4qo8d_i8bJF6NOhDpxHuJ5kIX8n0w6C8wdHDU.cache +3 -0
  46. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Di/Di9ZEIp2OLO96tkqFN21AWfdoAhc0OCBOJb3o8RUk1I.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ex/ExgjnrLZM8Hc_uT_sWVaQSNR26tGYCGUsbJDXs9GYO0.cache +1 -0
  48. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/FJ/FJW4oZDLKhsjg_UHdycQAY88BFtnMeeLCuArx6HIMdM.cache +0 -0
  49. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Iq/IqSpSELRWrOQtOK8F6mGZFPvfafM4yn8gB_VquH9E50.cache +1 -0
  50. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JJ/JJ2dvNSAjiGkZZs_1Dz2TMWDJs4HypQ95b26cHN13I0.cache +1 -0
  51. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LJ/LJsVKu6GCC14s20BfJEDXwajK6-xWF72ANX5ONOTX1w.cache +1 -0
  52. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LL/LLCxb9El_km568UsA8DDOe8Vh3pPKE8IU6ZNww9ie8s.cache +1 -0
  53. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Pq/pqeS6zqHUdv-_25W2PSQMm31ql_cIpaK1iqEcfiNyUQ.cache +0 -0
  54. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q9/Q9TwXzoqqs8Dm9v25gjZxYIkZW1UKm2X8g2koo5aYhQ.cache +1 -0
  55. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QJ/QJNiKbGgll2T_0mhQus6ZL9a2SM4Xqz7vs2V2KbELPw.cache +1 -0
  56. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QV/QVVeFw88kC-7HfzOk_dCVoFBnz9W_7-gmJFYh-Xlh-0.cache +0 -0
  57. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qs/QsTn160WUaI8_u8tE8rz37XiSV9qLvSxiXAR-tCtV3Y.cache +0 -0
  58. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/V2/V2QhbjrEGa7in5Uj1P-3E1Ziw2AGno_ADefUhPNHw_A.cache +0 -0
  59. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vj/VjICw6h8uQ_278ekFlu1znnPR8Gz1vWF_mRgy0KjZXs.cache +1 -0
  60. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dH/dHFrKzzqtF3aoKs2wAI8z0CNHZoNuytfiHur9Zgz9z0.cache +1 -0
  61. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fE/fEFAQG1Uqt2e58VitSFoPsjVjntfPtgL9RKoKHUTS9U.cache +1 -0
  62. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fM/FMdA_jabowoG5SAWE93G7Hu8A-5GhfzC9Gjy3EJp1Ts.cache +1 -0
  63. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hI/hIIciXZzgFWXdW0lamhs4r5zFFr4hnXvWAuOihCS5qI.cache +0 -0
  64. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hW/hWOkA9ZbQJy1YfEXThjYPOiXRDVRgAeW8TmLm-uQCYk.cache +1 -0
  65. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iv/ivrIChCv2olhH20VXJQTJgVWlx3t9ncsYxV0QfLT0Bs.cache +0 -0
  66. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/k3/k31T18tx4gR2rhpmDMYMLUa8KPDt7QRIR_qRK56LOdE.cache +0 -0
  67. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oB/oB0c7AuqQVdgqJDgphXXOHw3SXqbDUYfZWxxm9-v_is.cache +0 -0
  68. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ou/ouMQatdL-PPhPVPw5o0xm5EBkVeVWLti06EUEVmfOBo.cache +1 -0
  69. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qM/qMZbagtANt1BI7qOJXWEpzxx1qa-IKMkyOy6EKEIIbE.cache +0 -0
  70. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rc/rcceqGk009vh5_tK6Y-i1dvbYQwuUtRF888xZcnZrj8.cache +1 -0
  71. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sJ/sJOLo6McRe1YhfgIaGhcDaAoulIdYY7Rs07TAKmrSoY.cache +0 -0
  72. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sh/shGRyWpXjqxMTGB3As4Vibs8VGS0bZHHd4s0qabhwXI.cache +1 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sr/SRfo3vCtDVy0qd-OB9dv5a-xIVTHkJZDn8XwY_ymy7g.cache +1 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vV/vV3Loym0NolgPoXFEVPOr5rDgB_Q5kvUA3InuEEvEvQ.cache +1 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wK/wK5S37PPHfwFm-4mrLMMPdOZ29-H75zo1T2gmErWjLI.cache +0 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wm/wm_qI7_LCxbnH6p7BK1Pqcocl-6TcULzTERICGZIdL0.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zC/zCYIl3BglB_fMHME2oqK30CF97CBUG09R0ICLpE-pIM.cache +0 -0
  78. data/spec/features/dashborad_spec.rb +10 -3
  79. data/spec/features/users_spec.rb +20 -4
  80. data/spec/models/job_instance_spec.rb +1 -1
  81. data/spec/models/token_spec.rb +38 -0
  82. data/spec/workflow/notifier/hipchat_spec.rb +91 -0
  83. data/spec/workflow/notifier/mail_spec.rb +18 -2
  84. data/spec/workflow/notifier/slack_spec.rb +85 -0
  85. data/spec/workflow/notifier/webhook_spec.rb +187 -0
  86. data/spec/workflow/task/queue_spec.rb +11 -0
  87. metadata +93 -16
@@ -0,0 +1 @@
1
+ "%�>r~�:Q_q��� �)o\e��v�;b�r�e
@@ -0,0 +1 @@
1
+ "%^]�bs�:==P�0z)�曤X�u�X�D�d���:
@@ -0,0 +1 @@
1
+ "%a���ۢo@*uX=*1�߂���X�jO���� 
@@ -0,0 +1 @@
1
+ "%����+���oZ�fh�v&�=�z�9$�ʏ���
@@ -0,0 +1,3 @@
1
+ [o:Set:
2
+ @hash}
3
+ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"kfile-digest:///Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/definition_linker.js;TTF
@@ -0,0 +1 @@
1
+ "%����+���oZ�fh�v&�=�z�9$�ʏ���
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/application.js?type=application/javascript&pipeline=self&id=b59d847a0b725260cffbce7b628b03606eef7755828321249216aaaadab08916:ET
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/application.js?type=application/javascript&id=213fbc03156fcffe6e60e900fa4a48b704afbde00b4ce497af761b574d7576f8:ET
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/application.js?type=application/javascript&pipeline=self&id=b2af374bd742bbeb4d501b91b645cf94cf339e503f86007ca27f2c674b7addf5:ET
@@ -0,0 +1 @@
1
+ "%L�S�' ƛ#92��Ƴ�2��d*�SUI�q
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/definition_linker.js?type=application/javascript&pipeline=self&id=7137ec83c8e33187e38a60817db6ea67fde9f57f171e176d53a269d3abba1772:ET
@@ -0,0 +1 @@
1
+ "%�Lq��������|��לsR4�fa��Nf
@@ -0,0 +1 @@
1
+ "%�Lq��������|��לsR4�fa��Nf
@@ -0,0 +1 @@
1
+ "%�#2�c����]�ak�hGR�7t�[o��
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/javascripts/kuroko2/application.js?type=application/javascript&id=1600da13d3b170e3cc4d4ef7e2224696f8ecec1489c22fb3726ac22fb7a8c4fa:ET
@@ -0,0 +1 @@
1
+ "%�TȰ�V wD�󿉾����4B)�0�� �P�
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/stylesheets/kuroko2/application.scss?type=text/css&id=52bc14dbf6845af55db91bb2f3406df3e99da22b1e84596943aeceb6f896f2ef:ET
@@ -0,0 +1 @@
1
+ I"�/Users/eisuke-oishi/work/kuroko2_oss/app/assets/stylesheets/kuroko2/application.scss?type=text/css&pipeline=self&id=13acc59b0e86c99c12d312359c80d5b43801fdcc907877fa0479194c26afdae1:ET
@@ -0,0 +1 @@
1
+ "%����+���oZ�fh�v&�=�z�9$�ʏ���
@@ -0,0 +1 @@
1
+ "%�Lq��������|��לsR4�fa��Nf
@@ -0,0 +1 @@
1
+ "%a���ۢo@*uX=*1�߂���X�jO���� 
@@ -0,0 +1 @@
1
+ "%�#2�c����]�ak�hGR�7t�[o��
@@ -0,0 +1 @@
1
+ "%L�S�' ƛ#92��Ƴ�2��d*�SUI�q
@@ -66,15 +66,22 @@ RSpec.describe "User shows dashboard", type: :feature do
66
66
 
67
67
  expect(page).to have_content(common_tag)
68
68
 
69
- click_on(common_tag)
69
+ within '#tags' do
70
+ click_on(common_tag)
71
+ end
72
+
70
73
  wait_for_ajax
71
74
  expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
72
75
 
73
- click_on("tag_1")
76
+ within '#tags' do
77
+ click_on("tag_1")
78
+ end
74
79
  wait_for_ajax
75
80
  expect(page).to have_selector('#definitions_list table tbody tr', count: 1)
76
81
 
77
- click_on("tag_1")
82
+ within '#tags' do
83
+ click_on("tag_1")
84
+ end
78
85
  wait_for_ajax
79
86
  expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
80
87
  end
@@ -16,7 +16,7 @@ RSpec.describe "Users management", type: :feature do
16
16
  expect(page).to have_content("##{user.id} #{user.name}")
17
17
  end
18
18
 
19
- it 'creates group users' do
19
+ it 'creates and edits group users' do
20
20
  visit kuroko2.users_path
21
21
  fill_in 'Name', with: 'Test Group User'
22
22
  fill_in 'Email', with: 'test_group_user@example.com'
@@ -32,6 +32,16 @@ RSpec.describe "Users management", type: :feature do
32
32
 
33
33
  expect(page).to have_selector('#users tbody tr', count: 1)
34
34
  expect(page).to have_content('Test Group User')
35
+
36
+ visit kuroko2.users_path(target: 'group')
37
+ click_on('View Details')
38
+ click_on('Edit User')
39
+
40
+ fill_in 'Name', with: 'Test Group User v2'
41
+ fill_in 'Email', with: 'test_group_userv2@example.com'
42
+ click_on('Update')
43
+
44
+ expect(page).to have_content('Test Group User v2')
35
45
  end
36
46
 
37
47
  context 'A user has some tagged job_definitions', js: true do
@@ -62,15 +72,21 @@ RSpec.describe "Users management", type: :feature do
62
72
 
63
73
  expect(page).to have_content(common_tag)
64
74
 
65
- click_on(common_tag)
75
+ within '#tags' do
76
+ click_on(common_tag)
77
+ end
66
78
  wait_for_ajax
67
79
  expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
68
80
 
69
- click_on("tag_1")
81
+ within '#tags' do
82
+ click_on("tag_1")
83
+ end
70
84
  wait_for_ajax
71
85
  expect(page).to have_selector('#definitions_list table tbody tr', count: 1)
72
86
 
73
- click_on("tag_1")
87
+ within '#tags' do
88
+ click_on("tag_1")
89
+ end
74
90
  wait_for_ajax
75
91
  expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
76
92
  end
@@ -38,7 +38,7 @@ describe Kuroko2::JobInstance do
38
38
  let(:definition) { create(:job_definition) }
39
39
  let(:instance) { definition.job_instances.create! }
40
40
 
41
- subject! { instance.cancel }
41
+ subject! { instance.cancel(by: 'test') }
42
42
 
43
43
  it do
44
44
  expect(instance).to be_canceled_at
@@ -51,4 +51,42 @@ describe Kuroko2::Token do
51
51
 
52
52
  end
53
53
  end
54
+
55
+ describe "#skippable?" do
56
+ subject! { create(:token, status: status) }
57
+
58
+ context 'When token is failure status' do
59
+ let(:status) { Kuroko2::Token::FAILURE }
60
+ it { is_expected.to be_skippable }
61
+ end
62
+
63
+ context 'When token is waiting status' do
64
+ let(:status) { Kuroko2::Token::WAITING }
65
+ it { is_expected.to be_skippable }
66
+ end
67
+
68
+ context 'When token is working status' do
69
+ let(:status) { Kuroko2::Token::WORKING }
70
+ it { is_expected.not_to be_skippable }
71
+ end
72
+ end
73
+
74
+ describe "#retryable?" do
75
+ subject! { create(:token, status: status) }
76
+
77
+ context 'When token is failure status' do
78
+ let(:status) { Kuroko2::Token::FAILURE }
79
+ it { is_expected.to be_retryable }
80
+ end
81
+
82
+ context 'When token is waiting status' do
83
+ let(:status) { Kuroko2::Token::WAITING }
84
+ it { is_expected.not_to be_retryable }
85
+ end
86
+
87
+ context 'When token is working status' do
88
+ let(:status) { Kuroko2::Token::WORKING }
89
+ it { is_expected.not_to be_retryable }
90
+ end
91
+ end
54
92
  end
@@ -50,6 +50,7 @@ module Kuroko2::Workflow
50
50
 
51
51
  describe '#notify_cancellation' do
52
52
  before do
53
+ instance.logs.warn('warn')
53
54
  instance.job_definition.notify_cancellation = true
54
55
  instance.save!
55
56
  end
@@ -103,6 +104,96 @@ module Kuroko2::Workflow
103
104
  end
104
105
  end
105
106
 
107
+ describe '#notify_retrying' do
108
+ context 'with notify_finished' do
109
+ before do
110
+ instance.job_definition.hipchat_notify_finished = true
111
+ instance.save!
112
+ end
113
+
114
+ it 'sends retrying mesasge' do
115
+ expect(hipchat_room_object).to receive(:send) do |_, message, option|
116
+ expect(message).to include('SUCCESS')
117
+ expect(option[:color]).to eq('yellow')
118
+ end
119
+
120
+ notifier.notify_retrying
121
+ end
122
+ end
123
+
124
+ context 'without notify_finished' do
125
+ before do
126
+ instance.job_definition.hipchat_notify_finished = false
127
+ instance.save!
128
+ end
129
+
130
+ it 'sends retrying mesasge' do
131
+ expect(hipchat_room_object).not_to receive(:send)
132
+ notifier.notify_retrying
133
+ end
134
+ end
135
+ end
136
+
137
+ describe '#notify_skipping' do
138
+ context 'with notify_finished' do
139
+ before do
140
+ instance.job_definition.hipchat_notify_finished = true
141
+ instance.save!
142
+ end
143
+
144
+ it 'sends skipping mesasge' do
145
+ expect(hipchat_room_object).to receive(:send) do |_, message, option|
146
+ expect(message).to include('SUCCESS')
147
+ expect(option[:color]).to eq('yellow')
148
+ end
149
+
150
+ notifier.notify_skipping
151
+ end
152
+ end
153
+
154
+ context 'without notify_finished' do
155
+ before do
156
+ instance.job_definition.hipchat_notify_finished = false
157
+ instance.save!
158
+ end
159
+
160
+ it 'sends skipping mesasge' do
161
+ expect(hipchat_room_object).not_to receive(:send)
162
+ notifier.notify_skipping
163
+ end
164
+ end
165
+ end
166
+
167
+ describe '#notify_launch' do
168
+ context 'with notify_finished' do
169
+ before do
170
+ instance.job_definition.hipchat_notify_finished = true
171
+ instance.save!
172
+ end
173
+
174
+ it 'sends launch mesasge' do
175
+ expect(hipchat_room_object).to receive(:send) do |_, message, option|
176
+ expect(message).to include('SUCCESS')
177
+ expect(option[:color]).to eq('yellow')
178
+ end
179
+
180
+ notifier.notify_launch
181
+ end
182
+ end
183
+
184
+ context 'without notify_finished' do
185
+ before do
186
+ instance.job_definition.hipchat_notify_finished = false
187
+ instance.save!
188
+ end
189
+
190
+ it 'sends launch mesasge' do
191
+ expect(hipchat_room_object).not_to receive(:send)
192
+ notifier.notify_launch
193
+ end
194
+ end
195
+ end
196
+
106
197
  describe '#notify_long_elapsed_time' do
107
198
  it 'sends warning mesasge' do
108
199
  expect(hipchat_room_object).to receive(:send) do |_, message, option|
@@ -75,9 +75,25 @@ module Kuroko2::Workflow
75
75
  end
76
76
  end
77
77
 
78
- describe '#notify_working' do
78
+ describe '#notify_retrying' do
79
79
  it 'does not send mail' do
80
- expect { notifier.notify_working }.not_to change {
80
+ expect { notifier.notify_retrying }.not_to change {
81
+ ActionMailer::Base.deliveries.size
82
+ }
83
+ end
84
+ end
85
+
86
+ describe '#notify_skipping' do
87
+ it 'does not send mail' do
88
+ expect { notifier.notify_skipping }.not_to change {
89
+ ActionMailer::Base.deliveries.size
90
+ }
91
+ end
92
+ end
93
+
94
+ describe '#notify_launch' do
95
+ it 'does not send mail' do
96
+ expect { notifier.notify_launch }.not_to change {
81
97
  ActionMailer::Base.deliveries.size
82
98
  }
83
99
  end
@@ -45,6 +45,7 @@ module Kuroko2::Workflow
45
45
 
46
46
  describe '#notify_cancellation' do
47
47
  before do
48
+ instance.logs.warn('warn')
48
49
  instance.job_definition.notify_cancellation = true
49
50
  instance.save!
50
51
  end
@@ -89,6 +90,90 @@ module Kuroko2::Workflow
89
90
  end
90
91
  end
91
92
 
93
+ describe '#notify_retrying' do
94
+ context 'with notify_finished' do
95
+ before do
96
+ instance.job_definition.hipchat_notify_finished = true
97
+ instance.save!
98
+ end
99
+
100
+ it 'sends retrying mesasge' do
101
+ expect(notifier).to receive(:send_to_slack).
102
+ with(hash_including(channel: slack_channel)).and_call_original
103
+
104
+ notifier.notify_retrying
105
+ end
106
+ end
107
+
108
+ context 'without notify_finished' do
109
+ before do
110
+ instance.job_definition.hipchat_notify_finished = false
111
+ instance.save!
112
+ end
113
+
114
+ it 'sends retrying mesasge' do
115
+ expect(notifier).not_to receive(:send_to_slack)
116
+ notifier.notify_retrying
117
+ end
118
+ end
119
+ end
120
+
121
+ describe '#notify_skipping' do
122
+ context 'with notify_finished' do
123
+ before do
124
+ instance.job_definition.hipchat_notify_finished = true
125
+ instance.save!
126
+ end
127
+
128
+ it 'sends skipping mesasge' do
129
+ expect(notifier).to receive(:send_to_slack).
130
+ with(hash_including(channel: slack_channel)).and_call_original
131
+
132
+ notifier.notify_skipping
133
+ end
134
+ end
135
+
136
+ context 'without notify_finished' do
137
+ before do
138
+ instance.job_definition.hipchat_notify_finished = false
139
+ instance.save!
140
+ end
141
+
142
+ it 'sends skipping mesasge' do
143
+ expect(notifier).not_to receive(:send_to_slack)
144
+ notifier.notify_skipping
145
+ end
146
+ end
147
+ end
148
+
149
+ describe '#notify_launch' do
150
+ context 'with notify_finished' do
151
+ before do
152
+ instance.job_definition.hipchat_notify_finished = true
153
+ instance.save!
154
+ end
155
+
156
+ it 'sends launch mesasge' do
157
+ expect(notifier).to receive(:send_to_slack).
158
+ with(hash_including(channel: slack_channel)).and_call_original
159
+
160
+ notifier.notify_launch
161
+ end
162
+ end
163
+
164
+ context 'without notify_finished' do
165
+ before do
166
+ instance.job_definition.hipchat_notify_finished = false
167
+ instance.save!
168
+ end
169
+
170
+ it 'sends launch mesasge' do
171
+ expect(notifier).not_to receive(:send_to_slack)
172
+ notifier.notify_launch
173
+ end
174
+ end
175
+ end
176
+
92
177
  describe '#notify_long_elapsed_time' do
93
178
  it 'sends warning mesasge' do
94
179
  expect(notifier).to receive(:send_to_slack).