Skip to content

Commit

Permalink
fix(historyChart): add null tests counts
Browse files Browse the repository at this point in the history
Close #485
  • Loading branch information
Francisco2002 committed Oct 30, 2024
1 parent c011d4f commit 2da8c5f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
54 changes: 33 additions & 21 deletions backend/kernelCI_app/views/treeCommitsHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ def _get_filters(self, filter_params):
value_name = f"{table}{field.capitalize()}{filter_params.get_comparison_op(f)}"

op = filter_params.get_comparison_op(f, "raw")

self.field_values[value_name] = f['value']
clause = f"{self.filters_options[table]['table_alias']}.{field}"

if op == "IN":
if f['value'] == 'NULL':
clause += " IS NULL"
elif op == "IN":
clause += f" = ANY(%({value_name})s)"
else:
clause += f" {op} %({value_name})s"

self.filters_options[table]['filters'].append(clause)

if field in ["config_name", "architecture", "compiler"]:
Expand Down Expand Up @@ -207,7 +211,9 @@ def get(self, request, commit_hash):
SUM(CASE WHEN t.status = 'DONE' AND t.path LIKE 'boot%%' THEN 1 ELSE 0 END)
AS boots_done_count,
SUM(CASE WHEN t.status = 'SKIP' AND t.path LIKE 'boot%%' THEN 1 ELSE 0 END)
AS boots_skip_count
AS boots_skip_count,
SUM(CASE WHEN t.status IS NULL AND t.path LIKE 'boot%%' THEN 1 ELSE 0 END)
AS boots_null_count
FROM
relevant_checkouts AS c
INNER JOIN
Expand All @@ -225,18 +231,20 @@ def get(self, request, commit_hash):
test_counts AS (
SELECT
c.git_commit_hash,
SUM(CASE WHEN t.status = 'FAIL' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_fail_count,
SUM(CASE WHEN t.status = 'ERROR' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_error_count,
SUM(CASE WHEN t.status = 'MISS' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_miss_count,
SUM(CASE WHEN t.status = 'PASS' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_pass_count,
SUM(CASE WHEN t.status = 'DONE' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_done_count,
SUM(CASE WHEN t.status = 'SKIP' AND t.path NOT LIKE 'boot%%' THEN 1 ELSE 0 END)
AS non_boots_skip_count
SUM(CASE WHEN t.status = 'FAIL' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_fail_count,
SUM(CASE WHEN t.status = 'ERROR' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_error_count,
SUM(CASE WHEN t.status = 'MISS' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_miss_count,
SUM(CASE WHEN t.status = 'PASS' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_pass_count,
SUM(CASE WHEN t.status = 'DONE' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_done_count,
SUM(CASE WHEN t.status = 'SKIP' AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_skip_count,
SUM(CASE WHEN t.status IS NULL AND (t.path <> 'boot' AND t.path NOT LIKE 'boot.%%')
THEN 1 ELSE 0 END) AS non_boots_null_count
FROM
relevant_checkouts AS c
INNER JOIN
Expand Down Expand Up @@ -264,12 +272,14 @@ def get(self, request, commit_hash):
boc.boots_pass_count,
boc.boots_done_count,
boc.boots_skip_count,
boc.boots_null_count,
tc.non_boots_fail_count,
tc.non_boots_error_count,
tc.non_boots_miss_count,
tc.non_boots_pass_count,
tc.non_boots_done_count,
tc.non_boots_skip_count
tc.non_boots_skip_count,
tc.non_boots_null_count
FROM
earliest_commits AS ec
LEFT JOIN
Expand Down Expand Up @@ -312,14 +322,16 @@ def get(self, request, commit_hash):
"pass_count": row[9],
"done_count": row[10],
"skip_count": row[11],
"null_count": row[12],
},
"non_boots_tests": {
"fail_count": row[12],
"error_count": row[13],
"miss_count": row[14],
"pass_count": row[15],
"done_count": row[16],
"skip_count": row[17],
"fail_count": row[13],
"error_count": row[14],
"miss_count": row[15],
"pass_count": row[16],
"done_count": row[17],
"skip_count": row[18],
"null_count": row[19],
},
}
for row in rows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ const CommitNavigationGraph = (): JSX.Element => {
item.boots_tests.miss_count +
item.boots_tests.skip_count +
item.boots_tests.error_count +
item.boots_tests.done_count;
item.boots_tests.done_count +
item.boots_tests.null_count;
series[0].data?.unshift(item.boots_tests.pass_count);
series[1].data?.unshift(item.boots_tests.fail_count);
series[2].data?.unshift(inconclusiveCount);
Expand All @@ -140,7 +141,8 @@ const CommitNavigationGraph = (): JSX.Element => {
item.non_boots_tests.miss_count +
item.non_boots_tests.skip_count +
item.non_boots_tests.error_count +
item.non_boots_tests.done_count;
item.non_boots_tests.done_count +
item.non_boots_tests.null_count;
series[0].data?.unshift(item.non_boots_tests.pass_count);
series[1].data?.unshift(item.non_boots_tests.fail_count);
series[2].data?.unshift(inconclusiveCount);
Expand Down
2 changes: 2 additions & 0 deletions dashboard/src/types/tree/TreeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export type PaginatedCommitHistoryByTree = {
pass_count: number;
done_count: number;
skip_count: number;
null_count: number;
};
non_boots_tests: {
fail_count: number;
Expand All @@ -283,6 +284,7 @@ export type PaginatedCommitHistoryByTree = {
pass_count: number;
done_count: number;
skip_count: number;
null_count: number;
};
};

Expand Down

0 comments on commit 2da8c5f

Please sign in to comment.