foreman_rh_cloud 13.2.10 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +10 -13
- data/app/controllers/insights_cloud/ui_requests_controller.rb +7 -3
- data/app/models/concerns/rh_cloud_host.rb +3 -35
- data/app/models/insights_client_report_status.rb +1 -9
- data/app/models/inventory_sync/inventory_status.rb +4 -16
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +4 -34
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
- data/lib/foreman_inventory_upload.rb +1 -8
- data/lib/foreman_rh_cloud/engine.rb +0 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +9 -36
- data/lib/insights_cloud/async/insights_generate_notifications.rb +1 -10
- data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
- data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +2 -12
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
- data/locale/fr/foreman_rh_cloud.po +65 -66
- data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
- data/locale/ja/foreman_rh_cloud.po +70 -72
- data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
- data/locale/ka/foreman_rh_cloud.po +10 -11
- data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
- data/locale/ko/foreman_rh_cloud.po +63 -64
- data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
- data/locale/zh_CN/foreman_rh_cloud.po +64 -65
- data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +3 -57
- data/test/controllers/insights_cloud/ui_requests_controller_test.rb +2 -16
- data/test/jobs/insights_client_status_aging_test.rb +0 -40
- data/test/jobs/inventory_full_sync_test.rb +4 -219
- data/test/jobs/inventory_hosts_sync_test.rb +5 -7
- data/test/jobs/inventory_self_host_sync_test.rb +1 -10
- data/test/models/insights_client_report_status_test.rb +0 -109
- data/test/unit/archived_report_generator_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -16
- data/test/unit/foreman_rh_cloud_self_host_test.rb +2 -50
- data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
- data/test/unit/metadata_generator_test.rb +1 -24
- data/test/unit/rh_cloud_host_test.rb +0 -214
- data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +2 -21
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +3 -30
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +10 -112
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +0 -7
- data/webpack/ForemanRhCloudHelpers.js +0 -22
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +15 -71
- metadata +16 -18
- data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
- data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
- data/test/jobs/insights_generate_notifications_test.rb +0 -26
- data/test/models/inventory_sync/inventory_status_test.rb +0 -85
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
- data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -266
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { shallow } from '@theforeman/test';
|
|
3
|
-
import Toast from '../Toast';
|
|
4
|
-
|
|
5
|
-
describe('Toast', () => {
|
|
6
|
-
it('renders with all three status counts including user_omitted', () => {
|
|
7
|
-
const wrapper = shallow(
|
|
8
|
-
<Toast syncHosts={5} disconnectHosts={3} userOmittedHosts={2} />
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const links = wrapper.find('HostsWithStatusLink');
|
|
12
|
-
expect(links).toHaveLength(3);
|
|
13
|
-
|
|
14
|
-
// Check the children (numbers) of each link
|
|
15
|
-
expect(
|
|
16
|
-
links
|
|
17
|
-
.at(0)
|
|
18
|
-
.children()
|
|
19
|
-
.text()
|
|
20
|
-
).toBe('5');
|
|
21
|
-
expect(
|
|
22
|
-
links
|
|
23
|
-
.at(1)
|
|
24
|
-
.children()
|
|
25
|
-
.text()
|
|
26
|
-
).toBe('3');
|
|
27
|
-
expect(
|
|
28
|
-
links
|
|
29
|
-
.at(2)
|
|
30
|
-
.children()
|
|
31
|
-
.text()
|
|
32
|
-
).toBe('2');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('does not render user_omitted section when count is 0', () => {
|
|
36
|
-
const wrapper = shallow(
|
|
37
|
-
<Toast syncHosts={5} disconnectHosts={3} userOmittedHosts={0} />
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
// Should have only 2 HostsWithStatusLink components (sync and disconnect)
|
|
41
|
-
const links = wrapper.find('HostsWithStatusLink');
|
|
42
|
-
expect(links).toHaveLength(2);
|
|
43
|
-
|
|
44
|
-
// Should not contain the user_omitted explanation text
|
|
45
|
-
expect(wrapper.text()).not.toContain(
|
|
46
|
-
'host_registration_insights_inventory parameter value is false'
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('renders without crashing when userOmittedHosts is not provided (default)', () => {
|
|
51
|
-
const wrapper = shallow(<Toast syncHosts={5} disconnectHosts={3} />);
|
|
52
|
-
|
|
53
|
-
// Should use default value of 0, so only 2 links
|
|
54
|
-
const links = wrapper.find('HostsWithStatusLink');
|
|
55
|
-
expect(links).toHaveLength(2);
|
|
56
|
-
|
|
57
|
-
// Verify the count values
|
|
58
|
-
expect(
|
|
59
|
-
links
|
|
60
|
-
.at(0)
|
|
61
|
-
.children()
|
|
62
|
-
.text()
|
|
63
|
-
).toBe('5');
|
|
64
|
-
expect(
|
|
65
|
-
links
|
|
66
|
-
.at(1)
|
|
67
|
-
.children()
|
|
68
|
-
.text()
|
|
69
|
-
).toBe('3');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders correct status links for each category', () => {
|
|
73
|
-
const wrapper = shallow(
|
|
74
|
-
<Toast syncHosts={5} disconnectHosts={3} userOmittedHosts={2} />
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const links = wrapper.find('HostsWithStatusLink');
|
|
78
|
-
expect(links.at(0).prop('statusName')).toBe('sync');
|
|
79
|
-
expect(links.at(1).prop('statusName')).toBe('disconnect');
|
|
80
|
-
expect(links.at(2).prop('statusName')).toBe('user_omitted');
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { Provider } from 'react-redux';
|
|
5
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
-
import configureMockStore from 'redux-mock-store';
|
|
7
|
-
import thunk from 'redux-thunk';
|
|
8
|
-
import NewHostDetailsTab from '../NewHostDetailsTab';
|
|
9
|
-
import { OVERVIEW_TAB_PATH } from '../../ForemanRhCloudHelpers';
|
|
10
|
-
|
|
11
|
-
const mockHistoryReplace = jest.fn();
|
|
12
|
-
|
|
13
|
-
jest.mock('react-router-dom', () => ({
|
|
14
|
-
...jest.requireActual('react-router-dom'),
|
|
15
|
-
useHistory: () => ({
|
|
16
|
-
replace: mockHistoryReplace,
|
|
17
|
-
}),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
jest.mock('../../common/Hooks/ConfigHooks', () => ({
|
|
21
|
-
useIopConfig: jest.fn(() => false),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
jest.mock('foremanReact/common/I18n', () => ({
|
|
25
|
-
translate: jest.fn(str => str),
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
jest.mock(
|
|
29
|
-
'foremanReact/components/SearchBar',
|
|
30
|
-
() => () => <div>SearchBar</div>,
|
|
31
|
-
{ virtual: true }
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
jest.mock('../../InsightsCloudSync/Components/InsightsTable', () => () => (
|
|
35
|
-
<div>InsightsTable</div>
|
|
36
|
-
));
|
|
37
|
-
|
|
38
|
-
jest.mock('../../InsightsCloudSync/Components/RemediationModal', () => () => (
|
|
39
|
-
<div>RemediationModal</div>
|
|
40
|
-
));
|
|
41
|
-
|
|
42
|
-
jest.mock(
|
|
43
|
-
'../../InsightsCloudSync/Components/InsightsTable/Pagination',
|
|
44
|
-
() => () => <div>Pagination</div>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const mockStore = configureMockStore([thunk]);
|
|
48
|
-
|
|
49
|
-
const defaultResponse = {
|
|
50
|
-
id: 1,
|
|
51
|
-
operatingsystem_name: 'Red Hat Enterprise Linux 8',
|
|
52
|
-
insights_attributes: { uuid: 'test-uuid' },
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
describe('NewHostDetailsTab', () => {
|
|
56
|
-
let store;
|
|
57
|
-
let mockRouter;
|
|
58
|
-
|
|
59
|
-
beforeEach(() => {
|
|
60
|
-
mockRouter = {
|
|
61
|
-
push: jest.fn(),
|
|
62
|
-
replace: jest.fn(),
|
|
63
|
-
location: {
|
|
64
|
-
pathname: '/new/hosts/test-host.example.com',
|
|
65
|
-
search: '?page=1&per_page=20',
|
|
66
|
-
hash: '#/Insights',
|
|
67
|
-
query: { page: '1', per_page: '20' },
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
store = mockStore({
|
|
72
|
-
API: {},
|
|
73
|
-
ForemanRhCloud: {
|
|
74
|
-
InsightsCloudSync: {
|
|
75
|
-
table: {
|
|
76
|
-
selectedIds: {},
|
|
77
|
-
isAllSelected: false,
|
|
78
|
-
showSelectAllAlert: false,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
insightsHostDetailsTab: {
|
|
83
|
-
query: '',
|
|
84
|
-
hits: [],
|
|
85
|
-
selectedIds: {},
|
|
86
|
-
error: null,
|
|
87
|
-
},
|
|
88
|
-
router: {
|
|
89
|
-
location: {
|
|
90
|
-
pathname: '/new/hosts/test-host.example.com',
|
|
91
|
-
search: '?page=1&per_page=20',
|
|
92
|
-
hash: '#/Insights',
|
|
93
|
-
query: { page: '1', per_page: '20' },
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
afterEach(() => {
|
|
100
|
-
jest.clearAllMocks();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('cleanup effect', () => {
|
|
104
|
-
it('should preserve hash when clearing search params on unmount', () => {
|
|
105
|
-
const { unmount } = render(
|
|
106
|
-
<Provider store={store}>
|
|
107
|
-
<MemoryRouter>
|
|
108
|
-
<NewHostDetailsTab
|
|
109
|
-
hostName="test-host.example.com"
|
|
110
|
-
router={mockRouter}
|
|
111
|
-
response={defaultResponse}
|
|
112
|
-
/>
|
|
113
|
-
</MemoryRouter>
|
|
114
|
-
</Provider>
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
unmount();
|
|
118
|
-
|
|
119
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
120
|
-
search: null,
|
|
121
|
-
hash: '#/Insights',
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('should only clear search params when no hash exists', () => {
|
|
126
|
-
mockRouter.location.hash = '';
|
|
127
|
-
|
|
128
|
-
const { unmount } = render(
|
|
129
|
-
<Provider store={store}>
|
|
130
|
-
<MemoryRouter>
|
|
131
|
-
<NewHostDetailsTab
|
|
132
|
-
hostName="test-host.example.com"
|
|
133
|
-
router={mockRouter}
|
|
134
|
-
response={defaultResponse}
|
|
135
|
-
/>
|
|
136
|
-
</MemoryRouter>
|
|
137
|
-
</Provider>
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
unmount();
|
|
141
|
-
|
|
142
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
143
|
-
search: null,
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('should handle router.location being undefined gracefully', () => {
|
|
148
|
-
const routerWithoutLocation = {
|
|
149
|
-
push: jest.fn(),
|
|
150
|
-
replace: jest.fn(),
|
|
151
|
-
location: undefined,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const { unmount } = render(
|
|
155
|
-
<Provider store={store}>
|
|
156
|
-
<MemoryRouter>
|
|
157
|
-
<NewHostDetailsTab
|
|
158
|
-
hostName="test-host.example.com"
|
|
159
|
-
router={routerWithoutLocation}
|
|
160
|
-
response={defaultResponse}
|
|
161
|
-
/>
|
|
162
|
-
</MemoryRouter>
|
|
163
|
-
</Provider>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
unmount();
|
|
167
|
-
|
|
168
|
-
expect(routerWithoutLocation.replace).toHaveBeenCalledWith({
|
|
169
|
-
search: null,
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('should use the latest hash value at unmount time, not a stale captured value', () => {
|
|
174
|
-
const { unmount } = render(
|
|
175
|
-
<Provider store={store}>
|
|
176
|
-
<MemoryRouter>
|
|
177
|
-
<NewHostDetailsTab
|
|
178
|
-
hostName="test-host.example.com"
|
|
179
|
-
router={mockRouter}
|
|
180
|
-
response={defaultResponse}
|
|
181
|
-
/>
|
|
182
|
-
</MemoryRouter>
|
|
183
|
-
</Provider>
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
mockRouter.location.hash = '#/Overview';
|
|
187
|
-
|
|
188
|
-
unmount();
|
|
189
|
-
|
|
190
|
-
expect(mockRouter.replace).toHaveBeenCalledWith({
|
|
191
|
-
search: null,
|
|
192
|
-
hash: '#/Overview',
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
describe('tab visibility', () => {
|
|
198
|
-
it('should redirect to Overview when host is not RHEL', () => {
|
|
199
|
-
const nonRhelResponse = {
|
|
200
|
-
id: 2,
|
|
201
|
-
operatingsystem_name: 'Ubuntu 20.04',
|
|
202
|
-
insights_attributes: { uuid: 'test-uuid' },
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
render(
|
|
206
|
-
<Provider store={store}>
|
|
207
|
-
<MemoryRouter>
|
|
208
|
-
<NewHostDetailsTab
|
|
209
|
-
hostName="test-host.example.com"
|
|
210
|
-
response={nonRhelResponse}
|
|
211
|
-
/>
|
|
212
|
-
</MemoryRouter>
|
|
213
|
-
</Provider>
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
expect(mockHistoryReplace).toHaveBeenCalledWith(OVERVIEW_TAB_PATH);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('should redirect to Overview when insights facet is missing', () => {
|
|
220
|
-
const responseWithoutInsights = {
|
|
221
|
-
id: 3,
|
|
222
|
-
operatingsystem_name: 'Red Hat Enterprise Linux 8',
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
render(
|
|
226
|
-
<Provider store={store}>
|
|
227
|
-
<MemoryRouter>
|
|
228
|
-
<NewHostDetailsTab
|
|
229
|
-
hostName="test-host.example.com"
|
|
230
|
-
response={responseWithoutInsights}
|
|
231
|
-
/>
|
|
232
|
-
</MemoryRouter>
|
|
233
|
-
</Provider>
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
expect(mockHistoryReplace).toHaveBeenCalledWith(OVERVIEW_TAB_PATH);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
it('should not redirect when host is valid RHEL with insights facet', () => {
|
|
240
|
-
render(
|
|
241
|
-
<Provider store={store}>
|
|
242
|
-
<MemoryRouter>
|
|
243
|
-
<NewHostDetailsTab
|
|
244
|
-
hostName="test-host.example.com"
|
|
245
|
-
response={defaultResponse}
|
|
246
|
-
/>
|
|
247
|
-
</MemoryRouter>
|
|
248
|
-
</Provider>
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
expect(mockHistoryReplace).not.toHaveBeenCalled();
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
it('should not redirect when host data is not yet loaded', () => {
|
|
255
|
-
render(
|
|
256
|
-
<Provider store={store}>
|
|
257
|
-
<MemoryRouter>
|
|
258
|
-
<NewHostDetailsTab hostName="test-host.example.com" response={{}} />
|
|
259
|
-
</MemoryRouter>
|
|
260
|
-
</Provider>
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
expect(mockHistoryReplace).not.toHaveBeenCalled();
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
});
|