Created
November 9, 2021 16:43
-
-
Save FrankHassanabad/ef1dea7ae960a10be86a79a57afc9247 to your computer and use it in GitHub Desktop.
Fleet memory leak
This file contains hidden or 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
/* | |
* 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. | |
*/ | |
// Put this file at "x-pack/plugins/fleet/server" and then modify "copy_tests.sh" | |
// to have the setting "KIBANA_PROJECT=x-pack/plugins/fleet/jest.config.js" | |
// And then run it: | |
// ./copy_tests.sh ~/projects/kibana/x-pack/plugins/fleet/server/test_sample.test.ts | |
// And you will see the memory leak unless you use the import outside of the pattern | |
// "x-pack/plugins/fleet/server" | |
// Any functions we import directly from ${PLUGIN_NAME}/server seems to start the memory leak. | |
// This will be a memory leak if we import from "x-pack/plugins/fleet/server" | |
// Comment this out and uncomment the line underneath it to remove the memory leak | |
import { relativeDownloadUrlFromArtifact } from '.'; | |
// This will not be a memory leak if we import from within the mappings folder | |
// import { relativeDownloadUrlFromArtifact } from './services/artifacts/mappings'; | |
describe('memory leak', () => { | |
test('it has a memory leak by just iterating over an import', () => { | |
// You just have to ensure you're touching the import, not actually invoke it to see the leak | |
Object.keys(relativeDownloadUrlFromArtifact); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment