From 327ce6a52181b2d6a7228a97f776a60a8909afd5 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:43:04 +1100 Subject: [PATCH] [8.x] [UII] Adjust test based on ES version tested against (#195508) (#195535) # Backport This will backport the following commits from `main` to `8.x`: - [[UII] Adjust test based on ES version tested against (#195508)](https://github.com/elastic/kibana/pull/195508) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Jen Huang --- .../apis/epm/install_overrides.ts | 89 ++++++++++--------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts b/x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts index 2d6ef45856e18..9a20ebd1188be 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts @@ -119,56 +119,63 @@ export default function (providerContext: FtrProviderContext) { // omit routings delete body.template.settings.index.routing; - expect(body).to.eql({ - template: { - settings: { - index: { - default_pipeline: 'logs-overrides.test-0.1.0', - lifecycle: { - name: 'overridden by user', - }, - mapping: { - total_fields: { - limit: '1000', - }, + expect(Object.keys(body)).to.eql(['template', 'overlapping']); + expect(body.template).to.eql({ + settings: { + index: { + default_pipeline: 'logs-overrides.test-0.1.0', + lifecycle: { + name: 'overridden by user', + }, + mapping: { + total_fields: { + limit: '1000', }, - number_of_shards: '3', }, + number_of_shards: '3', }, - mappings: { - dynamic: 'false', - properties: { - '@timestamp': { - type: 'date', - }, - data_stream: { - properties: { - dataset: { - type: 'constant_keyword', - }, - namespace: { - type: 'constant_keyword', - }, - type: { - type: 'constant_keyword', - }, + }, + mappings: { + dynamic: 'false', + properties: { + '@timestamp': { + type: 'date', + }, + data_stream: { + properties: { + dataset: { + type: 'constant_keyword', + }, + namespace: { + type: 'constant_keyword', + }, + type: { + type: 'constant_keyword', }, }, }, }, - aliases: {}, }, - overlapping: [ - { - name: 'logs', - index_patterns: ['logs-*-*'], - }, - { - index_patterns: ['logs-*.otel-*'], - name: 'logs-otel@template', - }, - ], + aliases: {}, }); + + // otel logs templates were added in 8.16 but these tests also run against + // previous versions, so we conditionally test based on the ES version + const esVersion = getService('esVersion'); + expect(body.overlapping).to.eql([ + { + name: 'logs', + index_patterns: ['logs-*-*'], + }, + ...(esVersion.matchRange('>=8.16.0') + ? [ + { + index_patterns: ['logs-*.otel-*'], + name: 'logs-otel@template', + }, + ] + : []), + ]); }); }); }