foreman_rh_cloud 0.9.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -6
  3. data/app/controllers/foreman_rh_cloud/react_controller.rb +8 -0
  4. data/app/models/setting/rh_cloud.rb +5 -9
  5. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +1 -0
  6. data/app/views/{foreman_inventory_upload/layouts/react.html.erb → layouts/foreman_rh_cloud/application.html.erb} +2 -2
  7. data/config/routes.rb +4 -1
  8. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +10 -5
  9. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +43 -0
  10. data/lib/foreman_inventory_upload/generators/queries.rb +5 -0
  11. data/lib/foreman_inventory_upload/generators/slice.rb +2 -1
  12. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -0
  13. data/lib/foreman_rh_cloud/engine.rb +17 -5
  14. data/lib/foreman_rh_cloud/version.rb +1 -1
  15. data/test/unit/slice_generator_test.rb +132 -0
  16. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +6 -2
  17. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +13 -10
  18. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +3 -2
  19. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +10 -0
  20. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +1 -1
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -0
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js +13 -0
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap +18 -0
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +7 -0
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/index.js +1 -0
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +1 -4
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -0
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +12 -0
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +7 -8
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +2 -3
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +2 -0
  33. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +4 -1
  34. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +4 -3
  35. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +1 -1
  36. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -3
  37. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +1 -1
  38. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +3 -2
  39. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +26 -0
  40. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js +1 -0
  41. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +2 -0
  42. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +39 -0
  43. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterActions.js +16 -0
  44. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -0
  45. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +36 -0
  46. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterSelectors.js +7 -0
  47. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +14 -0
  48. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js +14 -0
  49. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +35 -0
  50. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js +21 -0
  51. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +25 -0
  52. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap +17 -0
  53. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +25 -0
  54. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap +9 -0
  55. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +31 -0
  56. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +18 -0
  57. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js +17 -0
  58. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -0
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +12 -3
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +11 -2
  61. data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +3 -0
  62. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +3 -0
  63. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +4 -0
  64. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +16 -8
  65. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +4 -4
  66. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +11 -0
  67. data/webpack/ForemanInventoryUpload/{ForemanInventoryUpload.test.js → __tests__/ForemanInventoryUpload.test.js} +1 -1
  68. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +3 -0
  69. data/webpack/ForemanInventoryUpload/{__snapshots__ → __tests__/__snapshots__}/ForemanInventoryUpload.test.js.snap +0 -0
  70. data/webpack/ForemanRhCloudHelpers.js +6 -0
  71. data/webpack/ForemanRhCloudReducers.js +8 -0
  72. data/webpack/ForemanRhCloudSelectors.js +3 -0
  73. data/webpack/ForemanRhCloudTestHelpers.js +5 -0
  74. data/webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js +1 -0
  75. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +11 -0
  76. data/webpack/__tests__/ForemanRhCloudSelectors.test.js +17 -0
  77. data/webpack/__tests__/ForemanRhCloudTestHelpers.test.js +10 -0
  78. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +3 -0
  79. data/webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap +15 -0
  80. data/webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap +11 -0
  81. data/webpack/index.js +1 -1
  82. metadata +81 -13
  83. data/app/controllers/foreman_inventory_upload/react_controller.rb +0 -7
  84. data/test/unit/slice_generator_test.rb.orig +0 -280
  85. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
