Skip to content

Commit

Permalink
Support rerun test builds (#732)
Browse files Browse the repository at this point in the history
related: adoptium/aqa-tests#3431 and adoptium/aqa-tests#4030
Signed-off-by: lanxia <[email protected]>

Signed-off-by: lanxia <[email protected]>
  • Loading branch information
llxia authored Nov 2, 2022
1 parent ee0959a commit 27fd949
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
30 changes: 19 additions & 11 deletions TestResultSummaryService/DataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@ class DataManager {
}

async parseOutput(buildName, output) {
let parserType = this.findParserType(buildName, output);
let parser;
if (parserType) {
parser = new Parsers[parserType](buildName);
} else {
parser = new DefaultParser();
parserType = 'Default';
const parserTypes = await Promise.all(
Object.keys(Parsers).map(async (type) => {
if (Parsers[type].canParse(buildName, output)) {
const parser = new Parsers[type](buildName);
return await parser.parse(output);
}
})
);
let results = parserTypes.filter((element) => {
return element !== undefined;
});
if (results.length === 0) {
const parser = new DefaultParser();
results = await parser.parse(output);
}
const obj = await parser.parse(output);
return { parserType, ...obj };
return Object.assign.apply({}, results);
}

async updateOutput(data) {
Expand Down Expand Up @@ -169,7 +175,8 @@ class DataManager {
update.buildOutputId = outputId;
}
update.hasChildren = true;
} else if (tests && tests.length > 0) {
}
if (tests && tests.length > 0) {
const testsObj = await Promise.all(
tests.map(async ({ testOutput, ...test }) => {
let testOutputId = null;
Expand Down Expand Up @@ -199,7 +206,8 @@ class DataManager {
);
update.tests = testsObj;
update.hasChildren = false;
} else if (build === null) {
}
if (build === null) {
const buildOutputId = await this.updateOutput({ id: null, output });
update.buildOutputId = buildOutputId;
update.hasChildren = false;
Expand Down
15 changes: 10 additions & 5 deletions test-result-summary-client/src/Build/AllTestsInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class Build extends Component {
const { buildId, limit, hasChildren } = getParams(
this.props.location.search
);
const hasChildrenBool = hasChildren === 'true';
let hasChildrenBool = hasChildren === 'true';
let limitParam = '';
if (limit) {
limitParam = `&limit=${limit}`;
Expand All @@ -37,15 +37,20 @@ export default class Build extends Component {
let errorMsg = '';

// if it is a parallel build.
if (!hasChildrenBool) {
const buildData = await fetchData(`/api/getData?_id=${buildId} `);
if (buildData && buildData[0].tests !== undefined) {
hasChildrenBool = true;
}
buildIds.push(buildId);
}
if (hasChildrenBool) {
const childrenBuilds = await fetchData(
`/api/getChildBuilds?parentId=${buildId}`
);
buildIds = childrenBuilds.map(
(childrenBuilds) => childrenBuilds._id
buildIds.push(
...childrenBuilds.map((childrenBuilds) => childrenBuilds._id)
);
} else {
buildIds.push(buildId);
}

await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export default class ResultSummary extends Component {

childBuildsResult = setBuildsStatus(build, childBuildsResult);
});
builds.sort((a, b) => a.buildName.localeCompare(b.buildName));
builds.forEach((build) => {
const buildName = build.buildName.toLowerCase();
if (getInfoFromBuildName(buildName)) {
Expand Down

0 comments on commit 27fd949

Please sign in to comment.