|
@@ -28,7 +28,7 @@ if (require.main === module) {
|
|
|
const databaseName = `vendure-load-testing-${count}`;
|
|
const databaseName = `vendure-load-testing-${count}`;
|
|
|
isDatabasePopulated(databaseName)
|
|
isDatabasePopulated(databaseName)
|
|
|
.then(isPopulated => {
|
|
.then(isPopulated => {
|
|
|
- console.log(`isPopulated:`, isPopulated);
|
|
|
|
|
|
|
+ console.log('isPopulated:', isPopulated);
|
|
|
if (!isPopulated) {
|
|
if (!isPopulated) {
|
|
|
const config = getLoadTestConfig('bearer', databaseName);
|
|
const config = getLoadTestConfig('bearer', databaseName);
|
|
|
const csvFile = getProductCsvFilePath();
|
|
const csvFile = getProductCsvFilePath();
|
|
@@ -73,7 +73,7 @@ if (require.main === module) {
|
|
|
async function isDatabasePopulated(databaseName: string): Promise<boolean> {
|
|
async function isDatabasePopulated(databaseName: string): Promise<boolean> {
|
|
|
const isPostgres = process.env.DB === 'postgres';
|
|
const isPostgres = process.env.DB === 'postgres';
|
|
|
if (isPostgres) {
|
|
if (isPostgres) {
|
|
|
- console.log(`Checking whether data is populated (postgres)`);
|
|
|
|
|
|
|
+ console.log('Checking whether data is populated (postgres)');
|
|
|
const pg = require('pg');
|
|
const pg = require('pg');
|
|
|
const postgresConnectionOptions = getPostgresConnectionOptions(databaseName);
|
|
const postgresConnectionOptions = getPostgresConnectionOptions(databaseName);
|
|
|
const client = new pg.Client({
|
|
const client = new pg.Client({
|
|
@@ -88,7 +88,7 @@ async function isDatabasePopulated(databaseName: string): Promise<boolean> {
|
|
|
const res = await client.query('SELECT COUNT(id) as prodCount FROM product');
|
|
const res = await client.query('SELECT COUNT(id) as prodCount FROM product');
|
|
|
return true;
|
|
return true;
|
|
|
} catch (e: any) {
|
|
} catch (e: any) {
|
|
|
- if (e.message === `relation "product" does not exist`) {
|
|
|
|
|
|
|
+ if (e.message === 'relation "product" does not exist') {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
throw e;
|
|
throw e;
|
|
@@ -203,7 +203,7 @@ function generateMockData(productCount: number, writeFn: (row: string[]) => void
|
|
|
stockOnHand: '1000',
|
|
stockOnHand: '1000',
|
|
|
trackInventory: 'false',
|
|
trackInventory: 'false',
|
|
|
};
|
|
};
|
|
|
- writeFn(Object.values(outputRow) as string[]);
|
|
|
|
|
|
|
+ writeFn(Object.values(outputRow));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -218,66 +218,66 @@ function getCategoryNames() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const parts = [
|
|
const parts = [
|
|
|
- `Now equipped with seventh-generation Intel Core processors`,
|
|
|
|
|
- `Laptop is snappier than ever`,
|
|
|
|
|
- `From daily tasks like launching apps and opening files to more advanced computing`,
|
|
|
|
|
- `You can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz`,
|
|
|
|
|
- `Discover a truly immersive viewing experience with this monitor curved more deeply than any other`,
|
|
|
|
|
- `Wrapping around your field of vision the 1,800 R screencreates a wider field of view`,
|
|
|
|
|
- `This pc is optimised for gaming, and is also VR ready`,
|
|
|
|
|
- `The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level`,
|
|
|
|
|
- `Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs`,
|
|
|
|
|
- `Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard`,
|
|
|
|
|
- `Solid conductors eliminate strand-interaction distortion and reduce jitter`,
|
|
|
|
|
- `As the surface is made of high-purity silver`,
|
|
|
|
|
- `the performance is very close to that of a solid silver cable`,
|
|
|
|
|
- `but priced much closer to solid copper cable`,
|
|
|
|
|
- `With its nostalgic design and simple point-and-shoot functionality`,
|
|
|
|
|
- `the Instant Camera is the perfect pick to get started with instant photography`,
|
|
|
|
|
- `This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras`,
|
|
|
|
|
- `Capture vivid, professional-style photographs with help from this lightweight tripod`,
|
|
|
|
|
- `The adjustable-height tripod makes it easy to achieve reliable stability`,
|
|
|
|
|
- `Just the right angle when going after that award-winning shot`,
|
|
|
|
|
- `Featuring a full carbon chassis - complete with cyclocross-specific carbon fork`,
|
|
|
|
|
- `It's got the low weight, exceptional efficiency and brilliant handling`,
|
|
|
|
|
- `You'll need to stay at the front of the pack`,
|
|
|
|
|
- `When you're working out you need a quality rope that doesn't tangle at every couple of jumps`,
|
|
|
|
|
- `Training gloves designed for optimum training`,
|
|
|
|
|
- `Our gloves promote proper punching technique because they are conformed to the natural shape of your fist`,
|
|
|
|
|
- `Dense, innovative two-layer foam provides better shock absorbency`,
|
|
|
|
|
- `Full padding on the front, back and wrist to promote proper punching technique`,
|
|
|
|
|
- `With tons of space inside (for max. 4 persons), full head height throughout`,
|
|
|
|
|
- `This tent offers you everything you need`,
|
|
|
|
|
- `Based on the 1970s iconic shape, but made to a larger 69cm size`,
|
|
|
|
|
- `These skateboards are great for beginners to learn the foot spacing required`,
|
|
|
|
|
- `Perfect for all-day cruising`,
|
|
|
|
|
- `This football features high-contrast graphics for high-visibility during play`,
|
|
|
|
|
- `Its machine-stitched tpu casing offers consistent performance`,
|
|
|
|
|
- `With its ultra-light, uber-responsive magic foam`,
|
|
|
|
|
- `The Running Shoe is ready to push you to victories both large and small`,
|
|
|
|
|
- `A spiky yet elegant house cactus`,
|
|
|
|
|
- `Perfect for the home or office`,
|
|
|
|
|
- `Origin and habitat: Probably native only to the Andes of Peru`,
|
|
|
|
|
- `Gloriously elegant`,
|
|
|
|
|
- `It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall`,
|
|
|
|
|
- `2 to 3 foot stems host large white flowers that can last for over 2 months`,
|
|
|
|
|
- `Excellent semi-evergreen bonsai`,
|
|
|
|
|
- `Indoors or out but needs some winter protection`,
|
|
|
|
|
- `All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown`,
|
|
|
|
|
- `Placing it at home or office can bring you fortune and prosperity`,
|
|
|
|
|
- `Guards your house and ward off ill fortune`,
|
|
|
|
|
- `Hand trowel for garden cultivating hammer finish epoxy-coated head`,
|
|
|
|
|
- `For improved resistance to rust, scratches, humidity and alkalines in the soil`,
|
|
|
|
|
- `A charming vintage white wooden chair`,
|
|
|
|
|
- `Featuring an extremely spherical pink balloon`,
|
|
|
|
|
- `The balloon may be detached and used for other purposes`,
|
|
|
|
|
- `This premium, tan-brown bonded leather seat is part of the 'chill' sofa range`,
|
|
|
|
|
- `The lever activated recline feature makes it easy to adjust to any position`,
|
|
|
|
|
- `This smart, bustle back design with rounded tight padded arms has been designed with your comfort in mind`,
|
|
|
|
|
- `This well-padded chair has foam pocket sprung seat cushions and fibre-filled back cushions`,
|
|
|
|
|
- `Modern tapered white polycotton pendant shade with a metallic silver chrome interior`,
|
|
|
|
|
- `For maximum light reflection`,
|
|
|
|
|
- `Reversible gimble so it can be used as a ceiling shade or as a lamp shade`,
|
|
|
|
|
|
|
+ 'Now equipped with seventh-generation Intel Core processors',
|
|
|
|
|
+ 'Laptop is snappier than ever',
|
|
|
|
|
+ 'From daily tasks like launching apps and opening files to more advanced computing',
|
|
|
|
|
+ 'You can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz',
|
|
|
|
|
+ 'Discover a truly immersive viewing experience with this monitor curved more deeply than any other',
|
|
|
|
|
+ 'Wrapping around your field of vision the 1,800 R screencreates a wider field of view',
|
|
|
|
|
+ 'This pc is optimised for gaming, and is also VR ready',
|
|
|
|
|
+ 'The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level',
|
|
|
|
|
+ 'Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs',
|
|
|
|
|
+ 'Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard',
|
|
|
|
|
+ 'Solid conductors eliminate strand-interaction distortion and reduce jitter',
|
|
|
|
|
+ 'As the surface is made of high-purity silver',
|
|
|
|
|
+ 'the performance is very close to that of a solid silver cable',
|
|
|
|
|
+ 'but priced much closer to solid copper cable',
|
|
|
|
|
+ 'With its nostalgic design and simple point-and-shoot functionality',
|
|
|
|
|
+ 'the Instant Camera is the perfect pick to get started with instant photography',
|
|
|
|
|
+ 'This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras',
|
|
|
|
|
+ 'Capture vivid, professional-style photographs with help from this lightweight tripod',
|
|
|
|
|
+ 'The adjustable-height tripod makes it easy to achieve reliable stability',
|
|
|
|
|
+ 'Just the right angle when going after that award-winning shot',
|
|
|
|
|
+ 'Featuring a full carbon chassis - complete with cyclocross-specific carbon fork',
|
|
|
|
|
+ "It's got the low weight, exceptional efficiency and brilliant handling",
|
|
|
|
|
+ "You'll need to stay at the front of the pack",
|
|
|
|
|
+ "When you're working out you need a quality rope that doesn't tangle at every couple of jumps",
|
|
|
|
|
+ 'Training gloves designed for optimum training',
|
|
|
|
|
+ 'Our gloves promote proper punching technique because they are conformed to the natural shape of your fist',
|
|
|
|
|
+ 'Dense, innovative two-layer foam provides better shock absorbency',
|
|
|
|
|
+ 'Full padding on the front, back and wrist to promote proper punching technique',
|
|
|
|
|
+ 'With tons of space inside (for max. 4 persons), full head height throughout',
|
|
|
|
|
+ 'This tent offers you everything you need',
|
|
|
|
|
+ 'Based on the 1970s iconic shape, but made to a larger 69cm size',
|
|
|
|
|
+ 'These skateboards are great for beginners to learn the foot spacing required',
|
|
|
|
|
+ 'Perfect for all-day cruising',
|
|
|
|
|
+ 'This football features high-contrast graphics for high-visibility during play',
|
|
|
|
|
+ 'Its machine-stitched tpu casing offers consistent performance',
|
|
|
|
|
+ 'With its ultra-light, uber-responsive magic foam',
|
|
|
|
|
+ 'The Running Shoe is ready to push you to victories both large and small',
|
|
|
|
|
+ 'A spiky yet elegant house cactus',
|
|
|
|
|
+ 'Perfect for the home or office',
|
|
|
|
|
+ 'Origin and habitat: Probably native only to the Andes of Peru',
|
|
|
|
|
+ 'Gloriously elegant',
|
|
|
|
|
+ 'It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall',
|
|
|
|
|
+ '2 to 3 foot stems host large white flowers that can last for over 2 months',
|
|
|
|
|
+ 'Excellent semi-evergreen bonsai',
|
|
|
|
|
+ 'Indoors or out but needs some winter protection',
|
|
|
|
|
+ 'All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown',
|
|
|
|
|
+ 'Placing it at home or office can bring you fortune and prosperity',
|
|
|
|
|
+ 'Guards your house and ward off ill fortune',
|
|
|
|
|
+ 'Hand trowel for garden cultivating hammer finish epoxy-coated head',
|
|
|
|
|
+ 'For improved resistance to rust, scratches, humidity and alkalines in the soil',
|
|
|
|
|
+ 'A charming vintage white wooden chair',
|
|
|
|
|
+ 'Featuring an extremely spherical pink balloon',
|
|
|
|
|
+ 'The balloon may be detached and used for other purposes',
|
|
|
|
|
+ "This premium, tan-brown bonded leather seat is part of the 'chill' sofa range",
|
|
|
|
|
+ 'The lever activated recline feature makes it easy to adjust to any position',
|
|
|
|
|
+ 'This smart, bustle back design with rounded tight padded arms has been designed with your comfort in mind',
|
|
|
|
|
+ 'This well-padded chair has foam pocket sprung seat cushions and fibre-filled back cushions',
|
|
|
|
|
+ 'Modern tapered white polycotton pendant shade with a metallic silver chrome interior',
|
|
|
|
|
+ 'For maximum light reflection',
|
|
|
|
|
+ 'Reversible gimble so it can be used as a ceiling shade or as a lamp shade',
|
|
|
];
|
|
];
|
|
|
function generateProductDescription(): string {
|
|
function generateProductDescription(): string {
|
|
|
const take = Math.ceil(Math.random() * 4);
|
|
const take = Math.ceil(Math.random() * 4);
|