Skip to content

Commit

Permalink
[UII] Adjust test based on ES version tested against (elastic#195508)
Browse files Browse the repository at this point in the history
## Summary

Follow up to elastic#194764. This test was also failing on 7.17 branch when
they 8.x ES compatibility tests were run, so this PR adjusts the test
based on the ES version it runs against. This will be backported to 8.x
and 7.17.

(cherry picked from commit ab2d7aa)

# Conflicts:
#	x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts
  • Loading branch information
jen-huang committed Oct 9, 2024
1 parent daefd92 commit a861c45
Showing 1 changed file with 49 additions and 38 deletions.
87 changes: 49 additions & 38 deletions x-pack/test/fleet_api_integration/apis/epm/install_overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import expect from '@kbn/expect';
import expect from '@kbn/expect/expect';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
import { skipIfNoDockerRegistry, isDockerRegistryEnabledOrSkipped } from '../../helpers';
import { setupFleetAndAgents } from '../agents/services';
Expand Down Expand Up @@ -116,52 +116,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-*-*'],
},
],
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',
},
]
: []),
]);
});
});
}

0 comments on commit a861c45

Please sign in to comment.