Skip to content

Commit bcf4779

Browse files
committed
logs
1 parent 191183a commit bcf4779

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

Diff for: federation-v1/scenarios/constant-vus-over-time/generate-report.ts

+29-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ async function generateReport(artifactsRootPath: string) {
7373
const reportsData = await Promise.all(
7474
foundDirectories.map(async (dirName) => {
7575
const fullPath = join(artifactsRootPath, dirName);
76+
console.log(`Processing directory: ${fullPath}`);
7677
const jsonSummaryFilePath = join(fullPath, "./k6_summary.json");
7778

7879
if (!existsSync(jsonSummaryFilePath)) {
@@ -135,6 +136,8 @@ async function generateReport(artifactsRootPath: string) {
135136
.filter(notEmpty)
136137
.sort((a, b) => b.rps - a.rps);
137138

139+
console.log(`Found ${validReportsData.length} valid reports`);
140+
138141
const vega: vl.TopLevelSpec = {
139142
width: 600,
140143
height: 400,
@@ -196,7 +199,10 @@ async function generateReport(artifactsRootPath: string) {
196199
);
197200
}
198201

199-
const checks = v.jsonSummary.root_group.checks;
202+
const checks: Array<{
203+
fails: number;
204+
name: string;
205+
}> = v.jsonSummary.root_group.checks;
200206
const http200Check = checks.find(
201207
(c) => c.name === "response code was 200"
202208
);
@@ -207,6 +213,28 @@ async function generateReport(artifactsRootPath: string) {
207213
(c) => c.name === "valid response structure"
208214
);
209215

216+
function logRawReport() {
217+
console.log("Raw report for:", v.name);
218+
console.log("--");
219+
console.log(JSON.stringify(checks, null, 2));
220+
console.log("--");
221+
}
222+
223+
if (!http200Check) {
224+
logRawReport();
225+
throw new Error("Could not find 'response code was 200' check!");
226+
}
227+
228+
if (!graphqlErrors) {
229+
logRawReport();
230+
throw new Error("Could not find 'no graphql errors' check!");
231+
}
232+
233+
if (!responseStructure) {
234+
logRawReport();
235+
throw new Error("Could not find 'valid response structure' check!");
236+
}
237+
210238
if (http200Check.fails > 0) {
211239
notes.push(`${http200Check.fails} non-200 responses`);
212240
}

0 commit comments

Comments
 (0)