Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reporting] Correct CSV and ILM tests when run against ES 8.0 #123981

Merged
merged 13 commits into from
Feb 3, 2022
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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ export default function ({ getService }: FtrProviderContext) {
};

describe('ILM policy migration APIs', function () {
this.onlyEsVersion('<=7');

before(async () => {
await security.role.create(reportingAPI.REPORTING_ROLE, {
metadata: {},
elasticsearch: {
cluster: ['manage_ilm'],
indices: [
{ names: ['ecommerce'], privileges: ['read'], allow_restricted_indices: false },
{ names: ['.reporting-*'], privileges: ['all'], allow_restricted_indices: true },
{
names: ['.reporting-*'],
privileges: ['all', 'manage'],
allow_restricted_indices: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be forward-ported to 8.x

},
],
run_as: [],
},
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/reporting_api_integration/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function ReportingAPIProvider(context: FtrProviderContext) {
export const services = {
...xpackServices,
supertestWithoutAuth: apiIntegrationServices.supertestWithoutAuth,
esSupertestWithoutAuth: apiIntegrationServices.esSupertestWithoutAuth,
usageAPI: apiIntegrationServices.usageAPI,
reportingAPI: ReportingAPIProvider,
};
6 changes: 4 additions & 2 deletions x-pack/test/reporting_api_integration/services/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer
const log = getService('log');
const supertest = getService('supertest');
const esSupertest = getService('esSupertest');
const esSupertestWithoutAuth = getService('esSupertestWithoutAuth');
const kibanaServer = getService('kibanaServer');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const retry = getService('retry');
Expand Down Expand Up @@ -222,8 +223,9 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer
const settings = {
'index.lifecycle.name': null,
};
await esSupertest
.put('/.reporting-*/_settings?expand_wildcards=all,hidden')
await esSupertestWithoutAuth
.put('/.reporting-*/_settings?expand_wildcards=all')
.auth(REPORTING_USER_USERNAME, REPORTING_USER_PASSWORD)
.send({
settings,
})
Expand Down