Skip to content

Commit e70605b

Browse files
Liav Weiss (EXT-Nokia)YosiElias
authored andcommitted
Fix the machine failed test API to return the 3 machines with the highst failed tests.
1 parent ae8c9d9 commit e70605b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

TestResultSummaryService/routes/GetFailedTestByMachine.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ module.exports = async (req, res) => {
4141
}
4242

4343
// Format the result as an array of dictionaries with "machine" and "failedTest"
44-
const formattedResult = Object.entries(failedTestsByMachine).map(
45-
([machine, failedTests]) => ({
44+
const formattedResult = Object.entries(failedTestsByMachine)
45+
.map(([machine, failedTests]) => ({
4646
machine,
4747
failedTests,
48-
})
49-
);
48+
}))
49+
.sort((a, b) => b.failedTests - a.failedTests) // Sort in descending order
50+
.slice(0, 3); // Keep only the top 3 machines
5051

5152
// Send the formatted result as the response
5253
res.send(formattedResult);

test-result-summary-client/src/Build/Summary/Overview.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ export default class Overview extends Component {
178178
<div>
179179
<Tooltip title="Tests Success % = (Tests Passed/Tests Executed) * 100">
180180
<span>
181-
<strong>Tests Success Rate: </strong>
181+
<strong>
182+
Tests Success Rate:{' '}
183+
</strong>
182184
{passPercentage
183185
? passPercentage.toFixed(2) +
184186
'%'
@@ -197,17 +199,14 @@ export default class Overview extends Component {
197199
</Divider>
198200
{machineFailures &&
199201
machineFailures.length > 0 ? (
200-
machineFailures
201-
.sort(
202-
(a, b) =>
203-
b.failedTests - a.failedTests
204-
) // Sort by failedTests (descending)
205-
.map(({ machine, failedTests }) => (
202+
machineFailures.map(
203+
({ machine, failedTests }) => (
206204
<div key={machine}>
207205
{machine}: Failures:{' '}
208206
{failedTests}
209207
</div>
210-
))
208+
)
209+
)
211210
) : (
212211
<div>No Machine Failures</div>
213212
)}
@@ -224,22 +223,22 @@ export default class Overview extends Component {
224223
id={id}
225224
label="Manual Rerun Needed: "
226225
link={manual_rerun_needed}
227-
testSummaryResult="" // Take all results includes aborted jobs
226+
testSummaryResult="" // Take all results includes aborted jobs
228227
buildNameRegex={manual_rerun_needed_regex}
229228
/>
230229
<div>
231230
<span>
232231
<strong>
233232
Manual Rerun Targets Involved:
234-
</strong>
235-
{tests_needed_manual_rerun}
233+
</strong>
234+
{tests_needed_manual_rerun}
236235
</span>
237236
</div>
238237
<div>
239238
<Tooltip title="Job Success % = (Job Passed/Job Executed) * 100">
240239
<span>
241-
<strong>Job Success Rate: </strong>
242-
{job_success_rate
240+
<strong>Job Success Rate: </strong>
241+
{job_success_rate
243242
? job_success_rate.toFixed(2) +
244243
'%'
245244
: 'N/A'}

0 commit comments

Comments
 (0)