foreman_rh_cloud 13.0.8 → 13.0.9
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/controllers/foreman_inventory_upload/accounts_controller.rb +1 -1
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +1 -1
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +1 -23
- data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +200 -0
- data/lib/foreman_inventory_upload.rb +0 -4
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +0 -2
- data/package.json +1 -1
- data/test/controllers/accounts_controller_test.rb +1 -1
- data/test/controllers/uploads_controller_test.rb +1 -1
- data/test/jobs/queue_for_upload_job_test.rb +1 -12
- data/test/jobs/upload_report_direct_job_test.rb +399 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +4 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +4 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +9 -10
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +4 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +24 -17
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +178 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +3 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +69 -51
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +11 -19
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +77 -22
- metadata +4 -8
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +0 -97
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +0 -55
- data/test/jobs/upload_report_job_test.rb +0 -38
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +0 -36
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +0 -112
- data/webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js +0 -3
|
@@ -1,13 +1,183 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
|
+
import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
|
|
3
4
|
import PageHeader from '../PageHeader';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// Create a variable to control IoP mode in tests
|
|
7
|
+
let mockIopMode = false;
|
|
8
|
+
|
|
9
|
+
// Mock ForemanContext
|
|
10
|
+
jest.mock('foremanReact/Root/Context/ForemanContext', () => ({
|
|
11
|
+
useForemanContext: () => ({
|
|
12
|
+
metadata: {
|
|
13
|
+
foreman_rh_cloud: {
|
|
14
|
+
iop: mockIopMode,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
UI: {},
|
|
18
|
+
}),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
// Mock child components to isolate PageHeader testing
|
|
22
|
+
// This prevents child component complexity from affecting our tests
|
|
23
|
+
jest.mock('../components/SettingsWarning', () => () => (
|
|
24
|
+
<div data-testid="settings-warning">SettingsWarning</div>
|
|
25
|
+
));
|
|
26
|
+
jest.mock('../PageTitle', () => () => (
|
|
27
|
+
<div data-testid="page-title">PageTitle</div>
|
|
28
|
+
));
|
|
29
|
+
jest.mock('../../InventorySettings', () => () => (
|
|
30
|
+
<div data-testid="inventory-settings">InventorySettings</div>
|
|
31
|
+
));
|
|
32
|
+
jest.mock('../components/PageDescription', () => () => (
|
|
33
|
+
<div data-testid="page-description">PageDescription</div>
|
|
34
|
+
));
|
|
35
|
+
jest.mock('../../InventoryFilter', () => () => (
|
|
36
|
+
<div data-testid="inventory-filter">InventoryFilter</div>
|
|
37
|
+
));
|
|
38
|
+
jest.mock('../components/ToolbarButtons', () => () => (
|
|
39
|
+
<div data-testid="toolbar-buttons">ToolbarButtons</div>
|
|
40
|
+
));
|
|
41
|
+
|
|
42
|
+
const { renderWithStore } = rtlHelpers;
|
|
9
43
|
|
|
10
44
|
describe('PageHeader', () => {
|
|
11
|
-
describe('
|
|
12
|
-
|
|
45
|
+
describe('component behavior', () => {
|
|
46
|
+
test('renders all components when not in IoP mode', () => {
|
|
47
|
+
mockIopMode = false; // Ensure IoP mode is disabled for this test
|
|
48
|
+
|
|
49
|
+
renderWithStore(<PageHeader />, {
|
|
50
|
+
API: {
|
|
51
|
+
INVENTORY_SETTINGS: {
|
|
52
|
+
response: { subscriptionConnectionEnabled: true },
|
|
53
|
+
},
|
|
54
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
55
|
+
response: { use_iop_mode: false },
|
|
56
|
+
status: 'RESOLVED',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// All components should be present when not in IoP mode
|
|
62
|
+
expect(screen.getByTestId('settings-warning')).toBeTruthy();
|
|
63
|
+
expect(screen.getByTestId('page-title')).toBeTruthy();
|
|
64
|
+
expect(screen.getByTestId('inventory-settings')).toBeTruthy();
|
|
65
|
+
expect(screen.getByTestId('page-description')).toBeTruthy();
|
|
66
|
+
expect(screen.getByTestId('inventory-filter')).toBeTruthy();
|
|
67
|
+
expect(screen.getByTestId('toolbar-buttons')).toBeTruthy();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('hides inventory settings and description when in IoP mode', () => {
|
|
71
|
+
mockIopMode = true; // Enable IoP mode for this test
|
|
72
|
+
|
|
73
|
+
renderWithStore(<PageHeader />, {
|
|
74
|
+
API: {
|
|
75
|
+
INVENTORY_SETTINGS: {
|
|
76
|
+
response: { subscriptionConnectionEnabled: true },
|
|
77
|
+
},
|
|
78
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
79
|
+
response: { use_iop_mode: true },
|
|
80
|
+
status: 'RESOLVED',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Core components should still be present
|
|
86
|
+
expect(screen.getByTestId('settings-warning')).toBeTruthy();
|
|
87
|
+
expect(screen.getByTestId('page-title')).toBeTruthy();
|
|
88
|
+
expect(screen.getByTestId('inventory-filter')).toBeTruthy();
|
|
89
|
+
expect(screen.getByTestId('toolbar-buttons')).toBeTruthy();
|
|
90
|
+
|
|
91
|
+
// These components should be hidden in IoP mode
|
|
92
|
+
expect(screen.queryByTestId('inventory-settings')).toBeNull();
|
|
93
|
+
expect(screen.queryByTestId('page-description')).toBeNull();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('renders with correct CSS class', () => {
|
|
97
|
+
mockIopMode = false; // Ensure IoP mode is disabled for this test
|
|
98
|
+
|
|
99
|
+
const { container } = renderWithStore(<PageHeader />, {
|
|
100
|
+
API: {
|
|
101
|
+
INVENTORY_SETTINGS: {
|
|
102
|
+
response: { subscriptionConnectionEnabled: true },
|
|
103
|
+
},
|
|
104
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
105
|
+
response: { use_iop_mode: false },
|
|
106
|
+
status: 'RESOLVED',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(container.querySelector('.inventory-upload-header')).toBeTruthy();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('renders grid layout with correct structure', () => {
|
|
115
|
+
mockIopMode = false; // Ensure IoP mode is disabled for this test
|
|
116
|
+
|
|
117
|
+
const { container } = renderWithStore(<PageHeader />, {
|
|
118
|
+
API: {
|
|
119
|
+
INVENTORY_SETTINGS: {
|
|
120
|
+
response: { subscriptionConnectionEnabled: true },
|
|
121
|
+
},
|
|
122
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
123
|
+
response: { use_iop_mode: false },
|
|
124
|
+
status: 'RESOLVED',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const gridRow = container.querySelector('.row');
|
|
130
|
+
expect(gridRow).toBeTruthy();
|
|
131
|
+
|
|
132
|
+
const filterColumn = container.querySelector('.col-xs-4');
|
|
133
|
+
expect(filterColumn).toBeTruthy();
|
|
134
|
+
|
|
135
|
+
const toolbarColumn = container.querySelector('.col-xs-7');
|
|
136
|
+
expect(toolbarColumn).toBeTruthy();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('renders description section only when not in IoP mode', () => {
|
|
140
|
+
mockIopMode = false; // Ensure IoP mode is disabled for this test
|
|
141
|
+
|
|
142
|
+
const { container } = renderWithStore(<PageHeader />, {
|
|
143
|
+
API: {
|
|
144
|
+
INVENTORY_SETTINGS: {
|
|
145
|
+
response: { subscriptionConnectionEnabled: true },
|
|
146
|
+
},
|
|
147
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
148
|
+
response: { use_iop_mode: false },
|
|
149
|
+
status: 'RESOLVED',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Description section should be present when not in IoP mode
|
|
155
|
+
const descriptionSection = container.querySelector(
|
|
156
|
+
'.inventory-upload-header-description'
|
|
157
|
+
);
|
|
158
|
+
expect(descriptionSection).toBeTruthy();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('does not render description section when in IoP mode', () => {
|
|
162
|
+
mockIopMode = true; // Enable IoP mode for this test
|
|
163
|
+
|
|
164
|
+
const { container } = renderWithStore(<PageHeader />, {
|
|
165
|
+
API: {
|
|
166
|
+
INVENTORY_SETTINGS: {
|
|
167
|
+
response: { subscriptionConnectionEnabled: true },
|
|
168
|
+
},
|
|
169
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
170
|
+
response: { use_iop_mode: true },
|
|
171
|
+
status: 'RESOLVED',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Description section should not be present in IoP mode
|
|
177
|
+
const descriptionSection = container.querySelector(
|
|
178
|
+
'.inventory-upload-header-description'
|
|
179
|
+
);
|
|
180
|
+
expect(descriptionSection).toBeNull();
|
|
181
|
+
});
|
|
182
|
+
});
|
|
13
183
|
});
|
|
@@ -4,11 +4,13 @@ import SyncButton from '../SyncButton';
|
|
|
4
4
|
import CloudConnectorButton from '../CloudConnectorButton';
|
|
5
5
|
import './toolbarButtons.scss';
|
|
6
6
|
import { selectSubscriptionConnectionEnabled } from '../../../InventorySettings/InventorySettingsSelectors';
|
|
7
|
+
import { useIopConfig } from '../../../../../common/Hooks/ConfigHooks';
|
|
7
8
|
|
|
8
9
|
const ToolbarButtons = () => {
|
|
9
10
|
const subscriptionConnectionEnabled = useSelector(
|
|
10
11
|
selectSubscriptionConnectionEnabled
|
|
11
12
|
);
|
|
13
|
+
const isIop = useIopConfig();
|
|
12
14
|
|
|
13
15
|
if (!subscriptionConnectionEnabled) {
|
|
14
16
|
return null;
|
|
@@ -16,7 +18,7 @@ const ToolbarButtons = () => {
|
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
20
|
<div className="inventory_toolbar_buttons">
|
|
19
|
-
<CloudConnectorButton />
|
|
21
|
+
{!isIop && <CloudConnectorButton />}
|
|
20
22
|
<SyncButton />
|
|
21
23
|
</div>
|
|
22
24
|
);
|
|
@@ -1,60 +1,78 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import thunk from 'redux-thunk';
|
|
5
|
-
import { screen, render } from '@testing-library/react';
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
|
+
import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
|
|
6
4
|
import ToolbarButtons from '../ToolbarButtons';
|
|
5
|
+
import { useIopConfig } from '../../../../../../common/Hooks/ConfigHooks';
|
|
6
|
+
import { selectSubscriptionConnectionEnabled } from '../../../../InventorySettings/InventorySettingsSelectors';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
8
|
+
// Mock the config hook
|
|
9
|
+
jest.mock('../../../../../../common/Hooks/ConfigHooks', () => ({
|
|
10
|
+
useIopConfig: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
// Mock the selector
|
|
14
|
+
jest.mock('../../../../InventorySettings/InventorySettingsSelectors', () => ({
|
|
15
|
+
selectSubscriptionConnectionEnabled: jest.fn(),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
// Mock child components to isolate ToolbarButtons testing
|
|
19
|
+
jest.mock(
|
|
20
|
+
'../../SyncButton',
|
|
21
|
+
() =>
|
|
22
|
+
function MockSyncButton() {
|
|
23
|
+
return <div data-testid="sync-button">Sync all inventory status</div>;
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
jest.mock(
|
|
27
|
+
'../../CloudConnectorButton',
|
|
28
|
+
() =>
|
|
29
|
+
function MockCloudConnectorButton() {
|
|
30
|
+
return (
|
|
31
|
+
<div data-testid="cloud-connector-button">
|
|
32
|
+
Configure cloud connector
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const { renderWithStore } = rtlHelpers;
|
|
25
39
|
|
|
26
40
|
describe('ToolbarButtons', () => {
|
|
27
|
-
test('when subscription connection is enabled', () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
expect(screen.queryAllByText('Configure cloud connector')).toHaveLength(1);
|
|
36
|
-
expect(screen.queryAllByText('Sync all inventory status')).toHaveLength(1);
|
|
41
|
+
test('renders both buttons when subscription connection is enabled and not in IOP mode', () => {
|
|
42
|
+
useIopConfig.mockReturnValue(false);
|
|
43
|
+
selectSubscriptionConnectionEnabled.mockReturnValue(true);
|
|
44
|
+
|
|
45
|
+
renderWithStore(<ToolbarButtons />);
|
|
46
|
+
|
|
47
|
+
expect(screen.getByTestId('cloud-connector-button')).toBeTruthy();
|
|
48
|
+
expect(screen.getByTestId('sync-button')).toBeTruthy();
|
|
37
49
|
});
|
|
38
50
|
|
|
39
|
-
test('
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
test('renders only sync button when in IOP mode', () => {
|
|
52
|
+
useIopConfig.mockReturnValue(true);
|
|
53
|
+
selectSubscriptionConnectionEnabled.mockReturnValue(true);
|
|
54
|
+
|
|
55
|
+
renderWithStore(<ToolbarButtons />);
|
|
56
|
+
|
|
57
|
+
expect(screen.queryByTestId('cloud-connector-button')).toBeNull();
|
|
58
|
+
expect(screen.getByTestId('sync-button')).toBeTruthy();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('renders nothing when subscription connection is not enabled', () => {
|
|
62
|
+
useIopConfig.mockReturnValue(false);
|
|
63
|
+
selectSubscriptionConnectionEnabled.mockReturnValue(false);
|
|
64
|
+
|
|
65
|
+
const { container } = renderWithStore(<ToolbarButtons />);
|
|
66
|
+
|
|
67
|
+
expect(container.firstChild).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('renders toolbar buttons container with correct className when enabled', () => {
|
|
71
|
+
useIopConfig.mockReturnValue(false);
|
|
72
|
+
selectSubscriptionConnectionEnabled.mockReturnValue(true);
|
|
73
|
+
|
|
74
|
+
const { container } = renderWithStore(<ToolbarButtons />);
|
|
75
|
+
|
|
76
|
+
expect(container.querySelector('.inventory_toolbar_buttons')).toBeTruthy();
|
|
59
77
|
});
|
|
60
78
|
});
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
|
|
3
3
|
import InsightsTable from '../InsightsTable';
|
|
4
4
|
import { tableProps } from './fixtures';
|
|
5
5
|
|
|
6
|
-
jest.mock('
|
|
7
|
-
useForemanContext: () => ({
|
|
8
|
-
metadata: {
|
|
9
|
-
foreman_rh_cloud: {
|
|
10
|
-
iop: true,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
}),
|
|
14
|
-
useForemanSettings: () => ({
|
|
15
|
-
perPage: 20,
|
|
16
|
-
}),
|
|
17
|
-
}));
|
|
6
|
+
jest.mock('../../../../common/Hooks/ConfigHooks');
|
|
18
7
|
|
|
19
|
-
const
|
|
20
|
-
'render with Props': tableProps,
|
|
21
|
-
};
|
|
8
|
+
const { renderWithStore } = rtlHelpers;
|
|
22
9
|
|
|
23
10
|
describe('InsightsTable', () => {
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders without crashing', () => {
|
|
16
|
+
renderWithStore(<InsightsTable {...tableProps} />);
|
|
17
|
+
});
|
|
26
18
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { screen } from '@testing-library/react';
|
|
3
|
+
import { rtlHelpers } from 'foremanReact/common/rtlTestHelpers';
|
|
3
4
|
import { API } from 'foremanReact/redux/API';
|
|
4
5
|
import { CVECountCell } from '../CVECountCell';
|
|
5
|
-
import * as ConfigHooks from '../../common/Hooks/ConfigHooks';
|
|
6
6
|
|
|
7
7
|
jest.mock('foremanReact/redux/API');
|
|
8
8
|
jest.mock('../../common/Hooks/ConfigHooks');
|
|
9
9
|
|
|
10
|
+
const { renderWithStore } = rtlHelpers;
|
|
11
|
+
|
|
10
12
|
API.get.mockImplementation(async () => ({
|
|
11
13
|
data: [
|
|
12
14
|
{
|
|
@@ -18,17 +20,13 @@ API.get.mockImplementation(async () => ({
|
|
|
18
20
|
}));
|
|
19
21
|
|
|
20
22
|
const hostDetailsMock = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
name: 'test-host.example.com',
|
|
24
|
+
subscription_facet_attributes: {
|
|
25
|
+
uuid: 'test-uuid-123',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
26
28
|
|
|
27
29
|
describe('CVECountCell', () => {
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
ConfigHooks.useIopConfig.mockReturnValue(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
30
|
afterEach(() => {
|
|
33
31
|
jest.clearAllMocks();
|
|
34
32
|
});
|
|
@@ -40,35 +38,92 @@ describe('CVECountCell', () => {
|
|
|
40
38
|
uuid: null, // no subscription
|
|
41
39
|
},
|
|
42
40
|
};
|
|
43
|
-
|
|
41
|
+
renderWithStore(<CVECountCell hostDetails={hostDetailsMockIoP} />, {
|
|
42
|
+
router: {
|
|
43
|
+
location: {
|
|
44
|
+
pathname: '/',
|
|
45
|
+
search: '',
|
|
46
|
+
hash: '',
|
|
47
|
+
query: {},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
API: {
|
|
51
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
52
|
+
response: { use_iop_mode: true },
|
|
53
|
+
status: 'RESOLVED',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
44
57
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
45
58
|
});
|
|
46
59
|
|
|
47
60
|
it('renders UnknownIcon when IoP is not enabled', () => {
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
|
|
62
|
+
router: {
|
|
63
|
+
location: {
|
|
64
|
+
pathname: '/',
|
|
65
|
+
search: '',
|
|
66
|
+
hash: '',
|
|
67
|
+
query: {},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
API: {
|
|
71
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
72
|
+
response: { use_iop_mode: false },
|
|
73
|
+
status: 'RESOLVED',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
});
|
|
50
77
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
51
|
-
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
52
78
|
});
|
|
53
79
|
|
|
54
80
|
it('renders UnknownIcon when IoP is enabled but CVE API call fails', () => {
|
|
55
|
-
// Mock successful IoP config
|
|
56
|
-
ConfigHooks.useIopConfig.mockReturnValue(true);
|
|
57
81
|
// Mock CVE API failure - override the global mock for this test
|
|
58
82
|
API.get.mockImplementationOnce(async () => {
|
|
59
83
|
throw new Error('CVE API call failed');
|
|
60
84
|
});
|
|
61
85
|
|
|
62
|
-
|
|
86
|
+
renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
|
|
87
|
+
router: {
|
|
88
|
+
location: {
|
|
89
|
+
pathname: '/',
|
|
90
|
+
search: '',
|
|
91
|
+
hash: '',
|
|
92
|
+
query: {},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
API: {
|
|
96
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
97
|
+
response: { use_iop_mode: true },
|
|
98
|
+
status: 'RESOLVED',
|
|
99
|
+
},
|
|
100
|
+
// Mock the API failure state for the CVE endpoint
|
|
101
|
+
[`HOST_CVE_COUNT_${hostDetailsMock.subscription_facet_attributes.uuid}`]: {
|
|
102
|
+
status: 'ERROR',
|
|
103
|
+
error: 'CVE API call failed',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
63
107
|
// Should render UnknownIcon when CVE API fails
|
|
64
108
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
65
|
-
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
66
109
|
});
|
|
67
110
|
|
|
68
111
|
it('renders UnknownIcon when IoP is undefined (API call pending)', () => {
|
|
69
|
-
|
|
70
|
-
|
|
112
|
+
renderWithStore(<CVECountCell hostDetails={hostDetailsMock} />, {
|
|
113
|
+
router: {
|
|
114
|
+
location: {
|
|
115
|
+
pathname: '/',
|
|
116
|
+
search: '',
|
|
117
|
+
hash: '',
|
|
118
|
+
query: {},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
API: {
|
|
122
|
+
ADVISOR_ENGINE_CONFIG: {
|
|
123
|
+
status: 'PENDING',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
});
|
|
71
127
|
expect(screen.getByRole('img', { hidden: true })).toBeTruthy();
|
|
72
|
-
expect(ConfigHooks.useIopConfig).toHaveBeenCalled();
|
|
73
128
|
});
|
|
74
129
|
});
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_rh_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 13.0.
|
|
4
|
+
version: 13.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Foreman Red Hat Cloud team
|
|
@@ -196,7 +196,7 @@ files:
|
|
|
196
196
|
- lib/foreman_inventory_upload/async/remove_insights_hosts_job.rb
|
|
197
197
|
- lib/foreman_inventory_upload/async/shell_process.rb
|
|
198
198
|
- lib/foreman_inventory_upload/async/single_host_report_job.rb
|
|
199
|
-
- lib/foreman_inventory_upload/async/
|
|
199
|
+
- lib/foreman_inventory_upload/async/upload_report_direct_job.rb
|
|
200
200
|
- lib/foreman_inventory_upload/generators/archived_report.rb
|
|
201
201
|
- lib/foreman_inventory_upload/generators/fact_helpers.rb
|
|
202
202
|
- lib/foreman_inventory_upload/generators/json_stream.rb
|
|
@@ -205,7 +205,6 @@ files:
|
|
|
205
205
|
- lib/foreman_inventory_upload/generators/slice.rb
|
|
206
206
|
- lib/foreman_inventory_upload/generators/tags.rb
|
|
207
207
|
- lib/foreman_inventory_upload/notifications/manifest_import_success_notification_override.rb
|
|
208
|
-
- lib/foreman_inventory_upload/scripts/uploader.sh.erb
|
|
209
208
|
- lib/foreman_rh_cloud.rb
|
|
210
209
|
- lib/foreman_rh_cloud/async/exponential_backoff.rb
|
|
211
210
|
- lib/foreman_rh_cloud/engine.rb
|
|
@@ -279,7 +278,7 @@ files:
|
|
|
279
278
|
- test/jobs/queue_for_upload_job_test.rb
|
|
280
279
|
- test/jobs/remove_insights_hosts_job_test.rb
|
|
281
280
|
- test/jobs/single_host_report_job_test.rb
|
|
282
|
-
- test/jobs/
|
|
281
|
+
- test/jobs/upload_report_direct_job_test.rb
|
|
283
282
|
- test/models/insights_client_report_status_test.rb
|
|
284
283
|
- test/test_plugin_helper.rb
|
|
285
284
|
- test/unit/archived_report_generator_test.rb
|
|
@@ -443,7 +442,6 @@ files:
|
|
|
443
442
|
- webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js
|
|
444
443
|
- webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js
|
|
445
444
|
- webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageTitle.test.js
|
|
446
|
-
- webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap
|
|
447
445
|
- webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap
|
|
448
446
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js
|
|
449
447
|
- webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js
|
|
@@ -588,7 +586,6 @@ files:
|
|
|
588
586
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js
|
|
589
587
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js
|
|
590
588
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js
|
|
591
|
-
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap
|
|
592
589
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap
|
|
593
590
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap
|
|
594
591
|
- webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js
|
|
@@ -648,7 +645,6 @@ files:
|
|
|
648
645
|
- webpack/__mocks__/foremanReact/common/I18n.js
|
|
649
646
|
- webpack/__mocks__/foremanReact/common/MountingService.js
|
|
650
647
|
- webpack/__mocks__/foremanReact/common/helpers.js
|
|
651
|
-
- webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js
|
|
652
648
|
- webpack/__mocks__/foremanReact/components/ConfirmModal/index.js
|
|
653
649
|
- webpack/__mocks__/foremanReact/components/Head.js
|
|
654
650
|
- webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
|
|
@@ -740,7 +736,7 @@ test_files:
|
|
|
740
736
|
- test/jobs/queue_for_upload_job_test.rb
|
|
741
737
|
- test/jobs/remove_insights_hosts_job_test.rb
|
|
742
738
|
- test/jobs/single_host_report_job_test.rb
|
|
743
|
-
- test/jobs/
|
|
739
|
+
- test/jobs/upload_report_direct_job_test.rb
|
|
744
740
|
- test/models/insights_client_report_status_test.rb
|
|
745
741
|
- test/test_plugin_helper.rb
|
|
746
742
|
- test/unit/archived_report_generator_test.rb
|