Skip to content

Commit 30dd329

Browse files
committed
Add debug logs
1 parent 14f1fcc commit 30dd329

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
npx lint-staged
2-
npm run package
2+
npm run package && git add ./dist/index.js

dev/protocol4.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { check, group, sleep } from 'k6'
2+
import http from 'k6/http'
3+
4+
export const options = {
5+
scenarios: {
6+
normal_users: {
7+
executor: 'constant-vus',
8+
vus: 5,
9+
duration: '30s',
10+
},
11+
spike_users: {
12+
executor: 'ramping-vus',
13+
stages: [
14+
{ duration: '10s', target: 10 },
15+
{ duration: '10s', target: 20 },
16+
{ duration: '10s', target: 5 },
17+
],
18+
},
19+
},
20+
}
21+
22+
export default function () {
23+
group('Always Passing Check', function () {
24+
let res = http.get('https://test-api.k6.io/public/crocodiles/')
25+
26+
check(res, {
27+
'Response status is 200': (r) => r.status === 200, // ✅ Always passes
28+
})
29+
30+
sleep(1)
31+
})
32+
33+
group('Partially Failing Check', function () {
34+
let res = http.get('https://test-api.k6.io/public/does-not-exist/')
35+
36+
check(res, {
37+
'Response status is 200 or 404': (r) =>
38+
r.status === 200 || r.status === 404, // ⚠️ Partially fails
39+
})
40+
41+
sleep(1)
42+
})
43+
44+
group('Completely Failing Check', function () {
45+
let res = http.get('https://test-api.k6.io/internal/secret')
46+
47+
check(res, {
48+
'Response status is 200': (r) => r.status === 200, // ❌ Always fails (Expected 403/500)
49+
})
50+
51+
sleep(1)
52+
})
53+
}

dist/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -35414,12 +35414,16 @@ async function generatePRComment(testRunUrlsMap) {
3541435414
continue;
3541535415
}
3541635416
const testRunSummary = await (0, k6helper_1.fetchTestRunSummary)(testRunId);
35417+
console.log(`Test run summary`);
35418+
console.log(JSON.stringify(testRunSummary, null, 2));
3541735419
if (!testRunSummary) {
3541835420
core.info(`Unable to fetch test run summary for test run ${testRunId}`);
3541935421
continue;
3542035422
}
3542135423
resultSummaryStrings.push((0, markdownRenderer_1.getTestRunStatusMarkdown)(testRunSummary.test_run_status));
3542235424
const checks = await (0, k6helper_1.fetchChecks)(testRunId);
35425+
console.log(`Checks`);
35426+
console.log(JSON.stringify(checks, null, 2));
3542335427
const markdownSummary = (0, markdownRenderer_1.generateMarkdownSummary)(testRunSummary.metrics_summary, checks);
3542435428
resultSummaryStrings.push(markdownSummary);
3542535429
resultSummaryStrings.push('\n');

src/githubHelper.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ export async function generatePRComment(
194194
}
195195

196196
const testRunSummary = await fetchTestRunSummary(testRunId)
197-
197+
console.log(`Test run summary`)
198+
console.log(JSON.stringify(testRunSummary, null, 2))
198199
if (!testRunSummary) {
199200
core.info(`Unable to fetch test run summary for test run ${testRunId}`)
200201
continue
@@ -205,7 +206,8 @@ export async function generatePRComment(
205206
)
206207

207208
const checks = await fetchChecks(testRunId)
208-
209+
console.log(`Checks`)
210+
console.log(JSON.stringify(checks, null, 2))
209211
const markdownSummary = generateMarkdownSummary(
210212
testRunSummary.metrics_summary,
211213
checks

0 commit comments

Comments
 (0)