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

[7.17][Rollup] Unskip 7.17 rollup API integration tests #187339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ import { getRandomString } from './lib';
export default function ({ getService }) {
const supertest = getService('supertest');

const { createIndexWithMappings, getJobPayload, createJob, cleanUp } =
const { createIndexWithMappings, createMockRollupIndex, getJobPayload, createJob, cleanUp } =
registerHelpers(getService);

// Failing: See https://github.com/elastic/kibana/issues/184227
describe.skip('index patterns extension', () => {
describe('index patterns extension', () => {
// The step below is done for the 7.17 ES 8.x forward compatibility tests
// From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster
// We will simulate rollup usage by creating a mock-up rollup index
before(async () => {
await createMockRollupIndex();
});

after(() => cleanUp());

describe('Fields for wildcards', () => {
const BASE_URI = `${INDEX_PATTERNS_EXTENSION_BASE_PATH}/_fields_for_wildcard`;

Expand Down
34 changes: 29 additions & 5 deletions x-pack/test/api_integration/apis/management/rollup/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { registerHelpers } from './rollup.test_helpers';

export default function ({ getService }) {
const supertest = getService('supertest');
const esVersion = getService('esVersion');

const {
createIndexWithMappings,
createMockRollupIndex,
getJobPayload,
loadJobs,
createJob,
Expand All @@ -25,8 +27,6 @@ export default function ({ getService }) {
} = registerHelpers(getService);

describe('jobs', function () {
this.onlyEsVersion('<=7');

after(() => cleanUp());

describe('indices', () => {
Expand Down Expand Up @@ -86,6 +86,15 @@ export default function ({ getService }) {
});

describe('crud', () => {
// The step below is done for the 7.17 ES 8.15 forward compatibility tests
// From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster
// We will simulate rollup usage by creating a mock-up rollup index
before(async () => {
await createMockRollupIndex();
});

after(() => cleanUp());

describe('list', () => {
it('should return an empty array when there are no jobs', async () => {
const { body } = await loadJobs().expect(200);
Expand Down Expand Up @@ -223,6 +232,15 @@ export default function ({ getService }) {
});

describe('actions', () => {
// The step below is done for the 7.17 ES 8.15 forward compatibility tests
// From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster
// We will simulate rollup usage by creating a mock-up rollup index
before(async () => {
await createMockRollupIndex();
});

after(() => cleanUp());

describe('start', () => {
let job;

Expand Down Expand Up @@ -256,9 +274,15 @@ export default function ({ getService }) {
it('should throw a 400 Bad request if the job is already started', async () => {
await startJob(job.config.id); // Start the job

const { body } = await startJob(job.config.id).expect(400);
expect(body.error).to.eql('Bad Request');
expect(body.message).to.contain('Cannot start task for Rollup Job');
if (esVersion.matchRange('<=7')) {
const { body } = await startJob(job.config.id).expect(400);
expect(body.error).to.eql('Bad Request');
expect(body.message).to.contain('Cannot start task for Rollup Job');
} else {
// Since ES 8.0, starting a started job is allowed
// See https://github.com/elastic/kibana/pull/38168
await startJob(job.config.id).expect(200);
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,50 @@ export const registerHelpers = (getService) => {
throw err;
});

const createMockRollupIndex = () =>
createIndexWithMappings('mock_rollup_index', {
_meta: {
_rollup: {
logs_job: {
id: 'mockRollupJob',
index_pattern: 'mockRollupIndex',
rollup_index: ROLLUP_INDEX_NAME,
cron: '0 0 0 ? * 7',
page_size: 1000,
groups: {
date_histogram: {
interval: '24h',
delay: '1d',
time_zone: 'UTC',
field: 'testCreatedField',
},
terms: {
fields: ['testTotalField', 'testTagField'],
},
histogram: {
interval: '7',
fields: ['testTotalField'],
},
},
metrics: [
{
field: 'testTotalField',
metrics: ['avg', 'value_count'],
},
{
field: 'testCreatedField',
metrics: ['max', 'min'],
},
],
},
},
'rollup-version': '',
},
});

return {
createIndexWithMappings,
createMockRollupIndex,
getJobPayload,
loadJobs,
createJob,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import { getRandomString } from './lib';
export default function ({ getService }) {
const supertest = getService('supertest');

const { createIndexWithMappings, getJobPayload, createJob, cleanUp } =
const { createIndexWithMappings, createMockRollupIndex, getJobPayload, createJob, cleanUp } =
registerHelpers(getService);

// Failing: See https://github.com/elastic/kibana/issues/184275
describe.skip('search', () => {
describe('search', () => {
after(() => cleanUp());

const URI = `${API_BASE_PATH}/search`;

it('return a 404 if the rollup index does not exist', async () => {
Expand All @@ -32,6 +33,11 @@ export default function ({ getService }) {
});

it('should return a 200 when searching on existing rollup index', async () => {
// The step below is done for the 7.17 ES 8.15 forward compatibility tests
// From 8.15, Es only allows creating a new rollup job when there is existing rollup usage in the cluster
// We will simulate rollup usage by creating a mock-up rollup index
await createMockRollupIndex();

// Create a Rollup job on an index with the INDEX_TO_ROLLUP_MAPPINGS
const indexName = await createIndexWithMappings();
const rollupIndex = getRandomString();
Expand Down