Skip to content

Commit 635d79a

Browse files
Parse explicit remote JCK targets
Co-authored-by: andrew-m-leonard <31470007+andrew-m-leonard@users.noreply.github.com>
1 parent 385ffd3 commit 635d79a

2 files changed

Lines changed: 49 additions & 13 deletions

File tree

‎TestResultSummaryService/routes/getRemoteJckBuildInfo.js‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function parseJckConsole(text) {
5656
/Triggering\s+(\S+\.jck)\s+on\s+(\S+)\s+with\s+JDK\s+(\S+)/i;
5757
const remoteUrlRe = /Remote build URL:\s*(https?:\/\/\S+)/i;
5858
const statusRe =
59-
/Remote job\s+(.+?)\s+Status:\s*(SUCCESS|UNSTABLE|FAILURE|ABORTED)/i;
59+
/Remote job\s+(.+?)(?:\s+Target:\s*(\S+))?\s+Status:\s*(SUCCESS|UNSTABLE|FAILURE|ABORTED)/i;
6060

6161
const triggers = []; // { target, platform, jdkVersion }
6262
const remoteUrls = []; // collected in order
@@ -88,7 +88,8 @@ function parseJckConsole(text) {
8888
if (statusMatch) {
8989
statusEntries.push({
9090
displayName: statusMatch[1].trim(),
91-
buildResult: statusMatch[2],
91+
target: statusMatch[2]?.replace(/\.jck$/i, ''),
92+
buildResult: statusMatch[3],
9293
});
9394
}
9495
}
@@ -108,13 +109,15 @@ function parseJckConsole(text) {
108109
);
109110
};
110111
statusEntries.forEach((statusEntry) => {
111-
const targetMatches = triggers.filter((trigger) => {
112-
const escapedTarget = escapeRegExp(trigger.target);
113-
return new RegExp(
114-
`(?:^|[^\\w])${escapedTarget}(?:\\.jck)?(?:$|[^\\w])`,
115-
'i'
116-
).test(statusEntry.displayName);
117-
});
112+
const targetMatches = triggers.filter((trigger) =>
113+
statusEntry.target
114+
? trigger.target.toLowerCase() ===
115+
statusEntry.target.toLowerCase()
116+
: new RegExp(
117+
`(?:^|[^\\w])${escapeRegExp(trigger.target)}(?:\\.jck)?(?:$|[^\\w])`,
118+
'i'
119+
).test(statusEntry.displayName)
120+
);
118121
const exactMatches =
119122
targetMatches.length > 1
120123
? targetMatches.filter(

‎TestResultSummaryService/test/getRemoteJckBuildInfo.test.js‎

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,45 @@ const getRemoteJckBuildInfo = require('../routes/getRemoteJckBuildInfo');
1818

1919
test('matches remote JCK results to targets when jobs finish out of order', async () => {
2020
consoleOutput = [
21-
'Triggering dev.jck on x86-64_linux with JDK 21',
22-
'Triggering special.jck on x86-64_linux with JDK 21',
21+
'Triggering dev.jck on x86-64_mac with JDK 17',
22+
'Triggering special.jck on x86-64_mac with JDK 17',
2323
'Remote build URL: https://example.com/job/dev/1/',
2424
'Remote build URL: https://example.com/job/special/1/',
25-
'Remote job release : jdk21 : x86-64_linux : special.jck Status: SUCCESS',
26-
'Remote job release : jdk21 : x86-64_linux : dev.jck Status: FAILURE',
25+
'Remote job jdk17 : jdk-17.0.21+8_adopt : weekly : x86-64_mac Target: special.jck Status: SUCCESS',
26+
'Remote job jdk17 : jdk-17.0.21+8_adopt : weekly : x86-64_mac Target: dev.jck Status: FAILURE',
27+
].join('\n');
28+
29+
let results;
30+
await getRemoteJckBuildInfo(
31+
{
32+
query: {
33+
url: 'https://example.com',
34+
buildName: 'AQA_Test_Pipeline_JCK',
35+
buildNum: '1',
36+
},
37+
},
38+
{
39+
send: (response) => {
40+
results = response;
41+
},
42+
}
43+
);
44+
45+
assert.deepEqual(
46+
results.map(({ target, buildResult }) => ({ target, buildResult })),
47+
[
48+
{ target: 'dev', buildResult: 'FAILURE' },
49+
{ target: 'special', buildResult: 'SUCCESS' },
50+
]
51+
);
52+
});
53+
54+
test('falls back to trigger order for status lines without an explicit target', async () => {
55+
consoleOutput = [
56+
'Triggering dev.jck on x86-64_linux with JDK 21',
57+
'Triggering special.jck on x86-64_linux with JDK 21',
58+
'Remote job jdk21 : x86-64_linux Status: FAILURE',
59+
'Remote job jdk21 : x86-64_linux Status: SUCCESS',
2760
].join('\n');
2861

2962
let results;

0 commit comments

Comments
 (0)