Spin server when Tests start (#3316)

This commit is contained in:
yasser khan
2025-03-26 23:43:10 +05:30
committed by GitHub
parent 081d9c5ad5
commit aa4ee31da3
11 changed files with 477 additions and 322 deletions

View File

@@ -24,53 +24,13 @@ function analyzeFlakyTests() {
// Filter out the known flaky tests from the failed test titles
const newFailedTests = failedFullTitles.filter((test) => !knownFlakyTestsForOS.has(test));
// Check if any known failed tests are fixed
const fixedTests = [...knownFlakyTestsForOS].filter((test) => !failedFullTitles.includes(test));
const commentBody = generateCommentBodyFunctionalTest(newFailedTests, fixedTests);
// Print on CI
console.log(commentBody);
return {commentBody, newFailedTests};
return {newFailedTests, os};
} catch (error) {
console.error('Error analyzing failures:', error);
return {};
}
}
function generateCommentBodyFunctionalTest(newFailedTests, fixedTests) {
const osName = process.env.RUNNER_OS;
const build = process.env.BUILD_TAG;
let commentBody = `
## Test Summary for ${osName} on commit ${build}
`;
if (newFailedTests.length === 0 && fixedTests.length === 0) {
commentBody += `
All stable tests passed on ${osName}.
`;
return commentBody;
}
if (newFailedTests.length > 0) {
const newTestFailure = `New failed tests found on ${osName}:\n${newFailedTests.map((test) => `- ${test}`).join('\n')}`;
commentBody += `
${newTestFailure}
`;
}
if (fixedTests.length > 0) {
const fixedTestMessage = `The following known failed tests have been fixed on ${osName}:\n\t${fixedTests.map((test) => `- ${test}`).join('\n\t')}`;
commentBody += `
${fixedTestMessage}
`;
}
return commentBody;
}
module.exports = {
analyzeFlakyTests,
};