fix: bind performance evidence to production resources
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { aggregateFiveDriveTraces } from './lib/performance-aggregation.mjs';
|
||||
|
||||
const paths = process.argv.slice(2);
|
||||
const args = process.argv.slice(2);
|
||||
if (args[0] !== '--trust-policy' || typeof args[1] !== 'string') throw new Error('Pass --trust-policy followed by an explicit trusted public-key policy.');
|
||||
const policy = JSON.parse(await readFile(args[1], 'utf8'));
|
||||
const paths = args.slice(2);
|
||||
if (paths.length !== 5) throw new Error('Pass exactly five explicit drive-trace.v1 JSON paths.');
|
||||
const runs = [];
|
||||
for (const path of paths) runs.push(JSON.parse(await readFile(path, 'utf8')));
|
||||
const aggregate = aggregateFiveDriveTraces(runs);
|
||||
const aggregate = aggregateFiveDriveTraces(runs, policy);
|
||||
process.stdout.write(`${JSON.stringify(aggregate, null, 2)}\n`);
|
||||
if (!aggregate.passes) process.exitCode = 1;
|
||||
|
||||
Reference in New Issue
Block a user