Revision fb471374
Added by Michael Moll over 4 years ago
.rubocop.yml | ||
---|---|---|
4 | 4 |
|
5 | 5 |
AllCops: |
6 | 6 |
TargetRubyVersion: 2.2 |
7 |
TargetRailsVersion: 5.1 |
|
7 | 8 |
|
8 | 9 |
Rails: # always run the rails cops |
9 | 10 |
Enabled: true |
.rubocop_todo.yml | ||
---|---|---|
1 | 1 |
# This configuration was generated by |
2 |
# `rubocop --auto-gen-config` |
|
3 |
# on 2017-12-10 18:09:07 +0100 using RuboCop version 0.51.0.
|
|
2 |
# `rubocop --auto-gen-config --exclude-limit 0`
|
|
3 |
# on 2017-12-20 21:47:32 +0100 using RuboCop version 0.52.0.
|
|
4 | 4 |
# The point is for the user to remove these configuration records |
5 | 5 |
# one by one as the offenses are removed from the code base. |
6 | 6 |
# Note that changes in the inspected code, or installation of new |
... | ... | |
11 | 11 |
# Configuration parameters: Include, TreatCommentsAsGroupSeparators. |
12 | 12 |
# Include: **/*.gemspec |
13 | 13 |
Gemspec/OrderedDependencies: |
14 |
Exclude: |
|
15 |
- 'foreman_docker.gemspec' |
|
14 |
Enabled: false |
|
16 | 15 |
|
17 | 16 |
# Offense count: 8 |
18 | 17 |
# Cop supports --auto-correct. |
19 |
# Configuration parameters: EnforcedHashRocketStyle, SupportedHashRocketStyles, EnforcedColonStyle, SupportedColonStyles, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
|
|
18 |
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
20 | 19 |
# SupportedHashRocketStyles: key, separator, table |
21 | 20 |
# SupportedColonStyles: key, separator, table |
22 | 21 |
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit |
23 | 22 |
Layout/AlignHash: |
24 |
Exclude: |
|
25 |
- 'app/models/docker_container_wizard_states/dns.rb' |
|
26 |
- 'app/models/docker_container_wizard_states/exposed_port.rb' |
|
27 |
- 'app/models/docker_registry.rb' |
|
28 |
- 'app/models/exposed_port.rb' |
|
29 |
- 'app/models/foreman_docker/dns.rb' |
|
30 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
23 |
Enabled: false |
|
31 | 24 |
|
32 | 25 |
# Offense count: 16 |
33 | 26 |
# Cop supports --auto-correct. |
34 |
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
27 |
# Configuration parameters: EnforcedStyle, IndentationWidth. |
|
35 | 28 |
# SupportedStyles: with_first_parameter, with_fixed_indentation |
36 | 29 |
Layout/AlignParameters: |
37 |
Exclude: |
|
38 |
- 'test/functionals/containers_controller_test.rb' |
|
39 |
- 'test/functionals/image_search_controller_test.rb' |
|
40 |
- 'test/units/container_remover_test.rb' |
|
30 |
Enabled: false |
|
41 | 31 |
|
42 | 32 |
# Offense count: 1 |
43 | 33 |
# Cop supports --auto-correct. |
44 | 34 |
Layout/CommentIndentation: |
45 |
Exclude: |
|
46 |
- 'db/migrate/20160605134652_move_parameters_to_docker_parameters.rb' |
|
35 |
Enabled: false |
|
47 | 36 |
|
48 | 37 |
# Offense count: 13 |
49 | 38 |
# Cop supports --auto-correct. |
50 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
39 |
# Configuration parameters: EnforcedStyle. |
|
51 | 40 |
# SupportedStyles: leading, trailing |
52 | 41 |
Layout/DotPosition: |
53 |
Exclude: |
|
54 |
- 'app/models/service/containers.rb' |
|
55 |
- 'app/services/foreman_docker/container_remover.rb' |
|
56 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
57 |
- 'test/functionals/containers_controller_test.rb' |
|
58 |
- 'test/units/container_remover_test.rb' |
|
42 |
Enabled: false |
|
59 | 43 |
|
60 | 44 |
# Offense count: 1 |
61 | 45 |
# Cop supports --auto-correct. |
62 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
46 |
# Configuration parameters: EnforcedStyle. |
|
63 | 47 |
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines |
64 | 48 |
Layout/EmptyLinesAroundClassBody: |
65 |
Exclude: |
|
66 |
- 'app/models/docker_container_wizard_states/environment.rb' |
|
49 |
Enabled: false |
|
67 | 50 |
|
68 | 51 |
# Offense count: 3 |
69 | 52 |
# Cop supports --auto-correct. |
70 | 53 |
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. |
71 | 54 |
Layout/ExtraSpacing: |
72 |
Exclude: |
|
73 |
- 'app/models/concerns/foreman_docker/parameter_validators.rb' |
|
74 |
- 'app/models/docker_container_wizard_states/exposed_port.rb' |
|
75 |
- 'db/migrate/20160605133025_create_docker_parameters.rb' |
|
55 |
Enabled: false |
|
76 | 56 |
|
77 | 57 |
# Offense count: 4 |
78 | 58 |
# Cop supports --auto-correct. |
79 |
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
59 |
# Configuration parameters: EnforcedStyle, IndentationWidth. |
|
80 | 60 |
# SupportedStyles: special_inside_parentheses, consistent, align_braces |
81 | 61 |
Layout/IndentHash: |
82 |
Exclude: |
|
83 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
62 |
Enabled: false |
|
84 | 63 |
|
85 | 64 |
# Offense count: 1 |
86 | 65 |
# Cop supports --auto-correct. |
87 | 66 |
# Configuration parameters: Width, IgnoredPatterns. |
88 | 67 |
Layout/IndentationWidth: |
89 |
Exclude: |
|
90 |
- 'db/migrate/20160605134652_move_parameters_to_docker_parameters.rb' |
|
68 |
Enabled: false |
|
91 | 69 |
|
92 | 70 |
# Offense count: 2 |
93 | 71 |
# Cop supports --auto-correct. |
94 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
72 |
# Configuration parameters: EnforcedStyle. |
|
95 | 73 |
# SupportedStyles: symmetrical, new_line, same_line |
96 | 74 |
Layout/MultilineArrayBraceLayout: |
97 |
Exclude: |
|
98 |
- 'app/controllers/containers/steps_controller.rb' |
|
99 |
- 'lib/foreman_docker/engine.rb' |
|
75 |
Enabled: false |
|
100 | 76 |
|
101 | 77 |
# Offense count: 7 |
102 | 78 |
# Cop supports --auto-correct. |
103 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
79 |
# Configuration parameters: EnforcedStyle. |
|
104 | 80 |
# SupportedStyles: symmetrical, new_line, same_line |
105 | 81 |
Layout/MultilineHashBraceLayout: |
106 |
Exclude: |
|
107 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
108 |
- 'app/models/docker_container_wizard_state.rb' |
|
109 |
- 'app/models/docker_container_wizard_states/dns.rb' |
|
110 |
- 'app/models/foreman_docker/dns.rb' |
|
111 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
112 |
- 'test/functionals/image_search_controller_test.rb' |
|
82 |
Enabled: false |
|
113 | 83 |
|
114 | 84 |
# Offense count: 17 |
115 | 85 |
# Cop supports --auto-correct. |
116 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
86 |
# Configuration parameters: EnforcedStyle. |
|
117 | 87 |
# SupportedStyles: symmetrical, new_line, same_line |
118 | 88 |
Layout/MultilineMethodCallBraceLayout: |
119 |
Exclude: |
|
120 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
121 |
- 'app/controllers/concerns/foreman/controller/parameters/docker_registry.rb' |
|
122 |
- 'app/controllers/containers/steps_controller.rb' |
|
123 |
- 'app/controllers/containers_controller.rb' |
|
124 |
- 'app/helpers/containers_helper.rb' |
|
125 |
- 'app/models/docker_container_wizard_states/preliminary.rb' |
|
126 |
- 'app/models/docker_registry.rb' |
|
127 |
- 'app/models/service/containers.rb' |
|
128 |
- 'test/functionals/containers_controller_test.rb' |
|
129 |
- 'test/units/container_remover_test.rb' |
|
130 |
- 'test/units/containers_service_test.rb' |
|
89 |
Enabled: false |
|
131 | 90 |
|
132 | 91 |
# Offense count: 41 |
133 | 92 |
# Cop supports --auto-correct. |
134 |
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
93 |
# Configuration parameters: EnforcedStyle, IndentationWidth. |
|
135 | 94 |
# SupportedStyles: aligned, indented, indented_relative_to_receiver |
136 | 95 |
Layout/MultilineMethodCallIndentation: |
137 |
Exclude: |
|
138 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
139 |
- 'app/controllers/api/v2/registries_controller.rb' |
|
140 |
- 'app/controllers/concerns/foreman_docker/find_container.rb' |
|
141 |
- 'app/controllers/image_search_controller.rb' |
|
142 |
- 'app/controllers/registries_controller.rb' |
|
143 |
- 'app/helpers/container_steps_helper.rb' |
|
144 |
- 'app/helpers/containers_helper.rb' |
|
145 |
- 'app/models/service/containers.rb' |
|
146 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
147 |
- 'test/functionals/containers_controller_test.rb' |
|
148 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
149 |
- 'test/functionals/image_search_controller_test.rb' |
|
150 |
- 'test/units/containers_service_test.rb' |
|
151 |
- 'test/units/docker_registry_test.rb' |
|
152 |
- 'test/units/image_search_service_test.rb' |
|
96 |
Enabled: false |
|
153 | 97 |
|
154 | 98 |
# Offense count: 4 |
155 | 99 |
# Cop supports --auto-correct. |
156 |
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
100 |
# Configuration parameters: EnforcedStyle, IndentationWidth. |
|
157 | 101 |
# SupportedStyles: aligned, indented |
158 | 102 |
Layout/MultilineOperationIndentation: |
159 |
Exclude: |
|
160 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
161 |
- 'app/controllers/containers_controller.rb' |
|
103 |
Enabled: false |
|
162 | 104 |
|
163 | 105 |
# Offense count: 2 |
164 | 106 |
# Cop supports --auto-correct. |
165 | 107 |
# Configuration parameters: AllowForAlignment. |
166 | 108 |
Layout/SpaceAroundOperators: |
167 |
Exclude: |
|
168 |
- 'app/controllers/containers_controller.rb' |
|
169 |
- 'app/models/concerns/foreman_docker/parameter_validators.rb' |
|
109 |
Enabled: false |
|
170 | 110 |
|
171 | 111 |
# Offense count: 1 |
172 | 112 |
# Cop supports --auto-correct. |
173 |
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces, SpaceBeforeBlockParameters.
|
|
113 |
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
|
174 | 114 |
# SupportedStyles: space, no_space |
175 | 115 |
# SupportedStylesForEmptyBraces: space, no_space |
176 | 116 |
Layout/SpaceInsideBlockBraces: |
177 |
Exclude: |
|
178 |
- 'test/functionals/image_search_controller_test.rb' |
|
117 |
Enabled: false |
|
179 | 118 |
|
180 | 119 |
# Offense count: 12 |
181 | 120 |
# Cop supports --auto-correct. |
182 |
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
|
|
121 |
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
183 | 122 |
# SupportedStyles: space, no_space, compact |
184 | 123 |
# SupportedStylesForEmptyBraces: space, no_space |
185 | 124 |
Layout/SpaceInsideHashLiteralBraces: |
186 |
Exclude: |
|
187 |
- 'app/models/service/registry_api.rb' |
|
188 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
189 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
190 |
- 'test/functionals/image_search_controller_test.rb' |
|
191 |
- 'test/test_plugin_helper.rb' |
|
192 |
- 'test/units/image_search_service_test.rb' |
|
125 |
Enabled: false |
|
193 | 126 |
|
194 | 127 |
# Offense count: 2 |
195 | 128 |
# Cop supports --auto-correct. |
196 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
129 |
# Configuration parameters: EnforcedStyle. |
|
197 | 130 |
# SupportedStyles: final_newline, final_blank_line |
198 | 131 |
Layout/TrailingBlankLines: |
199 |
Exclude: |
|
200 |
- 'app/services/foreman_docker/image_search.rb' |
|
201 |
- 'app/views/api/v2/registries/main.json.rabl' |
|
132 |
Enabled: false |
|
202 | 133 |
|
203 | 134 |
# Offense count: 1 |
204 | 135 |
# Cop supports --auto-correct. |
205 | 136 |
Layout/TrailingWhitespace: |
206 |
Exclude: |
|
207 |
- 'app/controllers/containers/steps_controller.rb' |
|
137 |
Enabled: false |
|
208 | 138 |
|
209 | 139 |
# Offense count: 1 |
210 | 140 |
Lint/AmbiguousRegexpLiteral: |
211 |
Exclude: |
|
212 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
213 |
|
|
214 |
# Offense count: 12 |
|
215 |
Lint/RescueWithoutErrorClass: |
|
216 |
Exclude: |
|
217 |
- 'Rakefile' |
|
218 |
- 'app/controllers/containers_controller.rb' |
|
219 |
- 'app/models/docker_registry.rb' |
|
220 |
- 'app/models/foreman_docker/docker.rb' |
|
221 |
- 'app/models/service/registry_api.rb' |
|
222 |
- 'app/services/foreman_docker/container_remover.rb' |
|
223 |
- 'lib/tasks/test.rake' |
|
141 |
Enabled: false |
|
224 | 142 |
|
225 | 143 |
# Offense count: 1 |
226 |
# Cop supports --auto-correct. |
|
227 |
Lint/UnifiedInteger: |
|
228 |
Exclude: |
|
229 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
144 |
# Configuration parameters: MaximumRangeSize. |
|
145 |
Lint/MissingCopEnableDirective: |
|
146 |
Enabled: false |
|
230 | 147 |
|
231 | 148 |
# Offense count: 1 |
232 | 149 |
# Cop supports --auto-correct. |
233 |
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. |
|
234 |
Lint/UnusedMethodArgument: |
|
235 |
Exclude: |
|
236 |
- 'app/models/foreman_docker/docker.rb' |
|
150 |
Lint/UnifiedInteger: |
|
151 |
Enabled: false |
|
237 | 152 |
|
238 | 153 |
# Offense count: 1 |
239 | 154 |
# Cop supports --auto-correct. |
240 | 155 |
Lint/UriRegexp: |
241 |
Exclude: |
|
242 |
- 'app/models/foreman_docker/docker.rb' |
|
156 |
Enabled: false |
|
243 | 157 |
|
244 |
# Offense count: 15
|
|
158 |
# Offense count: 16
|
|
245 | 159 |
Metrics/AbcSize: |
246 | 160 |
Max: 30 |
247 | 161 |
|
... | ... | |
253 | 167 |
# Offense count: 3 |
254 | 168 |
# Configuration parameters: CountComments. |
255 | 169 |
Metrics/ClassLength: |
256 |
Max: 172
|
|
170 |
Max: 170
|
|
257 | 171 |
|
258 |
# Offense count: 205
|
|
172 |
# Offense count: 220
|
|
259 | 173 |
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. |
260 | 174 |
# URISchemes: http, https |
261 | 175 |
Metrics/LineLength: |
262 |
Max: 181
|
|
176 |
Max: 200
|
|
263 | 177 |
|
264 | 178 |
# Offense count: 19 |
265 | 179 |
# Configuration parameters: CountComments. |
... | ... | |
270 | 184 |
# Cop supports --auto-correct. |
271 | 185 |
# Configuration parameters: AutoCorrect. |
272 | 186 |
Performance/HashEachMethods: |
273 |
Exclude: |
|
274 |
- 'app/services/foreman_docker/image_search.rb' |
|
275 |
|
|
276 |
# Offense count: 10 |
|
277 |
# Cop supports --auto-correct. |
|
278 |
Rails/ApplicationRecord: |
|
279 |
Exclude: |
|
280 |
- 'app/models/container.rb' |
|
281 |
- 'app/models/docker_container_wizard_state.rb' |
|
282 |
- 'app/models/docker_container_wizard_states/configuration.rb' |
|
283 |
- 'app/models/docker_container_wizard_states/environment.rb' |
|
284 |
- 'app/models/docker_container_wizard_states/image.rb' |
|
285 |
- 'app/models/docker_container_wizard_states/preliminary.rb' |
|
286 |
- 'app/models/docker_parameter.rb' |
|
287 |
- 'app/models/docker_registry.rb' |
|
288 |
- 'db/migrate/20160605134652_move_parameters_to_docker_parameters.rb' |
|
187 |
Enabled: false |
|
289 | 188 |
|
290 | 189 |
# Offense count: 2 |
291 | 190 |
# Cop supports --auto-correct. |
292 | 191 |
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. |
293 | 192 |
Rails/Blank: |
294 |
Exclude: |
|
295 |
- 'app/models/service/containers.rb' |
|
296 |
- 'app/services/foreman_docker/utility.rb' |
|
193 |
Enabled: false |
|
297 | 194 |
|
298 | 195 |
# Offense count: 3 |
299 | 196 |
# Cop supports --auto-correct. |
300 | 197 |
# Configuration parameters: Whitelist. |
301 | 198 |
# Whitelist: find_by_sql |
302 | 199 |
Rails/DynamicFindBy: |
303 |
Exclude: |
|
304 |
- 'app/controllers/containers_controller.rb' |
|
305 |
- 'app/helpers/containers_helper.rb' |
|
200 |
Enabled: false |
|
306 | 201 |
|
307 |
# Offense count: 34 |
|
308 |
# Cop supports --auto-correct. |
|
202 |
# Offense count: 5 |
|
309 | 203 |
# Configuration parameters: Include. |
310 |
# Include: spec/**/*, test/**/* |
|
311 |
Rails/HttpPositionalArguments: |
|
312 |
Exclude: |
|
313 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
314 |
- 'test/functionals/api/v2/registries_controller_test.rb' |
|
315 |
- 'test/functionals/containers_controller_test.rb' |
|
316 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
204 |
# Include: app/models/**/*.rb |
|
205 |
Rails/InverseOf: |
|
206 |
Enabled: false |
|
207 |
|
|
208 |
# Offense count: 1 |
|
209 |
# Cop supports --auto-correct. |
|
210 |
Rails/Presence: |
|
211 |
Enabled: false |
|
317 | 212 |
|
318 | 213 |
# Offense count: 1 |
319 | 214 |
# Cop supports --auto-correct. |
320 | 215 |
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. |
321 | 216 |
Rails/Present: |
322 |
Exclude: |
|
323 |
- 'app/models/docker_parameter.rb' |
|
217 |
Enabled: false |
|
324 | 218 |
|
325 | 219 |
# Offense count: 2 |
326 | 220 |
# Configuration parameters: Blacklist. |
327 | 221 |
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters |
328 | 222 |
Rails/SkipsModelValidations: |
329 |
Exclude: |
|
330 |
- 'db/migrate/20141209182008_remove_docker_tables.rb' |
|
223 |
Enabled: false |
|
331 | 224 |
|
332 | 225 |
# Offense count: 8 |
333 | 226 |
# Cop supports --auto-correct. |
334 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
227 |
# Configuration parameters: EnforcedStyle. |
|
335 | 228 |
# SupportedStyles: braces, no_braces, context_dependent |
336 | 229 |
Style/BracesAroundHashParameters: |
337 |
Exclude: |
|
338 |
- 'app/models/service/registry_api.rb' |
|
339 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
340 |
- 'test/functionals/image_search_controller_test.rb' |
|
341 |
- 'test/test_plugin_helper.rb' |
|
342 |
- 'test/units/image_search_service_test.rb' |
|
230 |
Enabled: false |
|
343 | 231 |
|
344 | 232 |
# Offense count: 1 |
345 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
233 |
# Configuration parameters: EnforcedStyle. |
|
346 | 234 |
# SupportedStyles: nested, compact |
347 | 235 |
Style/ClassAndModuleChildren: |
348 |
Exclude: |
|
349 |
- 'app/controllers/concerns/foreman/controller/parameters/docker_registry.rb' |
|
236 |
Enabled: false |
|
350 | 237 |
|
351 | 238 |
# Offense count: 1 |
352 | 239 |
Style/ClassVars: |
353 |
Exclude: |
|
354 |
- 'app/models/service/registry_api.rb' |
|
240 |
Enabled: false |
|
355 | 241 |
|
356 | 242 |
# Offense count: 1 |
357 | 243 |
# Cop supports --auto-correct. |
358 | 244 |
Style/EmptyLiteral: |
359 |
Exclude: |
|
360 |
- 'test/units/image_search_service_test.rb' |
|
245 |
Enabled: false |
|
361 | 246 |
|
362 | 247 |
# Offense count: 4 |
363 | 248 |
# Cop supports --auto-correct. |
364 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
249 |
# Configuration parameters: EnforcedStyle. |
|
365 | 250 |
# SupportedStyles: compact, expanded |
366 | 251 |
Style/EmptyMethod: |
367 |
Exclude: |
|
368 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
369 |
- 'app/controllers/api/v2/registries_controller.rb' |
|
370 |
- 'app/controllers/containers_controller.rb' |
|
371 |
- 'app/controllers/registries_controller.rb' |
|
252 |
Enabled: false |
|
372 | 253 |
|
373 | 254 |
# Offense count: 8 |
374 | 255 |
# Cop supports --auto-correct. |
375 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
256 |
# Configuration parameters: EnforcedStyle. |
|
376 | 257 |
# SupportedStyles: format, sprintf, percent |
377 | 258 |
Style/FormatString: |
378 |
Exclude: |
|
379 |
- 'app/controllers/containers_controller.rb' |
|
380 |
- 'app/helpers/containers_helper.rb' |
|
381 |
- 'app/models/concerns/fog_extensions/fogdocker/server.rb' |
|
382 |
- 'app/models/docker_container_wizard_states/image.rb' |
|
383 |
|
|
384 |
# Offense count: 15 |
|
385 |
# Configuration parameters: SupportedStyles. |
|
386 |
# SupportedStyles: annotated, template |
|
259 |
Enabled: false |
|
260 |
|
|
261 |
# Offense count: 21 |
|
262 |
# Configuration parameters: EnforcedStyle. |
|
263 |
# SupportedStyles: annotated, template, unannotated |
|
387 | 264 |
Style/FormatStringToken: |
388 |
EnforcedStyle: template
|
|
265 |
Enabled: false
|
|
389 | 266 |
|
390 |
# Offense count: 1
|
|
267 |
# Offense count: 4
|
|
391 | 268 |
# Cop supports --auto-correct. |
392 |
# Configuration parameters: MaxLineLength. |
|
393 | 269 |
Style/IfUnlessModifier: |
394 |
Exclude: |
|
395 |
- 'app/models/service/containers.rb' |
|
270 |
Enabled: false |
|
396 | 271 |
|
397 | 272 |
# Offense count: 4 |
398 | 273 |
# Cop supports --auto-correct. |
399 | 274 |
Style/LineEndConcatenation: |
400 |
Exclude: |
|
401 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
275 |
Enabled: false |
|
402 | 276 |
|
403 | 277 |
# Offense count: 1 |
404 | 278 |
Style/MultilineBlockChain: |
405 |
Exclude: |
|
406 |
- 'app/models/service/registry_api.rb' |
|
279 |
Enabled: false |
|
407 | 280 |
|
408 | 281 |
# Offense count: 2 |
409 | 282 |
# Cop supports --auto-correct. |
410 | 283 |
Style/MutableConstant: |
411 |
Exclude: |
|
412 |
- 'app/models/service/registry_api.rb' |
|
413 |
- 'lib/foreman_docker/version.rb' |
|
284 |
Enabled: false |
|
414 | 285 |
|
415 | 286 |
# Offense count: 2 |
416 | 287 |
# Cop supports --auto-correct. |
417 |
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
|
|
288 |
# Configuration parameters: AutoCorrect, EnforcedStyle. |
|
418 | 289 |
# SupportedStyles: predicate, comparison |
419 | 290 |
Style/NumericPredicate: |
420 |
Exclude: |
|
421 |
- 'spec/**/*' |
|
422 |
- 'app/helpers/container_steps_helper.rb' |
|
423 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
291 |
Enabled: false |
|
424 | 292 |
|
425 | 293 |
# Offense count: 7 |
426 | 294 |
# Cop supports --auto-correct. |
427 | 295 |
# Configuration parameters: PreferredDelimiters. |
428 | 296 |
Style/PercentLiteralDelimiters: |
429 |
Exclude: |
|
430 |
- 'app/controllers/api/v2/containers_controller.rb' |
|
431 |
- 'app/controllers/api/v2/registries_controller.rb' |
|
432 |
- 'app/models/docker_container_wizard_states/exposed_port.rb' |
|
433 |
- 'app/models/exposed_port.rb' |
|
434 |
- 'app/models/foreman_docker/taxonomy_extensions.rb' |
|
435 |
- 'test/functionals/api/v2/containers_controller_test.rb' |
|
436 |
- 'test/functionals/api/v2/registries_controller_test.rb' |
|
297 |
Enabled: false |
|
437 | 298 |
|
438 | 299 |
# Offense count: 2 |
439 | 300 |
# Cop supports --auto-correct. |
440 | 301 |
Style/RedundantParentheses: |
441 |
Exclude: |
|
442 |
- 'test/units/docker_registry_test.rb' |
|
302 |
Enabled: false |
|
443 | 303 |
|
444 | 304 |
# Offense count: 3 |
445 | 305 |
# Cop supports --auto-correct. |
446 | 306 |
Style/RedundantSelf: |
447 |
Exclude: |
|
448 |
- 'app/models/concerns/foreman_docker/parameter_validators.rb' |
|
449 |
- 'app/models/docker_parameter.rb' |
|
450 |
- 'app/services/foreman_docker/image_search.rb' |
|
307 |
Enabled: false |
|
308 |
|
|
309 |
# Offense count: 12 |
|
310 |
# Cop supports --auto-correct. |
|
311 |
# Configuration parameters: EnforcedStyle. |
|
312 |
# SupportedStyles: implicit, explicit |
|
313 |
Style/RescueStandardError: |
|
314 |
Enabled: false |
|
451 | 315 |
|
452 | 316 |
# Offense count: 3 |
453 | 317 |
# Cop supports --auto-correct. |
454 |
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
318 |
# Configuration parameters: EnforcedStyle. |
|
455 | 319 |
# SupportedStyles: only_raise, only_fail, semantic |
456 | 320 |
Style/SignalException: |
457 |
Exclude: |
|
458 |
- 'app/models/service/containers.rb' |
|
459 |
- 'app/services/foreman_docker/utility.rb' |
|
460 |
- 'db/migrate/20141209182008_remove_docker_tables.rb' |
|
321 |
Enabled: false |
|
461 | 322 |
|
462 | 323 |
# Offense count: 29 |
463 | 324 |
# Cop supports --auto-correct. |
464 |
# Configuration parameters: MinSize, SupportedStyles.
|
|
325 |
# Configuration parameters: MinSize. |
|
465 | 326 |
# SupportedStyles: percent, brackets |
466 | 327 |
Style/SymbolArray: |
467 | 328 |
EnforcedStyle: brackets |
468 | 329 |
|
469 | 330 |
# Offense count: 2 |
470 | 331 |
# Cop supports --auto-correct. |
471 |
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
|
|
332 |
# Configuration parameters: EnforcedStyleForMultiline. |
|
472 | 333 |
# SupportedStylesForMultiline: comma, consistent_comma, no_comma |
473 | 334 |
Style/TrailingCommaInLiteral: |
474 |
Exclude: |
|
475 |
- 'app/models/docker_container_wizard_states/image.rb' |
|
476 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
335 |
Enabled: false |
|
477 | 336 |
|
478 | 337 |
# Offense count: 1 |
479 | 338 |
# Cop supports --auto-correct. |
480 | 339 |
Style/UnlessElse: |
481 |
Exclude: |
|
482 |
- 'app/services/foreman_docker/image_search.rb' |
|
340 |
Enabled: false |
|
483 | 341 |
|
484 | 342 |
# Offense count: 4 |
485 | 343 |
# Cop supports --auto-correct. |
486 | 344 |
Style/UnneededInterpolation: |
487 |
Exclude: |
|
488 |
- 'app/models/container.rb' |
|
489 |
- 'app/models/docker_container_wizard_states/image.rb' |
|
490 |
- 'app/models/service/registry_api.rb' |
|
491 |
- 'release/changelog' |
|
345 |
Enabled: false |
|
492 | 346 |
|
493 | 347 |
# Offense count: 6 |
494 | 348 |
# Cop supports --auto-correct. |
495 |
# Configuration parameters: SupportedStyles, WordRegex.
|
|
349 |
# Configuration parameters: WordRegex. |
|
496 | 350 |
# SupportedStyles: percent, brackets |
497 | 351 |
Style/WordArray: |
498 | 352 |
EnforcedStyle: percent |
... | ... | |
501 | 355 |
# Offense count: 2 |
502 | 356 |
# Cop supports --auto-correct. |
503 | 357 |
Style/ZeroLengthPredicate: |
504 |
Exclude: |
|
505 |
- 'app/helpers/container_steps_helper.rb' |
|
506 |
- 'test/functionals/containers_steps_controller_test.rb' |
|
358 |
Enabled: false |
app/models/container.rb | ||
---|---|---|
1 |
class Container < ActiveRecord::Base
|
|
1 |
class Container < ApplicationRecord
|
|
2 | 2 |
include Authorizable |
3 | 3 |
include Taxonomix |
4 | 4 |
|
app/models/docker_container_wizard_state.rb | ||
---|---|---|
1 |
class DockerContainerWizardState < ActiveRecord::Base
|
|
1 |
class DockerContainerWizardState < ApplicationRecord
|
|
2 | 2 |
has_one :preliminary, :class_name => DockerContainerWizardStates::Preliminary, |
3 | 3 |
:dependent => :destroy, :validate => true, :autosave => true |
4 | 4 |
has_one :image, :class_name => DockerContainerWizardStates::Image, |
app/models/docker_container_wizard_states/configuration.rb | ||
---|---|---|
1 | 1 |
module DockerContainerWizardStates |
2 |
class Configuration < ActiveRecord::Base
|
|
2 |
class Configuration < ApplicationRecord
|
|
3 | 3 |
self.table_name_prefix = 'docker_container_wizard_states_' |
4 | 4 |
belongs_to :wizard_state, :class_name => DockerContainerWizardState, |
5 | 5 |
:foreign_key => :docker_container_wizard_state_id |
app/models/docker_container_wizard_states/environment.rb | ||
---|---|---|
1 | 1 |
module DockerContainerWizardStates |
2 |
class Environment < ActiveRecord::Base
|
|
2 |
class Environment < ApplicationRecord
|
|
3 | 3 |
self.table_name_prefix = 'docker_container_wizard_states_' |
4 | 4 |
belongs_to :wizard_state, :class_name => DockerContainerWizardState |
5 | 5 |
|
app/models/docker_container_wizard_states/image.rb | ||
---|---|---|
1 | 1 |
module DockerContainerWizardStates |
2 |
class Image < ActiveRecord::Base
|
|
2 |
class Image < ApplicationRecord
|
|
3 | 3 |
self.table_name_prefix = 'docker_container_wizard_states_' |
4 | 4 |
belongs_to :wizard_state, :class_name => DockerContainerWizardState, |
5 | 5 |
:foreign_key => :docker_container_wizard_state_id |
app/models/docker_container_wizard_states/preliminary.rb | ||
---|---|---|
1 | 1 |
module DockerContainerWizardStates |
2 |
class Preliminary < ActiveRecord::Base
|
|
2 |
class Preliminary < ApplicationRecord
|
|
3 | 3 |
include Taxonomix |
4 | 4 |
|
5 | 5 |
self.table_name_prefix = 'docker_container_wizard_states_' |
app/models/docker_parameter.rb | ||
---|---|---|
1 |
class DockerParameter < ActiveRecord::Base
|
|
1 |
class DockerParameter < ApplicationRecord
|
|
2 | 2 |
extend FriendlyId |
3 | 3 |
friendly_id :key |
4 | 4 |
include Parameterizable::ByIdName |
app/models/docker_registry.rb | ||
---|---|---|
1 |
class DockerRegistry < ActiveRecord::Base
|
|
1 |
class DockerRegistry < ApplicationRecord
|
|
2 | 2 |
include Authorizable |
3 | 3 |
include Taxonomix |
4 | 4 |
include Encryptable |
db/migrate/20140930175337_add_email_to_compute_resource.rb | ||
---|---|---|
1 |
class AddEmailToComputeResource < ActiveRecord::Migration |
|
1 |
class AddEmailToComputeResource < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :compute_resources, :email, :string |
4 | 4 |
end |
db/migrate/20141005233312_create_containers.rb | ||
---|---|---|
1 |
class CreateContainers < ActiveRecord::Migration |
|
1 |
class CreateContainers < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
create_table :containers do |t| |
4 | 4 |
t.string :name |
db/migrate/20141007225130_add_compute_resource_id_to_container.rb | ||
---|---|---|
1 |
class AddComputeResourceIdToContainer < ActiveRecord::Migration |
|
1 |
class AddComputeResourceIdToContainer < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :containers, :compute_resource_id, :integer |
4 | 4 |
end |
db/migrate/20141009001613_add_tag_to_container.rb | ||
---|---|---|
1 |
class AddTagToContainer < ActiveRecord::Migration |
|
1 |
class AddTagToContainer < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :containers, :tag, :string |
4 | 4 |
end |
db/migrate/20141009011026_add_attributes_to_container.rb | ||
---|---|---|
1 |
class AddAttributesToContainer < ActiveRecord::Migration |
|
1 |
class AddAttributesToContainer < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :containers, :entrypoint, :string |
4 | 4 |
add_column :containers, :cpu_set, :integer |
db/migrate/20141010173220_create_docker_images.rb | ||
---|---|---|
1 |
class CreateDockerImages < ActiveRecord::Migration |
|
1 |
class CreateDockerImages < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
create_table :docker_images do |t| |
4 | 4 |
t.string :image_id |
db/migrate/20141018110810_add_uuid_to_containers.rb | ||
---|---|---|
1 |
class AddUuidToContainers < ActiveRecord::Migration |
|
1 |
class AddUuidToContainers < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :containers, :uuid, :string |
4 | 4 |
add_index :containers, [:uuid, :compute_resource_id] |
db/migrate/20141024163003_create_docker_registries.rb | ||
---|---|---|
1 |
class CreateDockerRegistries < ActiveRecord::Migration |
|
1 |
class CreateDockerRegistries < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
create_table :docker_registries do |t| |
4 | 4 |
t.string :url |
db/migrate/20141028164206_change_memory_in_container.rb | ||
---|---|---|
1 |
class ChangeMemoryInContainer < ActiveRecord::Migration |
|
1 |
class ChangeMemoryInContainer < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
change_column :containers, :memory, :string |
4 | 4 |
end |
db/migrate/20141028164633_change_cpuset_in_container.rb | ||
---|---|---|
1 |
class ChangeCpusetInContainer < ActiveRecord::Migration |
|
1 |
class ChangeCpusetInContainer < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
change_column :containers, :cpu_set, :string |
4 | 4 |
end |
db/migrate/20141120123003_add_user_credentials_to_docker_registries.rb | ||
---|---|---|
1 |
class AddUserCredentialsToDockerRegistries < ActiveRecord::Migration |
|
1 |
class AddUserCredentialsToDockerRegistries < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :docker_registries, :username, :string |
4 | 4 |
add_column :docker_registries, :password, :string |
db/migrate/20141209182008_remove_docker_tables.rb | ||
---|---|---|
1 |
class RemoveDockerTables < ActiveRecord::Migration |
|
1 |
class RemoveDockerTables < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
class DockerImage |
3 | 3 |
end |
4 | 4 |
|
db/migrate/20141222113313_create_wizard_states.rb | ||
---|---|---|
1 |
class CreateWizardStates < ActiveRecord::Migration |
|
1 |
class CreateWizardStates < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
# rubocop:disable Metrics/MethodLength |
3 | 3 |
def change |
4 | 4 |
create_table :docker_container_wizard_states, &:timestamps |
db/migrate/20150122011747_add_katello_flag_to_docker_wizard_image.rb | ||
---|---|---|
1 |
class AddKatelloFlagToDockerWizardImage < ActiveRecord::Migration |
|
1 |
class AddKatelloFlagToDockerWizardImage < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
add_column :docker_container_wizard_states_images, :katello, :boolean |
4 | 4 |
end |
db/migrate/20150129054944_add_katello_flag_to_containers.rb | ||
---|---|---|
1 |
class AddKatelloFlagToContainers < ActiveRecord::Migration |
|
1 |
class AddKatelloFlagToContainers < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
add_column :containers, :katello, :boolean |
4 | 4 |
end |
db/migrate/20150303175646_remove_katello_flag_from_containers.rb | ||
---|---|---|
1 |
class RemoveKatelloFlagFromContainers < ActiveRecord::Migration |
|
1 |
class RemoveKatelloFlagFromContainers < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
remove_column :containers, :katello |
4 | 4 |
end |
db/migrate/20150814205620_change_container_column_type.rb | ||
---|---|---|
1 |
class ChangeContainerColumnType < ActiveRecord::Migration |
|
1 |
class ChangeContainerColumnType < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def up |
3 | 3 |
change_column :containers, :cpu_shares, :integer |
4 | 4 |
change_column :docker_container_wizard_states_configurations, :cpu_shares, :integer |
db/migrate/20160605133025_create_docker_parameters.rb | ||
---|---|---|
1 |
class CreateDockerParameters < ActiveRecord::Migration |
|
1 |
class CreateDockerParameters < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
create_table :docker_parameters do |t| |
4 | 4 |
t.string :key, :limit => 255 |
db/migrate/20160605134652_move_parameters_to_docker_parameters.rb | ||
---|---|---|
1 |
class MoveParametersToDockerParameters < ActiveRecord::Migration |
|
2 |
class FakeDockerParameter < ActiveRecord::Base
|
|
1 |
class MoveParametersToDockerParameters < ActiveRecord::Migration[4.2]
|
|
2 |
class FakeDockerParameter < ApplicationRecord
|
|
3 | 3 |
self.table_name = 'docker_parameters' |
4 | 4 |
end |
5 | 5 |
|
6 |
class FakeParameter < ActiveRecord::Base
|
|
6 |
class FakeParameter < ApplicationRecord
|
|
7 | 7 |
self.table_name = 'parameters' |
8 | 8 |
end |
9 | 9 |
|
db/migrate/20170508130316_add_verify_ssl_option_to_docker_registries.rb | ||
---|---|---|
1 |
class AddVerifySslOptionToDockerRegistries < ActiveRecord::Migration |
|
1 |
class AddVerifySslOptionToDockerRegistries < ActiveRecord::Migration[4.2]
|
|
2 | 2 |
def change |
3 | 3 |
add_column :docker_registries, :verify_ssl, :boolean, default: true |
4 | 4 |
end |
foreman_docker.gemspec | ||
---|---|---|
24 | 24 |
s.add_dependency 'deface', '< 2.0' |
25 | 25 |
s.add_dependency 'wicked', '~> 1.1' |
26 | 26 |
|
27 |
s.add_development_dependency 'rubocop', '0.51.0'
|
|
27 |
s.add_development_dependency 'rubocop', '0.52.0'
|
|
28 | 28 |
end |
test/functionals/api/v2/containers_controller_test.rb | ||
---|---|---|
9 | 9 |
end |
10 | 10 |
|
11 | 11 |
test 'index returns a list of all containers' do |
12 |
get :index, {}, set_session_user
|
|
12 |
get :index, session: set_session_user
|
|
13 | 13 |
assert_response :success |
14 | 14 |
assert_template 'index' |
15 | 15 |
end |
... | ... | |
18 | 18 |
%w(thomas clayton wolfe).each do |name| |
19 | 19 |
FactoryBot.create(:container, :name => name) |
20 | 20 |
end |
21 |
get :index, { :search => 'name = thomas' }, set_session_user
|
|
21 |
get :index, params: { :search => 'name = thomas' }, session: set_session_user
|
|
22 | 22 |
assert_response :success |
23 | 23 |
assert_equal 1, assigns(:containers).length |
24 | 24 |
end |
... | ... | |
34 | 34 |
fake_container = Struct.new(:logs) |
35 | 35 |
fake_container.expects(:logs).returns('I am a log').twice |
36 | 36 |
Docker::Container.expects(:get).with(@container.uuid).returns(fake_container) |
37 |
get :logs, :id => @container.id
|
|
37 |
get :logs, params: { :id => @container.id }
|
|
38 | 38 |
assert_response :success |
39 | 39 |
assert_equal ActiveSupport::JSON.decode(response.body)['logs'], fake_container.logs |
40 | 40 |
end |
41 | 41 |
|
42 | 42 |
test 'show returns information about container' do |
43 |
get :show, :id => @container.id
|
|
43 |
get :show, params: { :id => @container.id }
|
|
44 | 44 |
assert_response :success |
45 | 45 |
assert_equal ActiveSupport::JSON.decode(response.body)['name'], 'foo' |
46 | 46 |
end |
... | ... | |
52 | 52 |
|
53 | 53 |
test 'delete removes a container in foreman and in Docker host' do |
54 | 54 |
Fog.mock! |
55 |
delete :destroy, :id => @container.id
|
|
55 |
delete :destroy, params: { :id => @container.id }
|
|
56 | 56 |
Fog.unmock! |
57 | 57 |
assert_response :success |
58 | 58 |
assert_equal ActiveSupport::JSON.decode(response.body)['name'], 'foo' |
... | ... | |
62 | 62 |
ComputeResource.any_instance.expects(:destroy_vm). |
63 | 63 |
with('randomuuid'). |
64 | 64 |
raises(::Foreman::Exception.new('Problem removing container')) |
65 |
delete :destroy, :id => @container.id
|
|
65 |
delete :destroy, params: { :id => @container.id }
|
|
66 | 66 |
assert_response :precondition_failed |
67 | 67 |
end |
68 | 68 |
end |
... | ... | |
73 | 73 |
|
74 | 74 |
test 'power call turns on/off container in Docker host' do |
75 | 75 |
Fog::Compute::Fogdocker::Server.any_instance.expects(:start) |
76 |
put :power, :id => @container.id, :power_action => 'start'
|
|
76 |
put :power, params: { :id => @container.id, :power_action => 'start' }
|
|
77 | 77 |
assert_response :success |
78 | 78 |
end |
79 | 79 |
|
80 | 80 |
test 'power call checks status of container in Docker host' do |
81 | 81 |
Fog::Compute::Fogdocker::Server.any_instance.expects(:ready?).returns(false) |
82 |
put :power, :id => @container.id, :power_action => 'status'
|
|
82 |
put :power, params: { :id => @container.id, :power_action => 'status' }
|
|
83 | 83 |
assert_response :success |
84 | 84 |
assert_equal ActiveSupport::JSON.decode(response.body)['running'], false |
85 | 85 |
end |
86 | 86 |
|
87 | 87 |
test 'power call host' do |
88 | 88 |
Fog::Compute::Fogdocker::Server.any_instance.expects(:ready?).returns(false) |
89 |
put :power, :id => @container.id, :power_action => 'status'
|
|
89 |
put :power, params: { :id => @container.id, :power_action => 'status' }
|
|
90 | 90 |
assert_response :success |
91 | 91 |
assert_equal ActiveSupport::JSON.decode(response.body)['running'], false |
92 | 92 |
end |
... | ... | |
107 | 107 |
container.repository_pull_url.must_include(registry_uri.host) |
108 | 108 |
container.repository_pull_url.must_include("#{repository_name}:#{tag}") |
109 | 109 |
end |
110 |
post :create, :container => { :compute_resource_id => @compute_resource.id, |
|
111 |
:name => name, |
|
112 |
:registry_id => @registry.id, |
|
113 |
:repository_name => repository_name, |
|
114 |
:tag => tag }
|
|
110 |
post :create, params: { :container => { :compute_resource_id => @compute_resource.id,
|
|
111 |
:name => name,
|
|
112 |
:registry_id => @registry.id,
|
|
113 |
:repository_name => repository_name,
|
|
114 |
:tag => tag } }
|
|
115 | 115 |
assert_response :created |
116 | 116 |
end |
117 | 117 |
|
... | ... | |
121 | 121 |
name = "foo2" |
122 | 122 |
Service::Containers.any_instance.expects(:pull_image).returns(true) |
123 | 123 |
Service::Containers.any_instance.expects(:start_container).returns(true) |
124 |
post :create, :container => { :compute_resource_id => @compute_resource.id, |
|
125 |
:name => name, |
|
126 |
:registry_id => @registry.id, |
|
127 |
:repository_name => repository_name, |
|
128 |
:tag => tag, |
|
129 |
:environment_variables => [{:key => 'ping_host', :value => 'example.com'}]}
|
|
124 |
post :create, params: { :container => { :compute_resource_id => @compute_resource.id,
|
|
125 |
:name => name,
|
|
126 |
:registry_id => @registry.id,
|
|
127 |
:repository_name => repository_name,
|
|
128 |
:tag => tag,
|
|
129 |
:environment_variables => [{:key => 'ping_host', :value => 'example.com'}]} }
|
|
130 | 130 |
assert_response :created |
131 | 131 |
end |
132 | 132 |
end |
... | ... | |
150 | 150 |
container_attributes[:name].must_equal(name) |
151 | 151 |
wizard_state.image.capsule_id.must_equal(capsule_id) |
152 | 152 |
end |
153 |
post :create, :container => { :compute_resource_id => @compute_resource.id, |
|
154 |
:name => name, |
|
155 |
:capsule_id => capsule_id, |
|
156 |
:repository_name => repository_name, |
|
157 |
:tag => tag }
|
|
153 |
post :create, params: { :container => { :compute_resource_id => @compute_resource.id,
|
|
154 |
:name => name,
|
|
155 |
:capsule_id => capsule_id,
|
|
156 |
:repository_name => repository_name,
|
|
157 |
:tag => tag } }
|
|
158 | 158 |
assert_response :created |
159 | 159 |
end |
160 | 160 |
|
161 | 161 |
test 'creation fails with invalid container name' do |
162 |
post :create, :container => { :compute_resource_id => @container.compute_resource_id, |
|
163 |
:name => @container.name, |
|
164 |
:registry_id => @registry.id, |
|
165 |
:repository_name => 'centos', |
|
166 |
:tag => 'latest' }
|
|
162 |
post :create, params: { :container => { :compute_resource_id => @container.compute_resource_id,
|
|
163 |
:name => @container.name,
|
|
164 |
:registry_id => @registry.id,
|
|
165 |
:repository_name => 'centos',
|
|
166 |
:tag => 'latest' } }
|
|
167 | 167 |
assert_response :unprocessable_entity |
168 | 168 |
assert_match /Name has already been taken/, @response.body |
169 | 169 |
end |
test/functionals/api/v2/registries_controller_test.rb | ||
---|---|---|
8 | 8 |
end |
9 | 9 |
|
10 | 10 |
test 'index returns a list of all containers' do |
11 |
get :index, {}, set_session_user
|
|
11 |
get :index, session: set_session_user
|
|
12 | 12 |
assert_response :success |
13 | 13 |
assert_template 'index' |
14 | 14 |
end |
... | ... | |
17 | 17 |
%w(thomas clayton wolfe).each do |name| |
18 | 18 |
FactoryBot.create(:docker_registry, :name => name) |
19 | 19 |
end |
20 |
get :index, { :search => 'name = thomas' }, set_session_user
|
|
20 |
get :index, params: { :search => 'name = thomas' }, session: set_session_user
|
|
21 | 21 |
assert_response :success |
22 | 22 |
assert_equal 1, assigns(:registries).length |
23 | 23 |
end |
... | ... | |
25 | 25 |
test 'creates a new registry with valid params' do |
26 | 26 |
docker_attrs = FactoryBot.attributes_for(:docker_registry) |
27 | 27 |
DockerRegistry.any_instance.stubs(:attempt_login) |
28 |
post :create, :registry => docker_attrs
|
|
28 |
post :create, params: { :registry => docker_attrs }
|
|
29 | 29 |
assert_response :success |
30 | 30 |
end |
31 | 31 |
|
32 | 32 |
test 'does not create a new registry with invalid params' do |
33 | 33 |
docker_attrs = FactoryBot.attributes_for(:docker_registry) |
34 | 34 |
docker_attrs.delete(:name) |
35 |
post :create, :registry => docker_attrs
|
|
35 |
post :create, params: { :registry => docker_attrs }
|
|
36 | 36 |
assert_response 422 |
37 | 37 |
end |
38 | 38 |
|
39 | 39 |
test 'shows a docker registry' do |
40 |
get :show, :id => @registry.id
|
|
40 |
get :show, params: { :id => @registry.id }
|
|
41 | 41 |
assert_response :success |
42 | 42 |
end |
43 | 43 |
|
44 | 44 |
test 'update a docker registry' do |
45 | 45 |
DockerRegistry.any_instance.stubs(:attempt_login) |
46 | 46 |
new_name = 'hello_world' |
47 |
put :update, :id => @registry.id, :registry => { :name => new_name }
|
|
47 |
put :update, params: { :id => @registry.id, :registry => { :name => new_name } }
|
|
48 | 48 |
assert_response :success |
49 | 49 |
assert_equal new_name, @registry.reload.name |
50 | 50 |
end |
51 | 51 |
|
52 | 52 |
test 'deletes a docker registry' do |
53 |
delete :destroy, :id => @registry.id
|
|
53 |
delete :destroy, params: { :id => @registry.id }
|
|
54 | 54 |
assert_response :success |
55 | 55 |
assert DockerRegistry.where(:id => @registry.id).blank? |
56 | 56 |
end |
test/functionals/containers_controller_test.rb | ||
---|---|---|
7 | 7 |
end |
8 | 8 |
|
9 | 9 |
test 'redirect if Docker provider is not available' do |
10 |
get :index, {}, set_session_user
|
|
10 |
get :index, session: set_session_user
|
|
11 | 11 |
assert_redirected_to new_compute_resource_path |
12 | 12 |
end |
13 | 13 |
|
... | ... | |
16 | 16 |
# Avoid rendering errors by not retrieving any container |
17 | 17 |
ComputeResource.any_instance.stubs(:vms).returns([]) |
18 | 18 |
FactoryBot.create(:docker_cr) |
19 |
get :index, {}, set_session_user
|
|
19 |
get :index, session: set_session_user
|
|
20 | 20 |
assert_template 'index' |
21 | 21 |
end |
22 | 22 |
|
... | ... | |
31 | 31 |
|
32 | 32 |
test 'deleting an unmanaged container redirects to containers index' do |
33 | 33 |
ComputeResource.any_instance.expects(:destroy_vm).with(@container.id) |
34 |
delete :destroy, { :compute_resource_id => @container_resource, |
|
35 |
:id => @container.id }, set_session_user |
|
34 |
delete :destroy, params: { :compute_resource_id => @container_resource, :id => @container.id }, session: set_session_user |
|
36 | 35 |
assert_redirected_to containers_path |
37 | 36 |
assert_equal "Container #{@container.id} is being deleted.", |
38 | 37 |
flash[:notice] |
... | ... | |
42 | 41 |
ComputeResource.any_instance.stubs(:destroy_vm). |
43 | 42 |
raises(::Foreman::Exception.new('Could not destroy Docker container')) |
44 | 43 |
@request.env['HTTP_REFERER'] = "http://test.host/#{containers_path}" |
45 |
delete :destroy, { :compute_resource_id => @container_resource, |
|
46 |
:id => @container.id }, set_session_user |
|
44 |
delete :destroy, params: { :compute_resource_id => @container_resource, :id => @container.id }, session: set_session_user |
|
47 | 45 |
assert @container.present? |
48 | 46 |
assert_redirected_to :back |
49 | 47 |
assert_equal 'Your container could not be deleted in Docker', |
... | ... | |
58 | 56 |
with('randomuuid') |
59 | 57 |
Container.any_instance.expects(:uuid).returns('randomuuid').at_least_once |
60 | 58 |
Container.any_instance.expects(:destroy) |
61 |
delete :destroy, { :id => managed_container.id }, set_session_user
|
|
59 |
delete :destroy, params: { :id => managed_container.id }, session: set_session_user
|
|
62 | 60 |
assert_redirected_to containers_path |
63 | 61 |
assert_equal "Container #{managed_container.uuid} is being deleted.", |
64 | 62 |
flash[:notice] |
... | ... | |
72 | 70 |
ComputeResource.any_instance.expects(:destroy_vm). |
73 | 71 |
with(@container.id).returns(true) |
74 | 72 |
Container.any_instance.expects(:destroy) |
75 |
delete :destroy, { :compute_resource_id => @container_resource.id, |
|
76 |
:id => @container.id }, set_session_user |
|
73 |
delete :destroy, params: { :compute_resource_id => @container_resource.id, :id => @container.id }, session: set_session_user |
|
77 | 74 |
assert_redirected_to containers_path |
78 | 75 |
assert_equal "Container #{managed_container.uuid} is being deleted.", |
79 | 76 |
flash[:notice] |
... | ... | |
85 | 82 |
managed_container = FactoryBot.create( |
86 | 83 |
:container, |
87 | 84 |
:compute_resource => @container_resource) |
88 |
delete :destroy, { :id => managed_container.id }, set_session_user
|
|
85 |
delete :destroy, params: { :id => managed_container.id }, session: set_session_user
|
|
89 | 86 |
assert managed_container.present? # Foreman container would not be deleted |
90 | 87 |
assert_redirected_to containers_path |
91 | 88 |
assert_equal 'Your container could not be deleted in Docker', |
... | ... | |
103 | 100 |
.returns(mock_container) |
104 | 101 |
mock_container.expects(:commit).with(commit_hash) |
105 | 102 |
|
106 |
post :commit, { :commit => commit_hash, |
|
107 |
:id => container.id }, set_session_user |
|
103 |
post :commit, params: { :commit => commit_hash, :id => container.id }, session: set_session_user |
|
108 | 104 |
end |
109 | 105 |
end |
test/functionals/containers_steps_controller_test.rb | ||
---|---|---|
12 | 12 |
test 'wizard finishes with a redirect to the managed container' do |
13 | 13 |
Service::Containers.any_instance.expects(:start_container!).with(equals(@state)) |
14 | 14 |
.returns(@container) |
15 |
put :update, { :wizard_state_id => @state.id, |
|
16 |
:id => :environment, |
|
17 |
:start_on_create => true, |
|
18 |
:docker_container_wizard_states_environment => { :tty => false } }, |
|
19 |
set_session_user |
|
15 |
put :update, params: { :wizard_state_id => @state.id, :id => :environment, :start_on_create => true, :docker_container_wizard_states_environment => { :tty => false } }, session: set_session_user |
|
20 | 16 |
|
21 | 17 |
assert_redirected_to container_path(:id => @container.id) |
22 | 18 |
end |
... | ... | |
31 | 27 |
end |
32 | 28 |
|
33 | 29 |
test 'image show doesnot load katello' do |
34 |
get :show, { :wizard_state_id => @state.id, :id => :image }, set_session_user
|
|
30 |
get :show, params: { :wizard_state_id => @state.id, :id => :image }, session: set_session_user
|
|
35 | 31 |
refute @state.image.katello? |
36 | 32 |
refute response.body.include?("katello") # this is code generated by katello partial |
37 | 33 |
docker_image = @controller.instance_eval do |
... | ... | |
54 | 50 |
end |
55 | 51 |
|
56 | 52 |
test 'has no errors if the image exists' do |
57 |
put :update, @params, set_session_user
|
|
53 |
put :update, params: @params, session: set_session_user
|
|
58 | 54 |
assert_valid @state.image |
59 | 55 |
assert css_select('#hub_image_search.has-error').size == 0 |
60 | 56 |
end |
61 | 57 |
|
62 | 58 |
test 'shows an error when the image does not exist' do |
63 | 59 |
stub_image_existance(false) |
64 |
put :update, @params, set_session_user
|
|
60 |
put :update, params: @params, session: set_session_user
|
|
65 | 61 |
refute_valid @state.image |
66 | 62 |
assert_select '#hub_image_search.has-error' |
67 | 63 |
end |
... | ... | |
75 | 71 |
@state.environment = DockerContainerWizardStates::Environment.create!(environment_options) |
76 | 72 |
@state.environment.exposed_ports.create!(:key => '1654', :value => 'tcp') |
77 | 73 |
@state.environment.exposed_ports.create!(:key => '1655', :value => 'udp') |
78 |
get :show, { :wizard_state_id => @state.id, :id => :environment }, set_session_user
|
|
74 |
get :show, params: { :wizard_state_id => @state.id, :id => :environment }, session: set_session_user
|
|
79 | 75 |
assert response.body.include?("1654") |
80 | 76 |
assert response.body.include?("1655") |
81 | 77 |
|
... | ... | |
97 | 93 |
@state.environment = DockerContainerWizardStates::Environment.create!(environment_options) |
98 | 94 |
@state.environment.dns.create!(:key => '18.18.18.18') |
99 | 95 |
@state.environment.dns.create!(:key => '19.19.19.19') |
100 |
get :show, { :wizard_state_id => @state.id, :id => :environment }, set_session_user
|
|
96 |
get :show, params: { :wizard_state_id => @state.id, :id => :environment }, session: set_session_user
|
|
101 | 97 |
assert response.body.include?("18.18.18.18") |
102 | 98 |
assert response.body.include?("19.19.19.19") |
103 | 99 |
|
Also available in: Unified diff
Update to Rails 5.1