@@ -0,0 +1,8 @@
1
+ import { combineReducers } from 'redux';
2
+ import inventoryUploadReducers from './ForemanInventoryUpload/ForemanInventoryUploadReducers';
3
+
4
+ export default {
5
+ ForemanRhCloud: combineReducers({
6
+ ...inventoryUploadReducers,
7
+ }),
8
+ };
@@ -0,0 +1,3 @@
1
+ export const selectForemanRhCloud = state => state.ForemanRhCloud;
2
+ export const selectForemanInventoryUpload = state =>
3
+ selectForemanRhCloud(state).inventoryUpload;
@@ -0,0 +1,5 @@
1
+ export const inventoryStateWrapper = innerState => ({
2
+ ForemanRhCloud: {
3
+ inventoryUpload: { ...innerState },
4
+ },
5
+ });
@@ -0,0 +1 @@
1
+ export const LAYOUT_CHANGE_ORG = 'LAYOUT_CHANGE_ORG';
@@ -0,0 +1,11 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import { foremanUrl } from '../ForemanRhCloudHelpers';
3
+
4
+ global.URL_PREFIX = 'MY_TEST_URL_PREFIX.example.com';
5
+
6
+ const fixtures = {
7
+ 'should return foreman Url': () => foremanUrl('/test_path'),
8
+ };
9
+
10
+ describe('ForemanRhCloud helpers', () =>
11
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,17 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import { inventoryStateWrapper } from '../ForemanRhCloudTestHelpers';
3
+ import {
4
+ selectForemanRhCloud,
5
+ selectForemanInventoryUpload,
6
+ } from '../ForemanRhCloudSelectors';
7
+
8
+ const state = inventoryStateWrapper({ inventoryReducersNamespaces: {} });
9
+
10
+ const fixtures = {
11
+ 'should return ForemanRhCloud': () => selectForemanRhCloud(state),
12
+ 'should return ForemanInventoryUpload': () =>
13
+ selectForemanInventoryUpload(state),
14
+ };
15
+
16
+ describe('ForemanRhCloud selectors', () =>
17
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,10 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+ import { inventoryStateWrapper } from '../ForemanRhCloudTestHelpers';
3
+
4
+ const fixtures = {
5
+ 'should return inventory wrapper': () =>
6
+ inventoryStateWrapper({ inventoryChildren: null }),
7
+ };
8
+
9
+ describe('ForemanRhCloud helpers', () =>
10
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,3 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanRhCloud helpers should return foreman Url 1`] = `"MY_TEST_URL_PREFIX.example.com/test_path"`;
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanRhCloud selectors should return ForemanInventoryUpload 1`] = `
4
+ Object {
5
+ "inventoryReducersNamespaces": Object {},
6
+ }
7
+ `;
8
+
9
+ exports[`ForemanRhCloud selectors should return ForemanRhCloud 1`] = `
10
+ Object {
11
+ "inventoryUpload": Object {
12
+ "inventoryReducersNamespaces": Object {},
13
+ },
14
+ }
15
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ForemanRhCloud helpers should return inventory wrapper 1`] = `
4
+ Object {
5
+ "ForemanRhCloud": Object {
6
+ "inventoryUpload": Object {
7
+ "inventoryChildren": null,
8
+ },
9
+ },
10
+ }
11
+ `;
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable import/extensions */
4
4
  import componentRegistry from 'foremanReact/components/componentRegistry';
5
5
  import { registerReducer } from 'foremanReact/common/MountingService';
6
- import reducers from './ForemanInventoryUpload/ForemanInventoryUploadReducers';
6
+ import reducers from './ForemanRhCloudReducers';
7
7
  import ForemanInventoryUpload from './ForemanInventoryUpload';
8
8
 
9
9
  // register reducers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2020-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -56,16 +56,44 @@ dependencies:
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
60
81
  - !ruby/object:Gem::Version
61
- version: 0.54.0
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - "~>"
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: 0.54.0
96
+ version: '0'
69
97
  description: Foreman plugin that process & upload data to Red Hat Cloud
70
98
  email:
71
99
  - rlavi@redhat.com, sshtein@redhat.com
@@ -77,12 +105,13 @@ files:
77
105
  - README.md
78
106
  - Rakefile
79
107
  - app/controllers/foreman_inventory_upload/accounts_controller.rb
80
- - app/controllers/foreman_inventory_upload/react_controller.rb
81
108
  - app/controllers/foreman_inventory_upload/reports_controller.rb
82
109
  - app/controllers/foreman_inventory_upload/uploads_controller.rb
110
+ - app/controllers/foreman_rh_cloud/react_controller.rb
83
111
  - app/helpers/foreman_inventory_upload_helper.rb
84
112
  - app/models/setting/rh_cloud.rb
85
- - app/views/foreman_inventory_upload/layouts/react.html.erb
113
+ - app/views/foreman_rh_cloud/react/inventory_upload.html.erb
114
+ - app/views/layouts/foreman_rh_cloud/application.html.erb
86
115
  - config/routes.rb
87
116
  - lib/foreman_inventory_upload.rb
88
117
  - lib/foreman_inventory_upload/async/async_helpers.rb
@@ -119,7 +148,6 @@ files:
119
148
  - test/unit/metadata_generator_test.rb
120
149
  - test/unit/shell_process_job_test.rb
121
150
  - test/unit/slice_generator_test.rb
122
- - test/unit/slice_generator_test.rb.orig
123
151
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js
124
152
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js
125
153
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js
@@ -128,6 +156,11 @@ files:
128
156
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js
129
157
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js
130
158
  - webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js
159
+ - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js
160
+ - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js
161
+ - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap
162
+ - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss
163
+ - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/index.js
131
164
  - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js
132
165
  - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js
133
166
  - webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js
@@ -158,6 +191,7 @@ files:
158
191
  - webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss
159
192
  - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js
160
193
  - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js
194
+ - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js
161
195
  - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js
162
196
  - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js
163
197
  - webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js
@@ -210,6 +244,26 @@ files:
210
244
  - webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap
211
245
  - webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss
212
246
  - webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js
247
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js
248
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js
249
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js
250
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js
251
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterActions.js
252
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js
253
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js
254
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterSelectors.js
255
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js
256
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js
257
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js
258
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js
259
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap
260
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap
261
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap
262
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap
263
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap
264
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js
265
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js
266
+ - webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss
213
267
  - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js
214
268
  - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js
215
269
  - webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js
@@ -221,6 +275,7 @@ files:
221
275
  - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js
222
276
  - webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap
223
277
  - webpack/ForemanInventoryUpload/Components/PageHeader/index.js
278
+ - webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss
224
279
  - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js
225
280
  - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js
226
281
  - webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js
@@ -284,15 +339,29 @@ files:
284
339
  - webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap
285
340
  - webpack/ForemanInventoryUpload/Components/Terminal/index.js
286
341
  - webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss
342
+ - webpack/ForemanInventoryUpload/ForemanInventoryConstants.js
343
+ - webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js
287
344
  - webpack/ForemanInventoryUpload/ForemanInventoryUpload.js
288
- - webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js
289
345
  - webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js
290
- - webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js
291
- - webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap
346
+ - webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js
347
+ - webpack/ForemanInventoryUpload/__tests__/ForemanInventoryUpload.test.js
348
+ - webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap
349
+ - webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap
292
350
  - webpack/ForemanInventoryUpload/index.js
351
+ - webpack/ForemanRhCloudHelpers.js
352
+ - webpack/ForemanRhCloudReducers.js
353
+ - webpack/ForemanRhCloudSelectors.js
354
+ - webpack/ForemanRhCloudTestHelpers.js
293
355
  - webpack/__mocks__/foremanReact/API.js
294
356
  - webpack/__mocks__/foremanReact/common/I18n.js
295
357
  - webpack/__mocks__/foremanReact/common/helpers.js
358
+ - webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
359
+ - webpack/__tests__/ForemanRhCloudHelpers.test.js
360
+ - webpack/__tests__/ForemanRhCloudSelectors.test.js
361
+ - webpack/__tests__/ForemanRhCloudTestHelpers.test.js
362
+ - webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap
363
+ - webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap
364
+ - webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap
296
365
  - webpack/index.js
297
366
  - webpack/stories/ForemanInventoryUploadReducers.js
298
367
  - webpack/stories/configureStore.js
@@ -332,7 +401,6 @@ test_files:
332
401
  - test/factories/inventory_upload_factories.rb
333
402
  - test/unit/shell_process_job_test.rb
334
403
  - test/unit/metadata_generator_test.rb
335
- - test/unit/slice_generator_test.rb.orig
336
404
  - test/unit/fact_helpers_test.rb
337
405
  - test/unit/archived_report_generator_test.rb
338
406
  - test/unit/slice_generator_test.rb
@@ -1,7 +0,0 @@
1
- module ForemanInventoryUpload
2
- class ReactController < ::ApplicationController
3
- def index
4
- render 'foreman_inventory_upload/layouts/react', :layout => false
5
- end
6
- end
7
- end
@@ -1,280 +0,0 @@
1
- require 'test_plugin_helper'
2
-
3
- class ReportGeneratorTest < ActiveSupport::TestCase
4
- setup do
5
- User.current = User.find_by(login: 'secret_admin')
6
-
7
- env = FactoryBot.create(:katello_k_t_environment)
8
- cv = env.content_views << FactoryBot.create(:katello_content_view, organization: env.organization)
9
-
10
- @host = FactoryBot.create(
11
- :host,
12
- :with_subscription,
13
- :with_content,
14
- content_view: cv.first,
15
- lifecycle_environment: env,
16
- organization: env.organization
17
- )
18
-
19
- @host.organization.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
20
-
21
- ForemanInventoryUpload::Generators::Queries.instance_variable_set(:@fact_names, nil)
22
- end
23
-
24
- def interesting_facts
25
- [
26
- 'dmi::system::uuid',
27
- 'virt::uuid',
28
- 'cpu::cpu(s)',
29
- 'cpu::cpu_socket(s)',
30
- 'cpu::core(s)_per_socket',
31
- 'memory::memtotal',
32
- 'dmi::bios::vendor',
33
- 'dmi::bios::version',
34
- 'dmi::bios::relase_date',
35
- 'uname::release',
36
- 'lscpu::flags',
37
- 'distribution::name',
38
- 'distribution::version',
39
- 'distribution::id',
40
- 'virt::is_guest',
41
- ]
42
- end
43
-
44
- def fact_names
45
- @fact_names ||= Hash[
46
- interesting_facts.map do |fact|
47
- [fact, FactoryBot.create(:fact_name, name: fact, type: 'Katello::RhsmFactName')]
48
- end
49
- ]
50
- end
51
-
52
- test 'generates a report for a single host' do
53
- batch = Host.where(id: @host.id).in_batches.first
54
- generator = create_generator(batch)
55
-
56
- json_str = generator.render
57
- actual = JSON.parse(json_str.join("\n"))
58
-
59
- assert_equal 'slice_123', actual['report_slice_id']
60
- assert_not_nil(actual_host = actual['hosts'].first)
61
- assert_equal @host.name, actual_host['display_name']
62
- assert_equal @host.fqdn, actual_host['fqdn']
63
- assert_equal '1234', actual_host['account']
64
- assert_equal 1, generator.hosts_count
65
- end
66
-
67
- test 'generates a report with satellite facts' do
68
- Foreman.expects(:instance_id).twice.returns('satellite-id')
69
- batch = Host.where(id: @host.id).in_batches.first
70
- generator = create_generator(batch)
71
-
72
- json_str = generator.render
73
- actual = JSON.parse(json_str.join("\n"))
74
-
75
- facts = actual['hosts'].first['facts'].first
76
- assert_equal 'satellite', facts['namespace']
77
- satellite_facts = facts['facts']
78
- assert_equal 'satellite-id', satellite_facts['satellite_instance_id']
79
- assert_equal @host.organization_id, satellite_facts['organization_id']
80
-
81
- instance_id_tag = actual['hosts'].first['tags'].find { |tag| tag['namespace'] == 'satellite' && tag['key'] == 'satellite_instance_id' }
82
- assert_not_nil instance_id_tag
83
- assert_equal 'satellite-id', instance_id_tag['value']
84
-
85
- org_id_tag = actual['hosts'].first['tags'].find { |tag| tag['namespace'] == 'satellite' && tag['key'] == 'organization_id' }
86
- assert_not_nil org_id_tag
87
- assert_equal @host.organization_id.to_s, org_id_tag['value']
88
-
89
- version = satellite_facts['satellite_version']
90
- if defined?(ForemanThemeSatellite)
91
- assert_equal ForemanThemeSatellite::SATELLITE_VERSION, version
92
- else
93
- assert_nil version
94
- end
95
- end
96
-
97
- test 'generates a report for a host with hypervisor' do
98
- hypervisor_host = FactoryBot.create(
99
- :host,
100
- :with_subscription,
101
- :with_content,
102
- content_view: @host.content_view,
103
- lifecycle_environment: @host.lifecycle_environment,
104
- organization: @host.organization
105
- )
106
-
107
- @host.subscription_facet.hypervisor_host = hypervisor_host
108
- @host.save!
109
-
110
- batch = Host.where(id: @host.id).in_batches.first
111
- generator = create_generator(batch)
112
-
113
- json_str = generator.render
114
- actual = JSON.parse(json_str.join("\n"))
115
-
116
- assert_equal 'slice_123', actual['report_slice_id']
117
- assert_not_nil(actual_host = actual['hosts'].first)
118
- assert_equal @host.name, actual_host['display_name']
119
- assert_equal @host.fqdn, actual_host['fqdn']
120
- assert_not_nil(host_facts = actual_host['facts']&.first)
121
- assert_equal 'satellite', host_facts['namespace']
122
- assert_not_nil(fact_values = host_facts['facts'])
123
- assert_equal hypervisor_host.name, fact_values['virtual_host_name']
124
- assert_equal hypervisor_host.subscription_facet.uuid, fact_values['virtual_host_uuid']
125
- end
126
-
127
- test 'generates a report with system purpose' do
128
- @host.subscription_facet.purpose_usage = 'test_usage'
129
- @host.subscription_facet.purpose_role = 'test_role'
130
- @host.subscription_facet.save!
131
-
132
- batch = Host.where(id: @host.id).in_batches.first
133
- generator = create_generator(batch)
134
-
135
- json_str = generator.render
136
- actual = JSON.parse(json_str.join("\n"))
137
-
138
- assert_equal 'slice_123', actual['report_slice_id']
139
- assert_not_nil(actual_host = actual['hosts'].first)
140
- assert_equal @host.name, actual_host['display_name']
141
- assert_equal @host.fqdn, actual_host['fqdn']
142
- assert_not_nil(host_facts = actual_host['facts']&.first)
143
- assert_equal 'satellite', host_facts['namespace']
144
- assert_not_nil(fact_values = host_facts['facts'])
145
- assert_equal 'test_usage', fact_values['system_purpose_usage']
146
- assert_equal 'test_role', fact_values['system_purpose_role']
147
- end
148
-
149
- test 'generates a report for a golden ticket' do
150
- batch = Host.where(id: @host.id).in_batches.first
151
- generator = create_generator(batch) do |generator|
152
- generator.stubs(:golden_ticket?).returns(true)
153
- end
154
-
155
- json_str = generator.render
156
- actual = JSON.parse(json_str.join("\n"))
157
-
158
- assert_equal 'slice_123', actual['report_slice_id']
159
- assert_not_nil(actual_host = actual['hosts'].first)
160
- assert_equal @host.name, actual_host['display_name']
161
- assert_equal @host.fqdn, actual_host['fqdn']
162
- assert_equal '1234', actual_host['account']
163
- assert_equal 1, generator.hosts_count
164
- end
165
-
166
- test 'skips hosts without subscription' do
167
- a_host = FactoryBot.create(
168
- :host,
169
- organization: @host.organization
170
- )
171
-
172
- # make a_host last
173
- batch = Host.where(id: [@host.id, a_host.id]).order(:name).in_batches.first
174
- generator = create_generator(batch)
175
-
176
- json_str = generator.render
177
- actual = JSON.parse(json_str.join("\n"))
178
-
179
- assert_equal 'slice_123', actual['report_slice_id']
180
- assert_not_nil(actual_host = actual['hosts'].first)
181
- assert_equal @host.name, actual_host['display_name']
182
- assert_equal @host.fqdn, actual_host['fqdn']
183
- assert_equal '1234', actual_host['account']
184
- assert_equal 1, generator.hosts_count
185
- end
186
-
187
- test 'shows system_memory_bytes in bytes' do
188
- FactoryBot.create(:fact_value, fact_name: fact_names['memory::memtotal'], value: '1', host: @host)
189
-
190
- batch = Host.where(id: @host.id).in_batches.first
191
- generator = create_generator(batch)
192
-
193
- json_str = generator.render
194
- actual = JSON.parse(json_str.join("\n"))
195
-
196
- assert_equal 'slice_123', actual['report_slice_id']
197
- assert_not_nil(actual_host = actual['hosts'].first)
198
- assert_not_nil(actual_profile = actual_host['system_profile'])
199
- assert_equal 1024, actual_profile['system_memory_bytes']
200
- end
201
-
202
- test 'reports an account for hosts with multiple pools' do
203
- first_pool = @host.organization.pools.first
204
- second_pool = FactoryBot.create(:katello_pool, account_number: nil, cp_id: 2)
205
- new_org = FactoryBot.create(:organization, pools: [first_pool, second_pool])
206
- @host.organization = new_org
207
- @host.save!
208
-
209
- batch = Host.where(id: @host.id).in_batches.first
210
- generator = create_generator(batch)
211
-
212
- json_str = generator.render
213
- actual = JSON.parse(json_str.join("\n"))
214
-
215
- assert_equal 'slice_123', actual['report_slice_id']
216
- assert_not_nil(actual_host = actual['hosts'].first)
217
- assert_not_nil(actual_host['account'])
218
- assert_not_empty(actual_host['account'])
219
- end
220
-
221
- test 'Generates os_release with version and id' do
222
- FactoryBot.create(:fact_value, fact_name: fact_names['distribution::name'], value: 'Red Hat Test Linux', host: @host)
223
- FactoryBot.create(:fact_value, fact_name: fact_names['distribution::version'], value: '7.1', host: @host)
224
- FactoryBot.create(:fact_value, fact_name: fact_names['distribution::id'], value: 'TestId', host: @host)
225
-
226
- batch = Host.where(id: @host.id).in_batches.first
227
- generator = create_generator(batch)
228
-
229
- json_str = generator.render
230
- actual = JSON.parse(json_str.join("\n"))
231
-
232
- assert_equal 'slice_123', actual['report_slice_id']
233
- assert_not_nil(actual_host = actual['hosts'].first)
234
- assert_not_nil(actual_profile = actual_host['system_profile'])
235
- assert_equal 'Red Hat Test Linux 7.1 (TestId)', actual_profile['os_release']
236
- end
237
-
238
- <<<<<<< HEAD
239
- test 'sets infrastructure_type to "virtual" based on virt.is_guest fact' do
240
- FactoryBot.create(:fact_value, fact_name: fact_names['virt::is_guest'], value: true, host: @host)
241
-
242
- batch = Host.where(id: @host.id).in_batches.first
243
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
244
-
245
- json_str = generator.render
246
- actual = JSON.parse(json_str.join("\n"))
247
-
248
- assert_equal 'slice_123', actual['report_slice_id']
249
- assert_not_nil(actual_host = actual['hosts'].first)
250
- assert_not_nil(actual_profile = actual_host['system_profile'])
251
- assert_equal 'virtual', actual_profile['infrastructure_type']
252
- end
253
-
254
- test 'sets infrastructure_type to "physical" based on virt.is_guest fact' do
255
- FactoryBot.create(:fact_value, fact_name: fact_names['virt::is_guest'], value: false, host: @host)
256
-
257
- batch = Host.where(id: @host.id).in_batches.first
258
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
259
-
260
- json_str = generator.render
261
- actual = JSON.parse(json_str.join("\n"))
262
-
263
- assert_equal 'slice_123', actual['report_slice_id']
264
- assert_not_nil(actual_host = actual['hosts'].first)
265
- assert_not_nil(actual_profile = actual_host['system_profile'])
266
- assert_equal 'physical', actual_profile['infrastructure_type']
267
- =======
268
- private
269
-
270
- def create_generator(batch, name = 'slice_123')
271
- generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], name)
272
- if block_given?
273
- yield(generator)
274
- else
275
- generator.stubs(:golden_ticket?).returns(false)
276
- end
277
- generator
278
- >>>>>>> Add support fo golden ticket
279
- end
280
- end