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

[Rollups] Fix API integration tests #186079

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 @@ -13,16 +13,24 @@ import { stringify } from 'query-string';
import { registerHelpers } from './rollup.test_helpers';
import { getRandomString } from './lib';
import { DataViewType } from '@kbn/data-views-plugin/common';
import { INDEX_TO_ROLLUP_MAPPINGS } from './constants';

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

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

describe('index patterns extension', () => {
// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/184081
describe.skip('Fields for wildcards', () => {
// 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', () => {
describe('query params validation', () => {
let uri;
let body;
Expand Down Expand Up @@ -57,15 +65,14 @@ export default function ({ getService }) {

it('should return the correct fields', async () => {
// Create a Rollup job on an index with the INDEX_TO_ROLLUP_MAPPINGS
const indexName = await createIndexWithMappings();
const indexName = await createIndexWithMappings(undefined, INDEX_TO_ROLLUP_MAPPINGS);
const rollupIndex = getRandomString();
const payload = getJobPayload(indexName, undefined, rollupIndex);
await createJob(payload);

// Query for wildcard
const params = {
pattern: indexName,
type: DataViewType.ROLLUP,
rollup_index: rollupIndex,
};
const uri = `${BASE_URI}?${stringify(params, { sort: false })}`;
Expand All @@ -75,12 +82,12 @@ export default function ({ getService }) {
.expect(200);

// Verify that the fields for wildcard correspond to our declared mappings
// noting that testTotalField and testTagField are not shown in the field caps results
const fieldsForWildcard = body.fields.map((field) => field.name);
expect(fieldsForWildcard.sort()).eql(['testCreatedField']);

// Cleanup
await cleanUp();
expect(fieldsForWildcard.sort()).eql([
'testCreatedField',
'testTagField',
'testTotalField',
]);
});
});
});
Expand Down
Loading