Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rerun test builds #732

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -156,6 +156,7 @@ export default class ResultSummary extends Component {
console.warn(`Cannot match ${buildName}`);
}
});
builds.sort((a, b) => a.buildName.localeCompare(b.buildName));
builds.forEach((build) => {
const buildName = build.buildName.toLowerCase();
if (getInfoFromBuildName(buildName)) {
Expand Down