Skip to content

Commit d6d9ed2

Browse files
Wrap all the tests in the docker check
1 parent 7189679 commit d6d9ed2

1 file changed

Lines changed: 53 additions & 44 deletions

File tree

  • x-pack/test/ingest_manager_api_integration/apis

x-pack/test/ingest_manager_api_integration/apis/install.ts

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,80 @@
66

77
import expect from '@kbn/expect';
88
import { FtrProviderContext } from '../../api_integration/ftr_provider_context';
9+
import { warnAndSkipTest } from '../helpers';
910

1011
export default function ({ getService }: FtrProviderContext) {
1112
const supertest = getService('supertest');
1213
const es = getService('es');
14+
const dockerServers = getService('dockerServers');
15+
const log = getService('log');
1316

1417
const deletePackage = async (pkgkey: string) => {
15-
await supertest
16-
.delete(`/api/ingest_manager/epm/packages/${pkgkey}`)
17-
.set('kbn-xsrf', 'xxxx')
18-
.expect(200);
18+
await supertest.delete(`/api/ingest_manager/epm/packages/${pkgkey}`).set('kbn-xsrf', 'xxxx');
1919
};
2020

2121
const mappingsPackage = 'overrides-0.1.0';
22+
const server = dockerServers.get('registry');
2223

2324
describe('installs packages that include settings and mappings overrides', async () => {
2425
after(async () => {
25-
// remove the package just in case it being installed will affect other tests
26-
await deletePackage(mappingsPackage);
26+
if (server.enabled) {
27+
// remove the package just in case it being installed will affect other tests
28+
await deletePackage(mappingsPackage);
29+
}
2730
});
2831

29-
it('should install the overrides package correctly', async () => {
30-
let { body } = await supertest
31-
.post(`/api/ingest_manager/epm/packages/${mappingsPackage}`)
32-
.set('kbn-xsrf', 'xxxx')
33-
.expect(200);
32+
it('should install the overrides package correctly', async function () {
33+
if (server.enabled) {
34+
let { body } = await supertest
35+
.post(`/api/ingest_manager/epm/packages/${mappingsPackage}`)
36+
.set('kbn-xsrf', 'xxxx')
37+
.expect(200);
3438

35-
const templateName = body.response[0].id;
39+
const templateName = body.response[0].id;
3640

37-
({ body } = await es.transport.request({
38-
method: 'GET',
39-
path: `/_index_template/${templateName}`,
40-
}));
41+
({ body } = await es.transport.request({
42+
method: 'GET',
43+
path: `/_index_template/${templateName}`,
44+
}));
4145

42-
// make sure it has the right composed_of array, the contents should be the component templates
43-
// that were installed
44-
expect(body.index_templates[0].index_template.composed_of).to.contain(
45-
`${templateName}-mappings`
46-
);
47-
expect(body.index_templates[0].index_template.composed_of).to.contain(
48-
`${templateName}-settings`
49-
);
46+
// make sure it has the right composed_of array, the contents should be the component templates
47+
// that were installed
48+
expect(body.index_templates[0].index_template.composed_of).to.contain(
49+
`${templateName}-mappings`
50+
);
51+
expect(body.index_templates[0].index_template.composed_of).to.contain(
52+
`${templateName}-settings`
53+
);
5054

51-
({ body } = await es.transport.request({
52-
method: 'GET',
53-
path: `/_component_template/${templateName}-mappings`,
54-
}));
55+
({ body } = await es.transport.request({
56+
method: 'GET',
57+
path: `/_component_template/${templateName}-mappings`,
58+
}));
5559

56-
// Make sure that the `dynamic` field exists and is set to false (as it is in the package)
57-
expect(body.component_templates[0].component_template.template.mappings.dynamic).to.be(false);
58-
// Make sure that the `@timestamp` field exists and is set to date
59-
// this can be removed once https://github.com/elastic/elasticsearch/issues/58956 is resolved
60-
expect(
61-
body.component_templates[0].component_template.template.mappings.properties['@timestamp']
62-
.type
63-
).to.be('date');
60+
// Make sure that the `dynamic` field exists and is set to false (as it is in the package)
61+
expect(body.component_templates[0].component_template.template.mappings.dynamic).to.be(
62+
false
63+
);
64+
// Make sure that the `@timestamp` field exists and is set to date
65+
// this can be removed once https://github.com/elastic/elasticsearch/issues/58956 is resolved
66+
expect(
67+
body.component_templates[0].component_template.template.mappings.properties['@timestamp']
68+
.type
69+
).to.be('date');
6470

65-
({ body } = await es.transport.request({
66-
method: 'GET',
67-
path: `/_component_template/${templateName}-settings`,
68-
}));
71+
({ body } = await es.transport.request({
72+
method: 'GET',
73+
path: `/_component_template/${templateName}-settings`,
74+
}));
6975

70-
// Make sure that the lifecycle name gets set correct in the settings
71-
expect(
72-
body.component_templates[0].component_template.template.settings.index.lifecycle.name
73-
).to.be('reference');
76+
// Make sure that the lifecycle name gets set correct in the settings
77+
expect(
78+
body.component_templates[0].component_template.template.settings.index.lifecycle.name
79+
).to.be('reference');
80+
} else {
81+
warnAndSkipTest(this, log);
82+
}
7483
});
7584
});
7685
}

0 commit comments

Comments
 (0)