Update mock-server to 8.0.1

This commit is contained in:
Fedor Indutny 2024-10-10 10:29:33 -07:00 committed by GitHub
parent ccf1c398f5
commit 8e6c3ee568
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 23 deletions

View file

@ -2,16 +2,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
import { pipeline } from 'node:stream/promises';
import { createWriteStream } from 'node:fs';
import { mkdir } from 'node:fs/promises';
import { join } from 'node:path';
import { Bootstrap } from './fixtures';
import { generateBackup } from '../../test-both/helpers/generateBackup';
Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise<void> => {
const { phone, cdn3Path } = bootstrap;
const { phone, server } = bootstrap;
const { backupId, stream: backupStream } = generateBackup({
aci: phone.device.aci,
@ -20,14 +15,8 @@ Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise<void> => {
conversations: 1000,
messages: 60 * 1000,
});
const backupFolder = join(
cdn3Path,
'backups',
backupId.toString('base64url')
);
await mkdir(backupFolder, { recursive: true });
const fileStream = createWriteStream(join(backupFolder, 'backup'));
await pipeline(backupStream, fileStream);
await server.storeBackupOnCdn(backupId, backupStream);
const importStart = Date.now();