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(tests-table): filter by individual table path #882

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

murilx
Copy link
Contributor

@murilx murilx commented Feb 5, 2025

Filter by the path of every individual test when updatePathFilter is undefined

Closes #875

How to test

  • Ensure that the behavior of the tests table in Tree Details and Hardware Details are the same. Since they use updatePathFilter there shouldn't be any differences from the version on staging. However, they are still influenced by this implementation since all of the status counting is done in the filteredData useMemo.
  • Check if the tests tables in other pages (issue details and build details) can correctly filter by path now. In maestro, issue details generally have only one test group (boot) so it's recommended to test on build details or test in an issue details from redhat, for example, http://localhost:5173/issue/redhat%3Aissue_3137

@murilx murilx force-pushed the fix/tests-table-path-filter branch from 7891cd9 to 25a2a38 Compare February 5, 2025 11:58
@murilx murilx marked this pull request as ready for review February 5, 2025 11:58
@murilx murilx self-assigned this Feb 5, 2025
@@ -56,6 +56,44 @@ export interface ITestsTable {
currentPathFilter?: string;
}

type StatusGroup = Pick<
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to TestStatusGroup, to differ of StatusGroups (build)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to TPathTestsStatus to make it very clear from where these fields are coming from!

return result;
}),
individual_tests: test.individual_tests.filter(
t => t.status?.toUpperCase() === StatusTable.FAIL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This toUpperCase is really needed? If yes, in the statusCounter function you may transform the status string to upper case too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, if toUpperCase was needed, it should be included in statusCounter as well. Seeing that statusCounter is working I'd have to think that toUpperCase is not necessary in any situation. I'll change this and check to see if it's working correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be very unlikely that the database changes the way the status are written (from upper case to lower case for example), but since this does not cause any problems (like performance issues), I'd still say we keep this and add the same to statusCounter just to be sure

@murilx murilx force-pushed the fix/tests-table-path-filter branch from 25a2a38 to 0955fc6 Compare February 5, 2025 14:37
@WilsonNet
Copy link
Collaborator

};
const individualTest = test.individual_tests.filter(t => {
let dataIncludesPath = true;
if (isValidPath) dataIncludesPath = t.path.includes(path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

Suggested change
if (isValidPath) dataIncludesPath = t.path.includes(path);
if (isValidPath) {
dataIncludesPath = t.path.includes(path);
}

we should probably add this to eslint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All add it to another PR just to not "add noise" to this one

if (isValidPath) dataIncludesPath = t.path.includes(path);
if (dataIncludesPath) {
statusCounter(localGroup, t.status);
statusCounter(globalGroup, t.status);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is missplaced, the filter is affecting these counts just like the global group

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is the expected behavior based on what we currently see in tree and hardware details. globalGroup would be the sum of all localGroup. If all tests are filtered out, then globalGroup will correctly be 0-0-0-0

Copy link
Collaborator

@WilsonNet WilsonNet left a comment

Choose a reason for hiding this comment

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

it is working on my tests

Filter by the path of every individual test when `updatePathFilter` is
undefined

Closes #875
@murilx murilx force-pushed the fix/tests-table-path-filter branch from 0955fc6 to a772382 Compare February 6, 2025 12:08
Copy link
Collaborator

@Francisco2002 Francisco2002 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@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.

Working well

@murilx murilx merged commit 8e9baac into main Feb 6, 2025
5 checks passed
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.

Individual Tests Table path filter not working
4 participants