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

Feat: IssueDetails test and build info #711

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

MarceloRobert
Copy link
Collaborator

@MarceloRobert MarceloRobert commented Dec 23, 2024

Adds /issues/<issue_id>/version//tests endpoint to get all tests related to an issue
Adds /issues/<issue_id>/version//builds endpoint to get all builds related to an issue
Adds request for these endpoints from the frontend
Adds a SectionError component for when a table in a details page can't load and refactors its use in BuildDetailsTestSection
Adds a TestsTable to the IssueDetails page when the current issue is related to a test
Adds a BuildsTable to the IssueDetails page when the current issue is related to a test

The relation with tests and builds are intuitively mutually exclusive, but - since the database allows for both test_status and build_valid to be not null in a single issue - it is technically possible for an issue to be associated with tests and builds at the same time. There are no issues related to both tests and builds currently.

It's also possible for an issue to not be related with either tests or builds, but there are no occurrences of that for the maestro origin, only for redhat.

How to test

Go to an IssueDetails page with an issue related to tests and see the test table, such as this example:
http://localhost:5173/issue/maestro%3Af627e08f767a688209f3f9a2d41c6b4c260897b0/version/0

Go to an IssueDetails page with an issue related to builds and see the builds table, such as this example:
http://localhost:5173/issue/maestro:a8ba4fd7ab9f996d9e569f77d5cf91354e7a783b/version/0

An issue with no relation to either tests or builds for example: http://localhost:5173/issue/redhat:issue_2089/version/1727692707

Closes #705

@MarceloRobert MarceloRobert force-pushed the feat/issue-details-incidents branch from 2085926 to 8bc117d Compare December 23, 2024 17:10
@MarceloRobert MarceloRobert force-pushed the feat/issue-details-incidents branch from 8bc117d to 2f37bb0 Compare December 23, 2024 19:31
@MarceloRobert MarceloRobert marked this pull request as ready for review December 23, 2024 19:42
Comment on lines 38 to 47
missing_params = []
if issue_id is None:
missing_params.append("issue_id")
if version is None:
missing_params.append("version")
if len(missing_params) != 0:
return HttpResponseBadRequest(
getErrorResponseBody("Missing parameters: ", missing_params)
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

II'm pretty sure you can validate the parameters with pydantic

parsed_version = int(version)
except ValueError:
return HttpResponseBadRequest(
getErrorResponseBody("Invalid version parameter, must be an integer")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have create_error_response now

builds_data = self._fetch_incidents(issue_id=issue_id, version=parsed_version)

if builds_data is None:
return HttpResponseNotFound(getErrorResponseBody("Builds not found"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto about create error response

Comment on lines 36 to 42
missing_params = []
if issue_id is None:
missing_params.append("issue_id")
if version is None:
missing_params.append("version")
if len(missing_params) != 0:
return HttpResponseBadRequest(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto for pydantic and create_error_response

@@ -94,6 +101,21 @@ export const sanitizeBuilds = (
}));
};

export const sanitizeBuildTable = (
Copy link
Collaborator

@WilsonNet WilsonNet Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is creating an O(2N), and sometimes N equals 600000, maybe it is better to create an object with the sanitizers and place them on the row definition, but the only way of knowing is if we measure. I think this is okay for now but lets keep that in mind

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 600000 figure is for tests related to an issue, for builds the number is much lower. But I agree we should fix the typing of builds so that we won't need all this conversion.

@WilsonNet
Copy link
Collaborator

It is working nice, just some comments

@MarceloRobert MarceloRobert force-pushed the feat/issue-details-incidents branch from 2f37bb0 to e4648b4 Compare December 24, 2024 12:35
@MarceloRobert MarceloRobert self-assigned this Dec 24, 2024
Copy link
Collaborator Author

@MarceloRobert MarceloRobert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tables aren't receiving the correct data. Builds table should also get the log_url from the backend and the tests table aren't showing the relevant data in the cells

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IssueDetails: show tests and builds from an issue
3 participants