Skip to content

Commit bcfa367

Browse files
authored
Improve regex in TRSS to handle long line (#1080)
related: runtimes/automation/issues/591 Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
1 parent c1fe64d commit bcfa367

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

TestResultSummaryService/DataManager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ class DataManager {
219219
update.buildOutputId = buildOutputId;
220220
update.hasChildren = false;
221221
}
222-
const result = await testResults.update(criteria, { $set: update });
222+
await testResults.update(criteria, { $set: update });
223+
logger.verbose('updateBuildWithOutput done');
223224
}
224225

225226
// create build only if the build does not exist in database

TestResultSummaryService/JenkinsInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class JenkinsInfo {
6969
});
7070
const size = await logStream.getSize();
7171
logger.debug(
72-
'JenkinsInfo: getBuildOutput() is waiting for 5 secs after getSize()'
72+
'JenkinsInfo: getBuildOutput() is waiting for 1 secs after getSize()'
7373
);
7474
await Promise.delay(1 * 1000);
7575

TestResultSummaryService/parsers/Parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Parser {
1414
/=JAVA VERSION OUTPUT BEGIN=[\r\n]+([\s\S]*?)[\r\n]+.*=JAVA VERSION OUTPUT END=/;
1515
const javaBuildDateRegex =
1616
/\s([0-9]{4})-?(0[1-9]|1[012])-?(0[1-9]|[12][0-9]|3[01])/;
17-
const sdkResourceRegex = /.*?SDK_RESOURCE\=(.*)[\r\n]+/;
17+
const sdkResourceRegex = /SDK_RESOURCE\=(.*)[\r\n]+/;
1818
let curRegexResult = null;
1919
let javaVersion, jdkDate, sdkResource;
2020
if ((curRegexResult = javaVersionRegex.exec(output)) !== null) {
@@ -142,7 +142,7 @@ class Parser {
142142
let disabled = 0;
143143
// An example of test result summary: "TOTAL: 69 EXECUTED: 64 PASSED: 64 FAILED: 0 DISABLED: 0 SKIPPED: 5\n"
144144
const summaryRegex =
145-
/\S*\s*?TOTAL:\s*([0-9]*)\s*EXECUTED:\s*([0-9]*)\s*PASSED:\s*([0-9]*)\s*FAILED:\s*([0-9]*)\s*DISABLED:\s*([0-9]*)\s*SKIPPED:\s*([0-9]*)\s*(\r\n|\r|\n)/;
145+
/TOTAL:\s*([0-9]*)\s*EXECUTED:\s*([0-9]*)\s*PASSED:\s*([0-9]*)\s*FAILED:\s*([0-9]*)\s*DISABLED:\s*([0-9]*)\s*SKIPPED:\s*([0-9]*)\s*(\r\n|\r|\n)/;
146146
if ((m = summaryRegex.exec(output)) !== null) {
147147
total = parseInt(m[1], 10);
148148
executed = parseInt(m[2], 10);

TestResultSummaryService/parsers/Test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const Parser = require('./Parser');
2-
const regexRunningTest = /.*?Running test (.*?) \.\.\.\r?/;
3-
const testSeparator = /.*?===============================================\r?/;
4-
const regexFinishTime = /(.*?) Finish Time\: .* Epoch Time \(ms\)\: (\d+).*/;
5-
const regexStartTime = /(.*?) Start Time\: .* Epoch Time \(ms\)\: (\d+).*/;
2+
const regexRunningTest = /Running test (.*?) \.\.\.\r?/;
3+
const testSeparator = /===============================================\r?/;
4+
const regexFinishTime = /^(.*?) Finish Time\: .* Epoch Time \(ms\)\: (\d+).*/;
5+
const regexStartTime = /^(.*?) Start Time\: .* Epoch Time \(ms\)\: (\d+).*/;
66
const TestBenchmarkParser = require(`./TestBenchmarkParser`);
77
const ExternalTestParser = require(`./ExternalTestParser`);
88

0 commit comments

Comments
 (0)