forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] fix for upgrade package with tsds removed (elastic#157395)
## Summary Fixes elastic#157345 To test: Install `nginx-1.12.0-beta` which has `index.mode:time_series`. ``` POST http://elastic:changeme@localhost:5601/api/fleet/epm/packages/nginx-1.12.0-beta kbn-xsrf: kibana { "force": true } ``` Upgrade to `nginx-1.12.1-beta` which has `index.mode:time_series` removed. Upload this package built manually: [nginx-1.12.1-beta.zip](https://github.com/elastic/kibana/files/11452945/nginx-1.12.1-beta.zip) ``` curl -XPOST -H 'content-type: application/zip' -H 'kbn-xsrf: true' http://localhost:5601/api/fleet/epm/packages -u elastic:changeme --data-binary @nginx-1.12.1-beta.zip ``` The package should install successfully and time_series should be removed from the index template `metrics-nginx.stubstatus` WIP: update tests ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit a0ee7b6)
- Loading branch information
1 parent
31ff66e
commit 872d169
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
x-pack/test/fleet_api_integration/apis/epm/install_tsds_disable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; | ||
import { skipIfNoDockerRegistry } from '../../helpers'; | ||
import { setupFleetAndAgents } from '../agents/services'; | ||
|
||
export default function (providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const supertest = getService('supertest'); | ||
const es = getService('es'); | ||
|
||
const deletePackage = async (name: string, version: string) => { | ||
await supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); | ||
}; | ||
|
||
describe('installing with tsds disabled', async () => { | ||
skipIfNoDockerRegistry(providerContext); | ||
setupFleetAndAgents(providerContext); | ||
|
||
after(async () => { | ||
await deletePackage('nginx', '1.12.1-beta'); | ||
}); | ||
|
||
it('should upgrade with tsds disabled if nginx exists with tsds', async function () { | ||
const templateName = 'metrics-nginx.stubstatus'; | ||
|
||
await supertest | ||
.post(`/api/fleet/epm/packages/nginx/1.12.0-beta`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.send({ force: true }) | ||
.expect(200); | ||
|
||
expect(await getIndexMode(templateName)).to.eql('time_series'); | ||
|
||
await supertest | ||
.post(`/api/fleet/epm/packages/nginx/1.12.1-beta`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.send({ force: true }) | ||
.expect(200); | ||
|
||
expect(await getIndexMode(templateName)).to.be(undefined); | ||
}); | ||
|
||
async function getIndexMode(templateName: string) { | ||
const { body: indexTemplateResponse } = await es.transport.request<any>( | ||
{ | ||
method: 'GET', | ||
path: `/_index_template/${templateName}`, | ||
}, | ||
{ meta: true } | ||
); | ||
|
||
const indexTemplate = indexTemplateResponse.index_templates[0].index_template; | ||
return indexTemplate.template.settings.index?.mode; | ||
} | ||
}); | ||
} |
Binary file added
BIN
+1.11 MB
x-pack/test/fleet_api_integration/apis/fixtures/test_packages/nginx/nginx-1.12.0-beta.zip
Binary file not shown.
Binary file added
BIN
+1.11 MB
x-pack/test/fleet_api_integration/apis/fixtures/test_packages/nginx/nginx-1.12.1-beta.zip
Binary file not shown.