-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99f6aee
commit 8a41396
Showing
4 changed files
with
53 additions
and
6 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
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
48 changes: 48 additions & 0 deletions
48
x-pack/test/ingest_manager_api_integration/apis/epm/setup.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,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; | ||
import { skipIfNoDockerRegistry } from '../../helpers'; | ||
import { GetInfoResponse, Installed } from '../../../../plugins/ingest_manager/common'; | ||
|
||
export default function (providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const supertest = getService('supertest'); | ||
const log = getService('log'); | ||
|
||
describe('setup api', async () => { | ||
skipIfNoDockerRegistry(providerContext); | ||
describe('setup performs upgrades', async () => { | ||
const oldEndpointVersion = '0.13.0'; | ||
beforeEach(async () => { | ||
await supertest | ||
.post(`/api/ingest_manager/epm/packages/endpoint-${oldEndpointVersion}`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.send({ force: true }) | ||
.expect(200); | ||
}); | ||
it('upgrades the endpoint package from 0.13.0 to the latest version available', async function () { | ||
let { body }: { body: GetInfoResponse } = await supertest | ||
.get(`/api/ingest_manager/epm/packages/endpoint-${oldEndpointVersion}`) | ||
.expect(200); | ||
const latestEndpointVersion = body.response.latestVersion; | ||
log.info(`Endpoint package latest version: ${latestEndpointVersion}`); | ||
// make sure we're actually doing an upgrade | ||
expect(latestEndpointVersion).not.eql(oldEndpointVersion); | ||
await supertest.post(`/api/ingest_manager/setup`).set('kbn-xsrf', 'xxxx').expect(200); | ||
|
||
({ body } = await supertest | ||
.get(`/api/ingest_manager/epm/packages/endpoint-${latestEndpointVersion}`) | ||
.expect(200)); | ||
expect(body.response).to.have.property('savedObject'); | ||
expect((body.response as Installed).savedObject.attributes.install_version).to.eql( | ||
latestEndpointVersion | ||
); | ||
}); | ||
}); | ||
}); | ||
} |