Skip to content

Commit

Permalink
feat(api): specific filters in commit chart
Browse files Browse the repository at this point in the history
- build valid
- build duration
- boots/tests status
- boots/tests duration

Part of #640
  • Loading branch information
Francisco2002 committed Dec 17, 2024
1 parent 769bac5 commit 7235309
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions backend/kernelCI_app/views/treeCommitsHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,46 @@ def _process_builds_count(

self.commit_hashes[commit_hash]['builds_count'][label] += 1

def _process_boots_count(
self,
test_status: str,
commit_hash: str,
test_duration: int,
test_path: str
) -> None:
is_boot_filter_out = self.filterParams.is_boot_filtered_out(
duration=test_duration,
issue_id=None,
path=test_path,
status=test_status
)

if is_boot_filter_out:
return

label = test_status.lower()
self.commit_hashes[commit_hash]['boots_count'][label] += 1

def _process_nonboots_count(
self,
test_status: str,
commit_hash: str,
test_duration: int,
test_path: str
) -> None:
is_nonboot_filter_out = self.filterParams.is_test_filtered_out(
duration=test_duration,
issue_id=None,
path=test_path,
status=test_status
)

if is_nonboot_filter_out:
return

label = test_status.lower()
self.commit_hashes[commit_hash]['tests_count'][label] += 1

def _pass_in_global_filters(self, row: Dict) -> bool:
hardware_compatibles = [UNKNOWN_STRING]
architecture = UNKNOWN_STRING
Expand Down Expand Up @@ -153,10 +193,20 @@ def _process_tests(self, row: Dict) -> None:
self.processed_tests.add(row['test_id'])
is_boot = row['test_path'] is not None and row['test_path'].startswith('boot')

count_label = "boots_count" if is_boot else "tests_count"
test_status = row['test_status'] or "NULL"
label = test_status.lower()
self.commit_hashes[commit_hash][count_label][label] += 1
if is_boot:
self._process_boots_count(
row['test_status'] or "NULL",
commit_hash,
row['test_duration'],
row['test_path']
)
else:
self._process_nonboots_count(
row['test_status'] or "NULL",
commit_hash,
row['test_duration'],
row['test_path']
)

def _process_builds(self, row: Dict) -> None:
if row["build_id"] is not None and row['build_id'] not in self.processed_builds:
Expand Down

0 comments on commit 7235309

Please sign in to comment.