-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No longer mark test plan reports with skipped tests as final (#833)
* Hide mark as final button * No mark as final for skipped tests in graphql * Remove skipped tests from the UI * Add migration for unfinished tests * Simplify necessary files * Fix failing tests * Add code review fixes * Remove no-longer-necessary style class * Remove reference
- Loading branch information
Showing
12 changed files
with
144 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface /* , Sequelize */) { | ||
return queryInterface.sequelize.transaction(async transaction => { | ||
const [rows] = await queryInterface.sequelize.query( | ||
` | ||
SELECT | ||
"TestPlanReport".id, | ||
"TestPlanReport"."atId", | ||
"TestPlanRun"."testResults", | ||
"TestPlanVersion".tests | ||
FROM | ||
"TestPlanReport" | ||
INNER JOIN "TestPlanVersion" ON "TestPlanVersion".id = "TestPlanReport"."testPlanVersionId" | ||
INNER JOIN "TestPlanRun" ON "TestPlanReport".id = "TestPlanRun"."testPlanReportId" | ||
WHERE | ||
"TestPlanReport"."markedFinalAt" IS NOT NULL | ||
`, | ||
{ transaction } | ||
); | ||
|
||
const dataById = {}; | ||
rows.forEach(({ id, atId, testResults, tests }) => { | ||
if (dataById[id]) { | ||
dataById[id].runLengths.push(testResults.length); | ||
} else { | ||
const runnableTestsLength = tests.filter(test => | ||
test.atIds.includes(atId) | ||
).length; | ||
dataById[id] = { | ||
id, | ||
runnableTestsLength, | ||
runLengths: [testResults.length] | ||
}; | ||
} | ||
}); | ||
|
||
for (const data of Object.values(dataById)) { | ||
const isComplete = data.runLengths.every( | ||
runLength => runLength === data.runnableTestsLength | ||
); | ||
if (!isComplete) { | ||
console.info(`Found incomplete report ${data.id}`); // eslint-disable-line | ||
// Since final test plan reports can | ||
// no longer have skipped tests, we should | ||
// move them to the test queue where incomplete | ||
// runs are still supported. | ||
await queryInterface.sequelize.query( | ||
` | ||
UPDATE "TestPlanReport" SET "markedFinalAt" = NULL WHERE id = ? | ||
`, | ||
{ | ||
replacements: [data.id], | ||
transaction | ||
} | ||
); | ||
} | ||
} | ||
}); | ||
} | ||
}; |
27 changes: 8 additions & 19 deletions
27
server/resolvers/TestPlanReport/finalizedTestResultsResolver.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.