lita-aws-ecs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +67 -0
- data/.gitignore +4 -0
- data/.rspec +4 -0
- data/.rubocop.yml +9 -0
- data/.rubocop_todo.yml +20 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +75 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +161 -0
- data/Guardfile +49 -0
- data/LICENSE.txt +22 -0
- data/README.md +1 -0
- data/Rakefile +8 -0
- data/lib/lita/handlers/aws_ecs.rb +123 -0
- data/lib/lita-aws-ecs.rb +14 -0
- data/lita-aws-ecs.gemspec +33 -0
- data/locales/en.yml +103 -0
- data/locales/ja.yml +104 -0
- data/pkg/lita-aws-ecs-0.1.0.gem +0 -0
- data/spec/lita/handlers/aws_ecs_spec.rb +294 -0
- data/spec/spec_helper.rb +19 -0
- data/templates/.gitkeep +0 -0
- data/templates/cluster_component.erb +13 -0
- data/templates/cluster_services.erb +10 -0
- data/templates/cluster_tasks.erb +10 -0
- data/templates/clusters.erb +10 -0
- data/templates/service_tasks.erb +10 -0
- data/templates/service_update.erb +10 -0
- metadata +256 -0
data/locales/en.yml
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
en:
|
2
|
+
lita:
|
3
|
+
adapters:
|
4
|
+
shell:
|
5
|
+
startup_message: Type "exit" or "quit" to end the session.
|
6
|
+
core:
|
7
|
+
register_adapter:
|
8
|
+
block_or_class_required: Lita.register_adapter requires a class in its two argument form.
|
9
|
+
register_handler:
|
10
|
+
block_or_class_required: Lita.register_handler requires a class in its single argument form.
|
11
|
+
adapter:
|
12
|
+
method_not_implemented: "This adapter has not implemented #%{method}."
|
13
|
+
cli:
|
14
|
+
no_gemfile_warning: >-
|
15
|
+
The default command "start" must be run inside a Lita project. Try running `lita new` to
|
16
|
+
generate a new Lita project or `lita help` to see all commands.
|
17
|
+
travis_question: Do you want to test your plugin on Travis CI? ("yes" or "no", default is "no")
|
18
|
+
license_notice: >-
|
19
|
+
If you plan to release this plugin as open source software, consider adding a LICENSE file
|
20
|
+
to the root of the repository.
|
21
|
+
Common open source software licenses can be found at https://choosealicense.com/.
|
22
|
+
badges_message: >-
|
23
|
+
If your plugin's Git repository will be hosted on GitHub, a build status badge can be
|
24
|
+
automatically added to your README.
|
25
|
+
badges_question: >-
|
26
|
+
Would you like to add this badge? ("yes" or "no", default is "no")
|
27
|
+
github_user_question: What is your GitHub username?
|
28
|
+
badges_reminder: >-
|
29
|
+
Remember, for badges to be displayed in your plugin's README, you must host your project on
|
30
|
+
GitHub. Additionally, you will need to configure the project on Travis CI.
|
31
|
+
minimum_ruby_version: >-
|
32
|
+
Lita 6.0 will require Ruby %{required_version} or greater. You are currently using version
|
33
|
+
%{current_version} and should upgrade when you can.
|
34
|
+
no_default_handlers: |
|
35
|
+
In Lita 5.0, the default handlers were moved to a separate gem called lita-default-handlers.
|
36
|
+
Lita 5 has a hard dependency on this gem, so all the default handlers will continue to load
|
37
|
+
by default. However, in Lita 6.0, the default handlers will only be loaded if you explicitly
|
38
|
+
include the gem in your Lita project's Gemfile. You can do this now by adding the following
|
39
|
+
line to your Lita project's Gemfile:
|
40
|
+
gem "lita-default-handlers"
|
41
|
+
config:
|
42
|
+
exception: |
|
43
|
+
Lita configuration file could not be processed. The exception was:
|
44
|
+
%{message}
|
45
|
+
Full backtrace:
|
46
|
+
%{backtrace}
|
47
|
+
missing_required_adapter_attribute: >-
|
48
|
+
Configuration attribute "%{attribute}" is required for "%{adapter}" adapter.
|
49
|
+
missing_required_handler_attribute: >-
|
50
|
+
Configuration attribute "%{attribute}" is required for "%{handler}" handler.
|
51
|
+
type_error: >-
|
52
|
+
Configuration type error: "%{attribute}" must be one of: %{types}.
|
53
|
+
validation_error: >-
|
54
|
+
Validation error on attribute "%{attribute}": %{message}
|
55
|
+
handler:
|
56
|
+
dispatch: "Dispatching message to %{handler}#%{method}."
|
57
|
+
exception: |
|
58
|
+
%{handler} crashed. The exception was:
|
59
|
+
%{message}
|
60
|
+
Full backtrace:
|
61
|
+
%{backtrace}
|
62
|
+
http:
|
63
|
+
exception: |
|
64
|
+
Lita's built-in web server could not be started. The exception was:
|
65
|
+
%{message}
|
66
|
+
Full backtrace:
|
67
|
+
%{backtrace}
|
68
|
+
plugin:
|
69
|
+
name_required: Plugins that are anonymous classes must set a namespace or define self.name.
|
70
|
+
redis:
|
71
|
+
exception: |
|
72
|
+
Lita could not connect to Redis. The exception was:
|
73
|
+
%{message}
|
74
|
+
Full backtrace:
|
75
|
+
%{backtrace}
|
76
|
+
test_mode_exception: |
|
77
|
+
Lita could not connect to Redis. The exception was:
|
78
|
+
%{message}
|
79
|
+
robot:
|
80
|
+
unknown_adapter: "Unknown adapter: :%{adapter}."
|
81
|
+
rspec:
|
82
|
+
full_suite_required: Lita::RSpec requires both RSpec::Mocks and RSpec::Expectations.
|
83
|
+
version_3_required: RSpec::Core 3 or greater is required to use Lita::RSpec.
|
84
|
+
rack_test_required: Rack::Test is required to use the `http` method of Lita::RSpec.
|
85
|
+
lita_3_compatibility_mode: >-
|
86
|
+
WARNING: Lita 3 compatibility mode is deprecated in Lita 5 and will be removed in Lita 6.
|
87
|
+
It no longer has any effect. Please remove any calls to `Lita.version_3_compatibility_mode`.
|
88
|
+
route_failure: |-
|
89
|
+
Expected message "%{message}" to route to :%{route}, but didn't.
|
90
|
+
negative_route_failure: |-
|
91
|
+
Expected message "%{message}" not to route to :%{route}, but did.
|
92
|
+
http_route_failure: |-
|
93
|
+
Expected request "%{method} %{path}" to route to :%{route}, but didn't.
|
94
|
+
negative_http_route_failure: |-
|
95
|
+
Expected request "%{method} %{path}" not to route to :%{route}, but did.
|
96
|
+
event_subscription_failure: |-
|
97
|
+
Expected triggering event "%{event}" to invoke :%{route}, but didn't.
|
98
|
+
negative_event_subscription_failure: |-
|
99
|
+
Expected triggering event "%{event}" not to invoke :%{route}, but did.
|
100
|
+
source:
|
101
|
+
user_or_room_required: Either a user or a room is required.
|
102
|
+
template:
|
103
|
+
missing_template: Missing template file at %{path}.
|
data/locales/ja.yml
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
ja-JP:
|
2
|
+
UTF-8:
|
3
|
+
lita:
|
4
|
+
adapters:
|
5
|
+
shell:
|
6
|
+
startup_message: Type "exit" or "quit" to end the session.
|
7
|
+
core:
|
8
|
+
register_adapter:
|
9
|
+
block_or_class_required: Lita.register_adapter requires a class in its two argument form.
|
10
|
+
register_handler:
|
11
|
+
block_or_class_required: Lita.register_handler requires a class in its single argument form.
|
12
|
+
adapter:
|
13
|
+
method_not_implemented: "This adapter has not implemented #%{method}."
|
14
|
+
cli:
|
15
|
+
no_gemfile_warning: >-
|
16
|
+
The default command "start" must be run inside a Lita project. Try running `lita new` to
|
17
|
+
generate a new Lita project or `lita help` to see all commands.
|
18
|
+
travis_question: Do you want to test your plugin on Travis CI? ("yes" or "no", default is "no")
|
19
|
+
license_notice: >-
|
20
|
+
If you plan to release this plugin as open source software, consider adding a LICENSE file
|
21
|
+
to the root of the repository.
|
22
|
+
Common open source software licenses can be found at https://choosealicense.com/.
|
23
|
+
badges_message: >-
|
24
|
+
If your plugin's Git repository will be hosted on GitHub, a build status badge can be
|
25
|
+
automatically added to your README.
|
26
|
+
badges_question: >-
|
27
|
+
Would you like to add this badge? ("yes" or "no", default is "no")
|
28
|
+
github_user_question: What is your GitHub username?
|
29
|
+
badges_reminder: >-
|
30
|
+
Remember, for badges to be displayed in your plugin's README, you must host your project on
|
31
|
+
GitHub. Additionally, you will need to configure the project on Travis CI.
|
32
|
+
minimum_ruby_version: >-
|
33
|
+
Lita 6.0 will require Ruby %{required_version} or greater. You are currently using version
|
34
|
+
%{current_version} and should upgrade when you can.
|
35
|
+
no_default_handlers: |
|
36
|
+
In Lita 5.0, the default handlers were moved to a separate gem called lita-default-handlers.
|
37
|
+
Lita 5 has a hard dependency on this gem, so all the default handlers will continue to load
|
38
|
+
by default. However, in Lita 6.0, the default handlers will only be loaded if you explicitly
|
39
|
+
include the gem in your Lita project's Gemfile. You can do this now by adding the following
|
40
|
+
line to your Lita project's Gemfile:
|
41
|
+
gem "lita-default-handlers"
|
42
|
+
config:
|
43
|
+
exception: |
|
44
|
+
Lita configuration file could not be processed. The exception was:
|
45
|
+
%{message}
|
46
|
+
Full backtrace:
|
47
|
+
%{backtrace}
|
48
|
+
missing_required_adapter_attribute: >-
|
49
|
+
Configuration attribute "%{attribute}" is required for "%{adapter}" adapter.
|
50
|
+
missing_required_handler_attribute: >-
|
51
|
+
Configuration attribute "%{attribute}" is required for "%{handler}" handler.
|
52
|
+
type_error: >-
|
53
|
+
Configuration type error: "%{attribute}" must be one of: %{types}.
|
54
|
+
validation_error: >-
|
55
|
+
Validation error on attribute "%{attribute}": %{message}
|
56
|
+
handler:
|
57
|
+
dispatch: "Dispatching message to %{handler}#%{method}."
|
58
|
+
exception: |
|
59
|
+
%{handler} crashed. The exception was:
|
60
|
+
%{message}
|
61
|
+
Full backtrace:
|
62
|
+
%{backtrace}
|
63
|
+
http:
|
64
|
+
exception: |
|
65
|
+
Lita's built-in web server could not be started. The exception was:
|
66
|
+
%{message}
|
67
|
+
Full backtrace:
|
68
|
+
%{backtrace}
|
69
|
+
plugin:
|
70
|
+
name_required: Plugins that are anonymous classes must set a namespace or define self.name.
|
71
|
+
redis:
|
72
|
+
exception: |
|
73
|
+
Lita could not connect to Redis. The exception was:
|
74
|
+
%{message}
|
75
|
+
Full backtrace:
|
76
|
+
%{backtrace}
|
77
|
+
test_mode_exception: |
|
78
|
+
Lita could not connect to Redis. The exception was:
|
79
|
+
%{message}
|
80
|
+
robot:
|
81
|
+
unknown_adapter: "Unknown adapter: :%{adapter}."
|
82
|
+
rspec:
|
83
|
+
full_suite_required: Lita::RSpec requires both RSpec::Mocks and RSpec::Expectations.
|
84
|
+
version_3_required: RSpec::Core 3 or greater is required to use Lita::RSpec.
|
85
|
+
rack_test_required: Rack::Test is required to use the `http` method of Lita::RSpec.
|
86
|
+
lita_3_compatibility_mode: >-
|
87
|
+
WARNING: Lita 3 compatibility mode is deprecated in Lita 5 and will be removed in Lita 6.
|
88
|
+
It no longer has any effect. Please remove any calls to `Lita.version_3_compatibility_mode`.
|
89
|
+
route_failure: |-
|
90
|
+
Expected message "%{message}" to route to :%{route}, but didn't.
|
91
|
+
negative_route_failure: |-
|
92
|
+
Expected message "%{message}" not to route to :%{route}, but did.
|
93
|
+
http_route_failure: |-
|
94
|
+
Expected request "%{method} %{path}" to route to :%{route}, but didn't.
|
95
|
+
negative_http_route_failure: |-
|
96
|
+
Expected request "%{method} %{path}" not to route to :%{route}, but did.
|
97
|
+
event_subscription_failure: |-
|
98
|
+
Expected triggering event "%{event}" to invoke :%{route}, but didn't.
|
99
|
+
negative_event_subscription_failure: |-
|
100
|
+
Expected triggering event "%{event}" not to invoke :%{route}, but did.
|
101
|
+
source:
|
102
|
+
user_or_room_required: Either a user or a room is required.
|
103
|
+
template:
|
104
|
+
missing_template: Missing template file at %{path}.
|
Binary file
|
@@ -0,0 +1,294 @@
|
|
1
|
+
# rubocop:disable Style/FrozenStringLiteralComment
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Lita::Handlers::AwsEcs, lita_handler: true do # rubocop:disable Metrics/BlockLength
|
5
|
+
describe 'Routing' do
|
6
|
+
it { is_expected.to route('ecs clusters') }
|
7
|
+
it { is_expected.to route('ecs cluster services cluster') }
|
8
|
+
it { is_expected.to route('ecs cluster tasks cluster') }
|
9
|
+
it { is_expected.to route('ecs cluster service tasks cluster service') }
|
10
|
+
it { is_expected.to route('ecs cluster component cluster') }
|
11
|
+
it { is_expected.to route('ecs cluster service update cluster service task 1') }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'Behavior' do # rubocop:disable Metrics/BlockLength
|
15
|
+
let(:reply_message) {}
|
16
|
+
|
17
|
+
subject { replies }
|
18
|
+
shared_examples('a command that replies message') { it { is_expected.to include reply_message } }
|
19
|
+
|
20
|
+
describe 'clusters command' do # rubocop:disable Metrics/BlockLength
|
21
|
+
let(:ecs_response) {}
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow_any_instance_of(Aws::ECS::Client)
|
25
|
+
.to receive_message_chain(:list_clusters) { ecs_response }
|
26
|
+
send_message 'ecs clusters'
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with empty clusters response' do
|
30
|
+
let(:ecs_response) { [] }
|
31
|
+
let(:reply_message) { "There are no clusters.\n" }
|
32
|
+
|
33
|
+
it_behaves_like 'a command that replies message'
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'with clusters response' do
|
37
|
+
let(:ecs_response) do
|
38
|
+
JSON.parse(
|
39
|
+
{ cluster_arns: ['/cluster_name'] }
|
40
|
+
.to_json, object_class: OpenStruct
|
41
|
+
)
|
42
|
+
end
|
43
|
+
let(:reply_message) do
|
44
|
+
<<~MESSAGE
|
45
|
+
--------------------------------------------------------
|
46
|
+
name: cluster_name
|
47
|
+
--------------------------------------------------------
|
48
|
+
MESSAGE
|
49
|
+
end
|
50
|
+
|
51
|
+
it_behaves_like 'a command that replies message'
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when something raises error' do
|
55
|
+
before do
|
56
|
+
allow_any_instance_of(Aws::ECS::Client)
|
57
|
+
.to receive_message_chain(:update_service).and_raise(StandardError)
|
58
|
+
end
|
59
|
+
|
60
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
61
|
+
it_behaves_like 'a command that replies message'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'cluster services command' do # rubocop:disable Metrics/BlockLength
|
66
|
+
let(:ecs_response) {}
|
67
|
+
|
68
|
+
before do
|
69
|
+
allow_any_instance_of(Aws::ECS::Client)
|
70
|
+
.to receive_message_chain(:list_services) { ecs_response }
|
71
|
+
send_message 'ecs cluster services cluster'
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with empty cluster services response' do
|
75
|
+
let(:ecs_response) { [] }
|
76
|
+
let(:reply_message) { "There are no services.\n" }
|
77
|
+
|
78
|
+
it_behaves_like 'a command that replies message'
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with cluster services response' do
|
82
|
+
let(:ecs_response) do
|
83
|
+
JSON.parse(
|
84
|
+
{ service_arns: ['/service_name'] }
|
85
|
+
.to_json, object_class: OpenStruct
|
86
|
+
)
|
87
|
+
end
|
88
|
+
let(:reply_message) do
|
89
|
+
<<~MESSAGE
|
90
|
+
--------------------------------------------------------
|
91
|
+
name: service_name
|
92
|
+
--------------------------------------------------------
|
93
|
+
MESSAGE
|
94
|
+
end
|
95
|
+
|
96
|
+
it_behaves_like 'a command that replies message'
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when something raises error' do
|
100
|
+
before do
|
101
|
+
allow_any_instance_of(Aws::ECS::Client)
|
102
|
+
.to receive_message_chain(:update_service).and_raise(StandardError)
|
103
|
+
end
|
104
|
+
|
105
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
106
|
+
it_behaves_like 'a command that replies message'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe 'cluster tasks command' do # rubocop:disable Metrics/BlockLength
|
111
|
+
before do
|
112
|
+
allow_any_instance_of(Aws::ECS::Client)
|
113
|
+
.to receive_message_chain(:list_tasks) { ecs_response }
|
114
|
+
send_message 'ecs cluster tasks cluster'
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'with empty cluster tasks response' do
|
118
|
+
let(:ecs_response) { [] }
|
119
|
+
let(:reply_message) { "There are no tasks.\n" }
|
120
|
+
|
121
|
+
it_behaves_like 'a command that replies message'
|
122
|
+
end
|
123
|
+
|
124
|
+
context 'with cluster tasks response' do
|
125
|
+
let(:ecs_response) do
|
126
|
+
JSON.parse(
|
127
|
+
{ task_arns: ['/task_name'] }
|
128
|
+
.to_json, object_class: OpenStruct
|
129
|
+
)
|
130
|
+
end
|
131
|
+
let(:reply_message) do
|
132
|
+
<<~MESSAGE
|
133
|
+
--------------------------------------------------------
|
134
|
+
name: task_name
|
135
|
+
--------------------------------------------------------
|
136
|
+
MESSAGE
|
137
|
+
end
|
138
|
+
|
139
|
+
it_behaves_like 'a command that replies message'
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'when something raises error' do
|
143
|
+
before do
|
144
|
+
allow_any_instance_of(Aws::ECS::Client)
|
145
|
+
.to receive_message_chain(:update_service).and_raise(StandardError)
|
146
|
+
end
|
147
|
+
|
148
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
149
|
+
it_behaves_like 'a command that replies message'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe 'cluster service tasks command' do # rubocop:disable Metrics/BlockLength
|
154
|
+
before do
|
155
|
+
allow_any_instance_of(Aws::ECS::Client)
|
156
|
+
.to receive_message_chain(:describe_services) { ecs_response }
|
157
|
+
send_message 'ecs cluster service tasks cluster service'
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'with empty cluster service tasks response' do
|
161
|
+
let(:ecs_response) {}
|
162
|
+
let(:reply_message) { "There are no tasks.\n" }
|
163
|
+
|
164
|
+
it_behaves_like 'a command that replies message'
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'with cluster service tasks response' do
|
168
|
+
let(:ecs_response) do
|
169
|
+
JSON.parse(
|
170
|
+
{ services: [{ task_definition: '/task_name' }] }
|
171
|
+
.to_json, object_class: OpenStruct
|
172
|
+
)
|
173
|
+
end
|
174
|
+
let(:reply_message) do
|
175
|
+
<<~MESSAGE
|
176
|
+
--------------------------------------------------------
|
177
|
+
name: task_name
|
178
|
+
--------------------------------------------------------
|
179
|
+
MESSAGE
|
180
|
+
end
|
181
|
+
|
182
|
+
it_behaves_like 'a command that replies message'
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'when something raises error' do
|
186
|
+
before do
|
187
|
+
allow_any_instance_of(Aws::ECS::Client)
|
188
|
+
.to receive_message_chain(:update_service).and_raise(StandardError)
|
189
|
+
end
|
190
|
+
|
191
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
192
|
+
it_behaves_like 'a command that replies message'
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe 'clusters component command' do # rubocop:disable Metrics/BlockLength
|
197
|
+
before do
|
198
|
+
allow_any_instance_of(Aws::ECS::Client)
|
199
|
+
.to receive_messages(list_services: services, describe_services: ecs_response)
|
200
|
+
send_message 'ecs cluster component cluster'
|
201
|
+
end
|
202
|
+
|
203
|
+
context 'with empty cluster component response' do
|
204
|
+
let(:services) {}
|
205
|
+
let(:ecs_response) { [] }
|
206
|
+
let(:reply_message) { "There are no cluster.\n" }
|
207
|
+
|
208
|
+
it_behaves_like 'a command that replies message'
|
209
|
+
end
|
210
|
+
|
211
|
+
context 'with cluster component response' do
|
212
|
+
let!(:services) do
|
213
|
+
JSON.parse(
|
214
|
+
{ service_arns: ['/service_name'] }
|
215
|
+
.to_json, object_class: OpenStruct
|
216
|
+
)
|
217
|
+
end
|
218
|
+
let!(:ecs_response) do
|
219
|
+
JSON.parse(
|
220
|
+
{ services: [{ task_definition: '/task_name' }] }
|
221
|
+
.to_json, object_class: OpenStruct
|
222
|
+
)
|
223
|
+
end
|
224
|
+
let(:reply_message) do
|
225
|
+
<<~MESSAGE
|
226
|
+
--------------------------------------------------------
|
227
|
+
name: cluster service_name task_name
|
228
|
+
--------------------------------------------------------
|
229
|
+
MESSAGE
|
230
|
+
end
|
231
|
+
|
232
|
+
it_behaves_like 'a command that replies message'
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'when something raises error' do
|
236
|
+
before do
|
237
|
+
allow_any_instance_of(Aws::ECS::Client)
|
238
|
+
.to receive_message_chain(:describe_services).and_raise(StandardError)
|
239
|
+
end
|
240
|
+
let(:services) { 'example' }
|
241
|
+
let(:ecs_response) { 'example' }
|
242
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
243
|
+
it_behaves_like 'a command that replies message'
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe 'clusters service update command' do # rubocop:disable Metrics/BlockLength
|
248
|
+
before do
|
249
|
+
allow_any_instance_of(Aws::ECS::Client)
|
250
|
+
.to receive_message_chain(:update_service) { ecs_response }
|
251
|
+
send_message 'ecs cluster service update cluster service task 1'
|
252
|
+
end
|
253
|
+
|
254
|
+
context 'with empty clusters service updat response' do
|
255
|
+
let(:ecs_response) { [] }
|
256
|
+
let(:reply_message) { "There are no services parameter.\n" }
|
257
|
+
|
258
|
+
it_behaves_like 'a command that replies message'
|
259
|
+
end
|
260
|
+
|
261
|
+
context 'with clusters service updat response' do
|
262
|
+
let(:ecs_response) do
|
263
|
+
JSON.parse(
|
264
|
+
{ service: { service_name: 'service_name', cluster_arn: 'cluster_name', task_definition: 'task_name' } }
|
265
|
+
.to_json, object_class: OpenStruct
|
266
|
+
)
|
267
|
+
end
|
268
|
+
let(:reply_message) do
|
269
|
+
<<~MESSAGE
|
270
|
+
--------------------------------------------------------
|
271
|
+
**your update servise parameter
|
272
|
+
update service name : service_name
|
273
|
+
service target cluster : cluster_name
|
274
|
+
service target task : task_name
|
275
|
+
--------------------------------------------------------
|
276
|
+
MESSAGE
|
277
|
+
end
|
278
|
+
|
279
|
+
it_behaves_like 'a command that replies message'
|
280
|
+
end
|
281
|
+
|
282
|
+
context 'when something raises error' do
|
283
|
+
before do
|
284
|
+
allow_any_instance_of(Aws::ECS::Client)
|
285
|
+
.to receive_message_chain(:update_service).and_raise(StandardError)
|
286
|
+
end
|
287
|
+
|
288
|
+
let(:reply_message) { ':rage: Error has occurred' }
|
289
|
+
it_behaves_like 'a command that replies message'
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
# rubocop:enable Style/FrozenStringLiteralComment
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if ENV['COVERAGE']
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.add_filter ['spec']
|
6
|
+
SimpleCov.start
|
7
|
+
end
|
8
|
+
|
9
|
+
if ENV['CODECOV_TOKEN']
|
10
|
+
require 'codecov'
|
11
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'lita-aws-ecs'
|
15
|
+
require 'lita/rspec'
|
16
|
+
|
17
|
+
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
|
18
|
+
# was generated with Lita 4, the compatibility mode should be left disabled.
|
19
|
+
Lita.version_3_compatibility_mode = false
|
data/templates/.gitkeep
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if @cluster_component.empty? %>
|
2
|
+
There are no cluster.
|
3
|
+
<% else %>
|
4
|
+
<% @cluster_component.each do |service, tasks| %>
|
5
|
+
<% tasks.each do |task| %>
|
6
|
+
--------------------------------------------------------
|
7
|
+
<% service = service.match(/\//)%>
|
8
|
+
<% task = task.match(/\//)%>
|
9
|
+
name: <%= "#{@cluster_name} #{service.post_match} #{task.post_match}" %>
|
10
|
+
--------------------------------------------------------
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if @cluster_services.empty? %>
|
2
|
+
There are no services.
|
3
|
+
<% else %>
|
4
|
+
<% @cluster_services.service_arns.each do |service| %>
|
5
|
+
--------------------------------------------------------
|
6
|
+
<% /\// =~ service %>
|
7
|
+
name: <%= $' %>
|
8
|
+
<% end %>
|
9
|
+
--------------------------------------------------------
|
10
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if @cluster_tasks.empty? %>
|
2
|
+
There are no tasks.
|
3
|
+
<% else %>
|
4
|
+
<% @cluster_tasks.task_arns.each do |task| %>
|
5
|
+
--------------------------------------------------------
|
6
|
+
<% /\// =~ task %>
|
7
|
+
name: <%= $' %>
|
8
|
+
<% end %>
|
9
|
+
--------------------------------------------------------
|
10
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if @clusters.empty? %>
|
2
|
+
There are no clusters.
|
3
|
+
<% else %>
|
4
|
+
<% @clusters.cluster_arns.each do |cluster| %>
|
5
|
+
--------------------------------------------------------
|
6
|
+
<% /\// =~ cluster %>
|
7
|
+
name: <%= $' %>
|
8
|
+
<% end %>
|
9
|
+
--------------------------------------------------------
|
10
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if @service_tasks.empty? %>
|
2
|
+
There are no tasks.
|
3
|
+
<% else %>
|
4
|
+
<% @service_tasks.each do |task| %>
|
5
|
+
--------------------------------------------------------
|
6
|
+
<% /\// =~ task %>
|
7
|
+
name: <%= $' %>
|
8
|
+
<% end %>
|
9
|
+
--------------------------------------------------------
|
10
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%if @service_update.empty?%>
|
2
|
+
There are no services parameter.
|
3
|
+
<% else %>
|
4
|
+
--------------------------------------------------------
|
5
|
+
**your update servise parameter
|
6
|
+
update service name : <%= @service_update.service.service_name %>
|
7
|
+
service target cluster : <%= @service_update.service.cluster_arn %>
|
8
|
+
service target task : <%= @service_update.service.task_definition %>
|
9
|
+
--------------------------------------------------------
|
10
|
+
<%end %>
|