From bc929e89d091b08cc0921f602d50db374c02ba18 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Thu, 9 Jul 2020 11:34:21 -0700 Subject: [PATCH 1/2] Fix limited packages incorrect response --- .../plugins/ingest_manager/server/services/epm/packages/get.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts b/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts index 78aa513d1a1dc..7093723806ea3 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts @@ -69,7 +69,7 @@ export async function getLimitedPackages(options: { }); }) ); - return installedPackagesInfo.filter((pkgInfo) => isPackageLimited).map((pkgInfo) => pkgInfo.name); + return installedPackagesInfo.filter(isPackageLimited).map((pkgInfo) => pkgInfo.name); } export async function getPackageSavedObjects(savedObjectsClient: SavedObjectsClientContract) { From f7e660121a52d897726d87bc2b8314da34eba579 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Thu, 9 Jul 2020 11:54:44 -0700 Subject: [PATCH 2/2] Add test to make sure we don't break this again :D --- .../apis/epm/list.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts index 1ac1474e03700..64e8aa16955a5 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts @@ -34,5 +34,21 @@ export default function ({ getService }: FtrProviderContext) { warnAndSkipTest(this, log); } }); + + it('lists all limited packages from the registry', async function () { + if (server.enabled) { + const fetchLimitedPackageList = async () => { + const response = await supertest + .get('/api/ingest_manager/epm/packages/limited') + .set('kbn-xsrf', 'xxx') + .expect(200); + return response.body; + }; + const listResponse = await fetchLimitedPackageList(); + expect(listResponse.response).to.eql(['endpoint']); + } else { + warnAndSkipTest(this, log); + } + }); }); }