Skip to content

Commit

Permalink
[Upgrade Assistant] Fix Kibana deprecations warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored and sabarasaba committed Oct 26, 2021
1 parent 6734f0a commit be51153
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,32 @@ describe('Error handling', () => {
server.restore();
});

test('handles plugin error', async () => {
test('handles plugin errors', async () => {
await act(async () => {
kibanaDeprecationsServiceHelpers.setLoadDeprecations({
deprecationService,
response: [
...kibanaDeprecationsServiceHelpers.defaultMockedResponses.mockedKibanaDeprecations,
{
domainId: 'failed_plugin_id',
domainId: 'failed_plugin_id_1',
title: 'Failed to fetch deprecations for "failed_plugin_id"',
message: `Failed to get deprecations info for plugin "failed_plugin_id".`,
level: 'fetch_error',
correctiveActions: {
manualSteps: ['Check Kibana server logs for error message.'],
},
},
{
domainId: 'failed_plugin_id_1',
title: 'Failed to fetch deprecations for "failed_plugin_id"',
message: `Failed to get deprecations info for plugin "failed_plugin_id".`,
level: 'fetch_error',
correctiveActions: {
manualSteps: ['Check Kibana server logs for error message.'],
},
},
{
domainId: 'failed_plugin_id_2',
title: 'Failed to fetch deprecations for "failed_plugin_id"',
message: `Failed to get deprecations info for plugin "failed_plugin_id".`,
level: 'fetch_error',
Expand All @@ -53,7 +71,7 @@ describe('Error handling', () => {

expect(exists('kibanaDeprecationErrors')).toBe(true);
expect(find('kibanaDeprecationErrors').text()).toContain(
'List of deprecation issues might be incomplete'
'Failed to get deprecation issues for these plugins: failed_plugin_id_1, failed_plugin_id_2.'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,14 @@ export const KibanaDeprecations = withRouter(({ history }: RouteComponentProps)
const deprecationErrors: string[] = [];

allDeprecations.forEach((deprecation) => {
// Keep track of any deprecations that failed to fetch to show warning in UI
// Keep track of any plugin deprecations that failed to fetch to show warning in UI
if (deprecation.level === 'fetch_error') {
deprecationErrors.push(deprecation.domainId);
// It's possible that a plugin registered more than one deprecation that could fail
// We only want to keep track of the unique plugin failures
const pluginErrorExists = deprecationErrors.includes(deprecation.domainId);
if (pluginErrorExists === false) {
deprecationErrors.push(deprecation.domainId);
}
return;
}

Expand Down

0 comments on commit be51153

Please sign in to comment.