Skip to content
4 changes: 3 additions & 1 deletion x-pack/plugins/reporting/server/routes/deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/
import { errors } from '@elastic/elasticsearch';
import { SecurityHasPrivilegesIndexPrivilegesCheck } from '@elastic/elasticsearch/api/types';
import { RequestHandler } from 'src/core/server';
import {
API_MIGRATE_ILM_POLICY_URL,
Expand Down Expand Up @@ -39,7 +40,8 @@ export const registerDeprecationsRoutes = (reporting: ReportingCore, logger: Log
{
privileges: ['manage'], // required to do anything with the reporting indices
names: [store.getReportingIndexPattern()],
},
allow_restricted_indices: true,
} as SecurityHasPrivilegesIndexPrivilegesCheck,
Comment on lines +43 to +44
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be forward ported (and the import statement above)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nvm, this is already the case in main 🤦🏻

],
},
});
Expand Down
6,192 changes: 6,189 additions & 3 deletions x-pack/test/functional/apps/discover/__snapshots__/reporting.snap

Large diffs are not rendered by default.

41 changes: 27 additions & 14 deletions x-pack/test/functional/apps/discover/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const es = getService('es');
const esVersion = getService('esVersion');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
Expand All @@ -37,8 +37,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

describe('Discover CSV Export', function () {
this.onlyEsVersion('<=7');

before('initialize tests', async () => {
log.debug('ReportingPage:initTests');
await esArchiver.load('x-pack/test/functional/es_archives/reporting/ecommerce');
Expand All @@ -49,12 +47,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
after('clean up archives', async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/ecommerce');
await kibanaServer.importExport.unload(ecommerceSOPath);
await es.deleteByQuery({
index: '.reporting-*',
refresh: true,
body: { query: { match_all: {} } },
});
await esArchiver.emptyKibanaIndex();
});

describe('Check Available', () => {
Expand All @@ -72,12 +64,33 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

describe('Generate CSV: new search', () => {
beforeEach(async () => {
await kibanaServer.importExport.load(ecommerceSOPath);
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('ecommerce');
const describeIfEs7 = esVersion.matchRange('<8') ? describe : describe.skip;
const describeIfEs8 = esVersion.matchRange('>=8') ? describe : describe.skip;

const newSearchBeforeEach = async () => {
await kibanaServer.importExport.load(ecommerceSOPath);
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('ecommerce');
};

describeIfEs8('Generate: CSV: new search (8.x)', () => {
beforeEach(newSearchBeforeEach);

it('generates a report from a new search with data: default', async () => {
await PageObjects.discover.clickNewSearchButton();
await PageObjects.reporting.setTimepickerInEcommerceDataRange();

const res = await getReport();
expect(res.status).to.equal(200);
expect(res.get('content-type')).to.equal('text/csv; charset=utf-8');

const csvFile = res.text;
expectSnapshot(csvFile).toMatch();
});
});

describeIfEs7('Generate CSV: new search (7.17)', () => {
beforeEach(newSearchBeforeEach);

it('generates a report from a new search with data: default', async () => {
await PageObjects.discover.clickNewSearchButton();
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading