Files
grafana/devenv/docker/loadtest-ts/scripts/prepareDashboardFileNames.ts
Artur Wierzbicki 616db7f68b Storage: k6 tests (#57496)
* object store k6

* update script

* refactor

* rename scripts

* fix paths

* fixes

* fix client - check connected state

* add teardown timeout

* rename to grpc object store client

* fail if health check fails

* abort rather than fail

* stale import

* create `run.sh`

* adjust for dummy server

* fix mkdir

* clean up dependencies

* remove name and version

* bring back name and version!

* remove clean webpackk plugin

* remove copy plugin

* update yarn lock

* remove stale import

* update yarn lock

* move perf tests to devenv/docker/loadtest-ts

* add codeownres
2022-10-27 23:22:04 +08:00

25 lines
804 B
TypeScript

import { readdirSync, writeFileSync, mkdirSync } from 'fs';
import { dirname, resolve } from 'path';
const args = process.argv.slice(2);
if (args.length !== 2) {
throw new Error('expected dev dashboards dir and the output file path');
}
const devDashboardsDir = args[0];
const outputFilePath = args[1];
const getFiles = (dirPath: string, ext?: string): string[] =>
readdirSync(dirPath, { withFileTypes: true })
.flatMap((dirEntry) => {
const res = resolve(dirPath, dirEntry.name);
return dirEntry.isDirectory() ? getFiles(res) : res;
})
.filter((path) => (ext?.length ? path.endsWith(ext) : true));
const files = getFiles(devDashboardsDir, '.json');
mkdirSync(dirname(outputFilePath), { recursive: true });
writeFileSync(outputFilePath, JSON.stringify(files, null, 2));