Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest Manager] add skipIfNoDockerRegistry to package_install_complete test #80779

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default function (providerContext: FtrProviderContext) {
const { getService } = providerContext;
const supertest = getService('supertest');
const es = getService('es');
const dockerServers = getService('dockerServers');
const server = dockerServers.get('registry');
const pkgName = 'datastreams';
const pkgVersion = '0.1.0';
const pkgUpdateVersion = '0.2.0';
Expand Down Expand Up @@ -63,6 +65,7 @@ export default function (providerContext: FtrProviderContext) {
});
});
afterEach(async () => {
if (!server) return;
await es.transport.request({
method: 'DELETE',
path: `/_data_stream/${logsTemplateName}-default`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PACKAGES_SAVED_OBJECT_TYPE,
MAX_TIME_COMPLETE_INSTALL,
} from '../../../../plugins/ingest_manager/common';
import { skipIfNoDockerRegistry } from '../../helpers';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';

export default function (providerContext: FtrProviderContext) {
Expand All @@ -19,20 +20,22 @@ export default function (providerContext: FtrProviderContext) {
const pkgVersion = '0.1.0';
const pkgUpdateVersion = '0.2.0';
describe('setup checks packages completed install', async () => {
skipIfNoDockerRegistry(providerContext);
describe('package install', async () => {
before(async () => {
await supertest
.post(`/api/fleet/epm/packages/${pkgName}-0.1.0`)
.set('kbn-xsrf', 'xxxx')
.send({ force: true });
.send({ force: true })
.expect(200);
});
it('should have not reinstalled if package install completed', async function () {
const packageBeforeSetup = await kibanaServer.savedObjects.get({
type: 'epm-packages',
id: pkgName,
});
const installStartedAtBeforeSetup = packageBeforeSetup.attributes.install_started_at;
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -51,7 +54,7 @@ export default function (providerContext: FtrProviderContext) {
install_started_at: previousInstallDate,
},
});
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -71,7 +74,7 @@ export default function (providerContext: FtrProviderContext) {
install_started_at: previousInstallDate,
},
});
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -83,27 +86,30 @@ export default function (providerContext: FtrProviderContext) {
after(async () => {
await supertest
.delete(`/api/fleet/epm/packages/multiple_versions-0.1.0`)
.set('kbn-xsrf', 'xxxx');
.set('kbn-xsrf', 'xxxx')
.expect(200);
});
});
describe('package update', async () => {
before(async () => {
await supertest
.post(`/api/fleet/epm/packages/${pkgName}-0.1.0`)
.set('kbn-xsrf', 'xxxx')
.send({ force: true });
.send({ force: true })
.expect(200);
await supertest
.post(`/api/fleet/epm/packages/${pkgName}-0.2.0`)
.set('kbn-xsrf', 'xxxx')
.send({ force: true });
.send({ force: true })
.expect(200);
});
it('should have not reinstalled if package update completed', async function () {
const packageBeforeSetup = await kibanaServer.savedObjects.get({
type: 'epm-packages',
id: pkgName,
});
const installStartedAtBeforeSetup = packageBeforeSetup.attributes.install_started_at;
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -124,7 +130,7 @@ export default function (providerContext: FtrProviderContext) {
install_version: pkgUpdateVersion, // set version back
},
});
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -147,7 +153,7 @@ export default function (providerContext: FtrProviderContext) {
version: pkgVersion, // set version back
},
});
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').expect(200);
const packageAfterSetup = await kibanaServer.savedObjects.get({
type: PACKAGES_SAVED_OBJECT_TYPE,
id: pkgName,
Expand All @@ -160,7 +166,8 @@ export default function (providerContext: FtrProviderContext) {
after(async () => {
await supertest
.delete(`/api/fleet/epm/packages/multiple_versions-0.1.0`)
.set('kbn-xsrf', 'xxxx');
.set('kbn-xsrf', 'xxxx')
.expect(200);
});
});
});
Expand Down