Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Inconclusive test counts #765

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions backend/kernelCI_app/helpers/treeDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
env_misc_value_or_default,
)
from kernelCI_app.cache import getQueryCache, setQueryCache
from kernelCI_app.utils import is_boot
from django.db import connection


Expand Down Expand Up @@ -231,9 +232,7 @@ def get_hardware_filter(row_data: dict) -> Any:

def is_test_boots_test(row_data: dict) -> bool:
test_path = row_data["test_path"]
if test_path.startswith("boot"):
return True
return False
return is_boot(test_path)


def get_build(row_data: dict) -> dict:
Expand Down
4 changes: 4 additions & 0 deletions backend/kernelCI_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ def string_to_json(string: str) -> Optional[dict]:
except json.JSONDecodeError as e:
log_message(e.msg)
return None


def is_boot(path: str | None) -> bool:
return path is not None and (path == "boot" or path.startswith("boot."))
15 changes: 8 additions & 7 deletions backend/kernelCI_app/views/hardwareDetailsView.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
from kernelCI_app.cache import getQueryCache, setQueryCache
from kernelCI_app.viewCommon import create_details_build_summary
from kernelCI_app.models import Tests
from kernelCI_app.utils import create_issue, extract_error_message
from kernelCI_app.utils import (
create_issue,
extract_error_message,
is_boot
)
from django.views.decorators.csrf import csrf_exempt
from kernelCI_app.helpers.trees import get_tree_heads
from kernelCI_app.helpers.filters import UNKNOWN_STRING, FilterParams
Expand Down Expand Up @@ -100,10 +104,6 @@ def get_history(record: Dict):
}


def is_boot(record: Dict) -> bool:
return record["path"] == "boot" or record["path"].startswith("boot.")


def get_record_tree(record: Dict, selected_trees: List) -> Optional[Dict]:
for tree in selected_trees:
if (
Expand Down Expand Up @@ -386,7 +386,7 @@ def sanitize_records(self, records, trees: List, is_all_selected: bool):
compatibles.update(record["environment_compatible"])

tree_index = current_tree["index"]
is_record_boot = is_boot(record)
is_record_boot = is_boot(record['path'])
# TODO -> Unify with tree_status_key, be careful with the pluralization
test_filter_key = "boot" if is_record_boot else "test"

Expand All @@ -411,7 +411,8 @@ def sanitize_records(self, records, trees: List, is_all_selected: bool):
continue

should_process_test = (
self.test_in_filter(test_filter_key, record)
record['id'] is not None
and self.test_in_filter(test_filter_key, record)
and record["id"] not in processed_tests
)

Expand Down
11 changes: 5 additions & 6 deletions backend/kernelCI_app/views/treeCommitsHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
build_misc_value_or_default,
env_misc_value_or_default,
)
from kernelCI_app.utils import getErrorResponseBody
from kernelCI_app.utils import getErrorResponseBody, is_boot
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
Expand Down Expand Up @@ -225,10 +225,6 @@ def _process_tests(self, row: Dict) -> None:
incident_test_id = row["incidents_test_id"]
build_valid = row["build_valid"]

is_boot = test_path is not None and test_path.startswith(
"boot"
)

commit_hash = row["git_commit_hash"]

if issue_id is None and (
Expand All @@ -237,7 +233,10 @@ def _process_tests(self, row: Dict) -> None:
):
issue_id = UNKNOWN_STRING

if is_boot:
if test_id is None:
return

if is_boot(test_path):
self._process_boots_count(
test_id=test_id,
test_status=test_status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const defaultColumns: ColumnDef<TPathTests>[] = [
fail={row.original.fail_tests}
skip={row.original.skip_tests}
error={row.original.error_tests}
nullStatus={row.original.null_tests}
/>
);
},
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/TestsTable/TestsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function TestsTable({
groups[group].skip_tests++;
break;
default:
if (!e.status) groups[group].null_tests++;
groups[group].null_tests++;
}
});
return Object.values(groups);
Expand Down
Loading