[7.17.14] [data views] fix fields for wildcard integration test (#165910)

Cherry picked from #164772:
> ## Summary
> I'm waiting for this to fail CI - this means that a new ES snapshot is
being used. Then we update the test snapshot and should be good to
merge.
> 
> The lastest ES snapshot is returning field types in a different order
which really doesn't matter to this endpoint so I'll just update the
snapshot.

Closes #165633.

---------

Co-authored-by: Matthew Kime <matt@mattki.me>
This commit is contained in:
Davis McPhee 2023-09-15 17:46:10 -03:00 committed by GitHub
parent f864f22be4
commit 246fc4b23d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,9 +11,9 @@ import expect from '@kbn/expect';
export default function ({ getService }) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const esVersion = getService('esVersion');
// FAILING ES FORWARD COMPATIBILITY: https://github.com/elastic/kibana/issues/165633
describe.skip('conflicts', () => {
describe('conflicts', () => {
before(() =>
esArchiver.load('test/api_integration/fixtures/es_archiver/index_patterns/conflicts')
);
@ -21,7 +21,10 @@ export default function ({ getService }) {
esArchiver.unload('test/api_integration/fixtures/es_archiver/index_patterns/conflicts')
);
it('flags fields with mismatched types as conflicting', () =>
const itIfLessThanEs811 = esVersion.matchRange('<8.11') ? it : it.skip;
const itIfGreaterOrEqualEs811 = esVersion.matchRange('>=8.11') ? it : it.skip;
itIfLessThanEs811('flags fields with mismatched types as conflicting (<8.11)', () =>
supertest
.get('/api/index_patterns/_fields_for_wildcard')
.query({ pattern: 'logs-*' })
@ -71,6 +74,60 @@ export default function ({ getService }) {
},
],
});
}));
})
);
itIfGreaterOrEqualEs811('flags fields with mismatched types as conflicting (>=8.11)', () =>
supertest
.get('/api/index_patterns/_fields_for_wildcard')
.query({ pattern: 'logs-*' })
.expect(200)
.then((resp) => {
expect(resp.body).to.eql({
fields: [
{
name: '@timestamp',
type: 'date',
esTypes: ['date'],
aggregatable: true,
searchable: true,
readFromDocValues: true,
metadata_field: false,
},
{
name: 'number_conflict',
type: 'number',
esTypes: ['float', 'integer'],
aggregatable: true,
searchable: true,
readFromDocValues: true,
metadata_field: false,
},
{
name: 'string_conflict',
type: 'string',
esTypes: ['keyword', 'text'],
aggregatable: true,
searchable: true,
readFromDocValues: true,
metadata_field: false,
},
{
name: 'success',
type: 'conflict',
esTypes: ['keyword', 'boolean'],
aggregatable: true,
searchable: true,
readFromDocValues: false,
conflictDescriptions: {
boolean: ['logs-2017.01.02'],
keyword: ['logs-2017.01.01'],
},
metadata_field: false,
},
],
});
})
);
});
}