signal-desktop/ts/test-mock/benchmarks/backup_bench.ts

36 lines
1 KiB
TypeScript
Raw Normal View History

// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
import { Bootstrap } from './fixtures';
import { generateBackup } from '../../test-both/helpers/generateBackup';
Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise<void> => {
2024-10-10 17:29:33 +00:00
const { phone, server } = bootstrap;
const { backupId, stream: backupStream } = generateBackup({
aci: phone.device.aci,
profileKey: phone.profileKey.serialize(),
2024-10-31 17:01:03 +00:00
accountEntropyPool: phone.accountEntropyPool,
mediaRootBackupKey: phone.mediaRootBackupKey,
conversations: 1000,
messages: 60 * 1000,
});
2024-10-10 17:29:33 +00:00
await server.storeBackupOnCdn(backupId, backupStream);
const app = await bootstrap.link();
2024-11-13 17:31:13 +00:00
const { duration: importDuration } = await app.waitForBackupImportComplete();
await app.migrateAllMessages();
const exportStart = Date.now();
await app.uploadBackup();
const exportEnd = Date.now();
console.log('run=%d info=%j', 0, {
2024-11-13 17:31:13 +00:00
importDuration,
exportDuration: exportEnd - exportStart,
});
});