mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
Revert "[revert] comment out entire pdfmaker test file"
This reverts commit e6256f1f5b
.
This commit is contained in:
parent
e6256f1f5b
commit
dcffac3117
1 changed files with 73 additions and 73 deletions
|
@ -5,90 +5,90 @@
|
||||||
* 2.0.
|
* 2.0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
test('nothing', () => {});
|
/* eslint-disable max-classes-per-file */
|
||||||
|
|
||||||
// import path from 'path';
|
import path from 'path';
|
||||||
// import { isUint8Array } from 'util/types';
|
import { isUint8Array } from 'util/types';
|
||||||
// import { createMockLayout } from '../../../../../../screenshotting/server/layouts/mock';
|
import { createMockLayout } from '../../../../../../screenshotting/server/layouts/mock';
|
||||||
// import { PdfMaker } from '../';
|
import { PdfMaker } from '../';
|
||||||
// import { PdfWorkerOutOfMemoryError } from '../pdfmaker_errors';
|
import { PdfWorkerOutOfMemoryError } from '../pdfmaker_errors';
|
||||||
|
|
||||||
// const imageBase64 = Buffer.from(
|
const imageBase64 = Buffer.from(
|
||||||
// `iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAGFBMVEXy8vJpaWn7+/vY2Nj39/cAAACcnJzx8fFvt0oZAAAAi0lEQVR4nO3SSQoDIBBFwR7U3P/GQXKEIIJULXr9H3TMrHhX5Yysvj3jjM8+XRnVa9wec8QuHKv3h74Z+PNyGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/xu3Bxy026rXu4ljdUVW395xUFfGzLo946DK+QW+bgCTFcecSAAAAABJRU5ErkJggg==`,
|
`iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAGFBMVEXy8vJpaWn7+/vY2Nj39/cAAACcnJzx8fFvt0oZAAAAi0lEQVR4nO3SSQoDIBBFwR7U3P/GQXKEIIJULXr9H3TMrHhX5Yysvj3jjM8+XRnVa9wec8QuHKv3h74Z+PNyGwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/xu3Bxy026rXu4ljdUVW395xUFfGzLo946DK+QW+bgCTFcecSAAAAABJRU5ErkJggg==`,
|
||||||
// 'base64'
|
'base64'
|
||||||
// );
|
);
|
||||||
|
|
||||||
// describe('PdfMaker', () => {
|
describe('PdfMaker', () => {
|
||||||
// let layout: ReturnType<typeof createMockLayout>;
|
let layout: ReturnType<typeof createMockLayout>;
|
||||||
// let pdf: PdfMaker;
|
let pdf: PdfMaker;
|
||||||
|
|
||||||
// beforeEach(() => {
|
beforeEach(() => {
|
||||||
// layout = createMockLayout();
|
layout = createMockLayout();
|
||||||
// pdf = new PdfMaker(layout, undefined);
|
pdf = new PdfMaker(layout, undefined);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// describe('generate', () => {
|
describe('generate', () => {
|
||||||
// it('should generate PDF array buffer', async () => {
|
it('should generate PDF array buffer', async () => {
|
||||||
// pdf.setTitle('the best PDF in the world');
|
pdf.setTitle('the best PDF in the world');
|
||||||
// pdf.addImage(imageBase64, { title: 'first viz', description: '☃️' });
|
pdf.addImage(imageBase64, { title: 'first viz', description: '☃️' });
|
||||||
// pdf.addImage(imageBase64, { title: 'second viz', description: '❄️' });
|
pdf.addImage(imageBase64, { title: 'second viz', description: '❄️' });
|
||||||
|
|
||||||
// expect(isUint8Array(await pdf.generate())).toBe(true);
|
expect(isUint8Array(await pdf.generate())).toBe(true);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// describe('worker', () => {
|
describe('worker', () => {
|
||||||
// /**
|
/**
|
||||||
// * Leave this test skipped! It is a proof-of-concept for demonstrating that
|
* Leave this test skipped! It is a proof-of-concept for demonstrating that
|
||||||
// * we correctly handle a worker OOM error. Due to the variability of when
|
* we correctly handle a worker OOM error. Due to the variability of when
|
||||||
// * Node will terminate the worker thread for exceeding resource
|
* Node will terminate the worker thread for exceeding resource
|
||||||
// * limits we cannot guarantee this test will always execute in a reasonable
|
* limits we cannot guarantee this test will always execute in a reasonable
|
||||||
// * amount of time.
|
* amount of time.
|
||||||
// */
|
*/
|
||||||
// it.skip('should report when the PDF worker runs out of memory instead of crashing the main thread', async () => {
|
it.skip('should report when the PDF worker runs out of memory instead of crashing the main thread', async () => {
|
||||||
// const leakyMaker = new (class MemoryLeakPdfMaker extends PdfMaker {
|
const leakyMaker = new (class MemoryLeakPdfMaker extends PdfMaker {
|
||||||
// // From local testing:
|
// From local testing:
|
||||||
// // OOMs after 456.486 seconds with high young generation size
|
// OOMs after 456.486 seconds with high young generation size
|
||||||
// // OOMs after 53.538 seconds low young generation size
|
// OOMs after 53.538 seconds low young generation size
|
||||||
// protected workerMaxOldHeapSizeMb = 2;
|
protected workerMaxOldHeapSizeMb = 2;
|
||||||
// protected workerMaxYoungHeapSizeMb = 2;
|
protected workerMaxYoungHeapSizeMb = 2;
|
||||||
// protected workerModulePath = path.resolve(__dirname, './memory_leak_worker.js');
|
protected workerModulePath = path.resolve(__dirname, './memory_leak_worker.js');
|
||||||
// })(layout, undefined);
|
})(layout, undefined);
|
||||||
// await expect(leakyMaker.generate()).rejects.toBeInstanceOf(PdfWorkerOutOfMemoryError);
|
await expect(leakyMaker.generate()).rejects.toBeInstanceOf(PdfWorkerOutOfMemoryError);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('restarts the PDF worker if it crashes', async () => {
|
it('restarts the PDF worker if it crashes', async () => {
|
||||||
// const buggyMaker = new (class BuggyPdfMaker extends PdfMaker {
|
const buggyMaker = new (class BuggyPdfMaker extends PdfMaker {
|
||||||
// protected workerModulePath = path.resolve(__dirname, './buggy_worker.js');
|
protected workerModulePath = path.resolve(__dirname, './buggy_worker.js');
|
||||||
// })(layout, undefined);
|
})(layout, undefined);
|
||||||
|
|
||||||
// await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
||||||
// await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
||||||
// await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
await expect(buggyMaker.generate()).rejects.toEqual(new Error('This is a bug'));
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
// describe('getPageCount', () => {
|
describe('getPageCount', () => {
|
||||||
// it('should return zero pages on no content', () => {
|
it('should return zero pages on no content', () => {
|
||||||
// expect(pdf.getPageCount()).toBe(0);
|
expect(pdf.getPageCount()).toBe(0);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('should return a number of generated pages', async () => {
|
it('should return a number of generated pages', async () => {
|
||||||
// for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
// pdf.addImage(imageBase64, { title: `${i} viz`, description: '☃️' });
|
pdf.addImage(imageBase64, { title: `${i} viz`, description: '☃️' });
|
||||||
// }
|
}
|
||||||
// await pdf.generate();
|
await pdf.generate();
|
||||||
|
|
||||||
// expect(pdf.getPageCount()).toBe(100);
|
expect(pdf.getPageCount()).toBe(100);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// it('should return a number of already flushed pages', async () => {
|
it('should return a number of already flushed pages', async () => {
|
||||||
// for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
// pdf.addImage(imageBase64, { title: `${i} viz`, description: '☃️' });
|
pdf.addImage(imageBase64, { title: `${i} viz`, description: '☃️' });
|
||||||
// }
|
}
|
||||||
// await pdf.generate();
|
await pdf.generate();
|
||||||
|
|
||||||
// expect(pdf.getPageCount()).toBe(100);
|
expect(pdf.getPageCount()).toBe(100);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue