fix: recurse into subdirectories when parsing conformance output (#148)
parseOutputDir only read one level deep, so scenarios with '/' in their name (e.g. auth/metadata-default) were stored in nested subdirectories and never found. This caused tier-check to report 4/23 client conformance when the actual pass rate was 23/23. Also removes accidentally committed pnpm-lock.yaml.
This commit is contained in:
parent
3b4a92baad
commit
c82fd65cfa
1 changed files with 9 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import { mkdtempSync, readFileSync, readdirSync, existsSync } from 'fs';
|
import { mkdtempSync, readFileSync, existsSync, globSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join, dirname } from 'path';
|
||||||
import { tmpdir } from 'os';
|
import { tmpdir } from 'os';
|
||||||
import { ConformanceResult } from '../types';
|
import { ConformanceResult } from '../types';
|
||||||
import { listScenarios, listActiveClientScenarios } from '../../scenarios';
|
import { listScenarios, listActiveClientScenarios } from '../../scenarios';
|
||||||
|
|
@ -26,10 +26,13 @@ function parseOutputDir(outputDir: string): ConformanceResult {
|
||||||
let totalPassed = 0;
|
let totalPassed = 0;
|
||||||
let totalFailed = 0;
|
let totalFailed = 0;
|
||||||
|
|
||||||
const entries = readdirSync(outputDir);
|
// Find all checks.json files recursively to handle scenarios with '/' in
|
||||||
for (const scenarioName of entries) {
|
// their name (e.g. auth/metadata-default) which create nested subdirectories.
|
||||||
const checksPath = join(outputDir, scenarioName, 'checks.json');
|
const checksFiles = globSync('**/checks.json', { cwd: outputDir });
|
||||||
if (!existsSync(checksPath)) continue;
|
|
||||||
|
for (const checksFile of checksFiles) {
|
||||||
|
const scenarioName = dirname(checksFile);
|
||||||
|
const checksPath = join(outputDir, checksFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const checks: ConformanceCheck[] = JSON.parse(
|
const checks: ConformanceCheck[] = JSON.parse(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue