|
6 | 6 |
|
7 | 7 | import expect from '@kbn/expect'; |
8 | 8 | import { FtrProviderContext } from '../../api_integration/ftr_provider_context'; |
| 9 | +import { warnAndSkipTest } from '../helpers'; |
9 | 10 |
|
10 | 11 | export default function ({ getService }: FtrProviderContext) { |
11 | 12 | const supertest = getService('supertest'); |
12 | 13 | const es = getService('es'); |
| 14 | + const dockerServers = getService('dockerServers'); |
| 15 | + const log = getService('log'); |
13 | 16 |
|
14 | 17 | 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'); |
19 | 19 | }; |
20 | 20 |
|
21 | 21 | const mappingsPackage = 'overrides-0.1.0'; |
| 22 | + const server = dockerServers.get('registry'); |
22 | 23 |
|
23 | 24 | describe('installs packages that include settings and mappings overrides', async () => { |
24 | 25 | 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 | + } |
27 | 30 | }); |
28 | 31 |
|
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); |
34 | 38 |
|
35 | | - const templateName = body.response[0].id; |
| 39 | + const templateName = body.response[0].id; |
36 | 40 |
|
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 | + })); |
41 | 45 |
|
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 | + ); |
50 | 54 |
|
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 | + })); |
55 | 59 |
|
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'); |
64 | 70 |
|
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 | + })); |
69 | 75 |
|
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 | + } |
74 | 83 | }); |
75 | 84 | }); |
76 | 85 | } |
0 commit comments